Skip to content

Commit

Permalink
Merge branch 'master' into feature/latrine
Browse files Browse the repository at this point in the history
  • Loading branch information
dvincent56 committed Apr 19, 2024
2 parents ba76ec4 + e120163 commit 9f3888d
Show file tree
Hide file tree
Showing 55 changed files with 696 additions and 274 deletions.
5 changes: 3 additions & 2 deletions res/assets/Graphics/ui.xml
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@
</image>
<image id="auxarch_banner_04">
<layer src="auxinf_banner_base"/>
<layer src="auxarch_banner_044" x="4" y="3"/>
<layer src="auxarch_banner_04" x="4" y="3"/>
</image>
<image id="auxarch_banner_05">
<layer src="auxinf_banner_base"/>
Expand Down Expand Up @@ -444,4 +444,5 @@
<layer group="this" image="Unmothball_4"/>
<layer src="Risk_Widget_Cross" x="1" y="2"/>
</image>
</assetlist>
</assetlist>

5 changes: 3 additions & 2 deletions res/assets/Graphics/walkers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2319,7 +2319,7 @@
</image>
<image id="architect_nw_11">
<layer group="110" image="86"/>
<layer src="architect_nw_1`"/>
<layer src="architect_nw_11"/>
</image>
<image id="architect_nw_12">
<layer group="110" image="94"/>
Expand Down Expand Up @@ -2923,4 +2923,5 @@
<layer src="mess_walker_n_12"/>
<layer src="caravanserai_walker_n_12"/>
</image>
</assetlist>
</assetlist>

4 changes: 3 additions & 1 deletion res/editor_examples/example_custom_messages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
This is the text that will be displayed when the message is shown. Note that text uses Rich Text formatting,
so it is possible to define new lines, paragraphs or built-in images.
- @H will start a new heading. It will be centered, on its own line, and in green color. You must use @P or
@L to start a new paragraph after a heading.
- @L will start a new line (line break).
- @P will start a new paragraph, identing the next line.
- @G### will show an image where ### is the id of the image.
Expand All @@ -28,7 +30,7 @@
-->
<title>Toga puer iratus est</title>
<subtitle>An assignment from a slightly fuming Caesar</subtitle>
<text>I am most displeased.@L
<text>@HI am most displeased.@L
I ask you to give me a prosperous city, and what did you give me? A single palace and tent squalor as far as the eye can see.@L
I expected defending legions and you gave me winding roads and lion tamers running marathons.@L
I requested wheat and wine to test your industry, but you tore it down the day after.@P
Expand Down
3 changes: 0 additions & 3 deletions src/building/barracks.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,7 @@ int building_barracks_create_tower_sentry(building *barracks, int x, int y)

void building_barracks_set_priority(building *barracks, int priority)
{
// TODO remove when archery available
if (priority != 4) {
barracks->subtype.barracks_priority = priority;
}
}

void building_barracks_toggle_delivery(building *barracks)
Expand Down
3 changes: 2 additions & 1 deletion src/building/building.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,8 @@ int building_is_fort(building_type type)
return type == BUILDING_FORT_LEGIONARIES ||
type == BUILDING_FORT_JAVELIN ||
type == BUILDING_FORT_MOUNTED ||
type == BUILDING_FORT_AUXILIA_INFANTRY;
type == BUILDING_FORT_AUXILIA_INFANTRY ||
type == BUILDING_FORT_ARCHERS;
}

int building_mothball_toggle(building *b)
Expand Down
1 change: 1 addition & 0 deletions src/building/clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ static building_type get_clone_type_from_building(building *b, building_type clo
case FIGURE_FORT_JAVELIN: return BUILDING_FORT_JAVELIN;
case FIGURE_FORT_MOUNTED: return BUILDING_FORT_MOUNTED;
case FIGURE_FORT_INFANTRY: return BUILDING_FORT_AUXILIA_INFANTRY;
case FIGURE_FORT_ARCHER: return BUILDING_FORT_ARCHERS;
}
}
return BUILDING_NONE;
Expand Down
3 changes: 3 additions & 0 deletions src/building/construction_building.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ static void add_fort(int type, building *fort)
fort->subtype.fort_figure_type = FIGURE_FORT_MOUNTED;
} else if (type == BUILDING_FORT_AUXILIA_INFANTRY) {
fort->subtype.fort_figure_type = FIGURE_FORT_INFANTRY;
} else if (BUILDING_FORT_ARCHERS) {
fort->subtype.fort_figure_type = FIGURE_FORT_ARCHER;
}

// create parade ground
Expand Down Expand Up @@ -250,6 +252,7 @@ static void add_to_map(int type, building *b, int size, int orientation, int wat
case BUILDING_FORT_JAVELIN:
case BUILDING_FORT_MOUNTED:
case BUILDING_FORT_AUXILIA_INFANTRY:
case BUILDING_FORT_ARCHERS:
add_fort(type, b);
break;
case BUILDING_GRAND_TEMPLE_CERES:
Expand Down
1 change: 1 addition & 0 deletions src/building/construction_warning.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ static void check_road_access(int type, int x, int y, int size)
case BUILDING_FORT_JAVELIN:
case BUILDING_FORT_MOUNTED:
case BUILDING_FORT_AUXILIA_INFANTRY:
case BUILDING_FORT_ARCHERS:
case BUILDING_HORSE_STATUE:
case BUILDING_DOLPHIN_FOUNTAIN:
case BUILDING_HEDGE_DARK:
Expand Down
1 change: 1 addition & 0 deletions src/building/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ int building_image_get(const building *b)
case BUILDING_FORT_LEGIONARIES:
case BUILDING_FORT_MOUNTED:
case BUILDING_FORT_AUXILIA_INFANTRY:
case BUILDING_FORT_ARCHERS:
switch (scenario_property_climate()) {
case CLIMATE_NORTHERN:
return assets_get_image_id("Military", "Fort_Main_North");
Expand Down
2 changes: 1 addition & 1 deletion src/building/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static const building_type MENU_BUILDING_TYPE[BUILD_MENU_MAX][BUILD_MENU_ITEM_MA
BUILDING_SMALL_TEMPLE_MERCURY, BUILDING_SMALL_TEMPLE_MARS, BUILDING_SMALL_TEMPLE_VENUS, 0},
{BUILDING_MENU_LARGE_TEMPLES, BUILDING_LARGE_TEMPLE_CERES, BUILDING_LARGE_TEMPLE_NEPTUNE,
BUILDING_LARGE_TEMPLE_MERCURY, BUILDING_LARGE_TEMPLE_MARS, BUILDING_LARGE_TEMPLE_VENUS, 0},
{BUILDING_FORT_LEGIONARIES, BUILDING_FORT_JAVELIN, BUILDING_FORT_MOUNTED, BUILDING_FORT_AUXILIA_INFANTRY, 0},
{BUILDING_FORT_LEGIONARIES, BUILDING_FORT_JAVELIN, BUILDING_FORT_MOUNTED, BUILDING_FORT_AUXILIA_INFANTRY, BUILDING_FORT_ARCHERS, 0},
{BUILDING_OBELISK, BUILDING_DECORATIVE_COLUMN, BUILDING_COLONNADE, BUILDING_HEDGE_LIGHT, BUILDING_HEDGE_DARK,
BUILDING_LOOPED_GARDEN_WALL, BUILDING_ROOFED_GARDEN_WALL, BUILDING_PANELLED_GARDEN_WALL, BUILDING_PAVILION_BLUE, BUILDING_SMALL_POND,
BUILDING_LARGE_POND, 0},
Expand Down
2 changes: 1 addition & 1 deletion src/building/model.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ const model_building *model_get_building(building_type type)
return &buildings[BUILDING_LARGE_STATUE];
}

if (type == BUILDING_FORT_AUXILIA_INFANTRY) {
if (type == BUILDING_FORT_AUXILIA_INFANTRY || type == BUILDING_FORT_ARCHERS) {
return &buildings[BUILDING_FORT_LEGIONARIES];
}

Expand Down
3 changes: 2 additions & 1 deletion src/building/properties.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ augustus_building_properties_mapping augustus_building_properties[] = {
{BUILDING_SHRINE_VENUS, {1,0,0,0,1}, "Health_Culture", "Altar_Venus"},
{BUILDING_OVERGROWN_GARDENS, {1, 1, 0, 0, 0}, "Aesthetics", "Overgrown_Garden_01"},
{BUILDING_FORT_AUXILIA_INFANTRY, {3,1,0,0,0}, "Military", 0},
{BUILDING_ARMOURY, {2,0,0,0,0}, "Military", "Armoury_OFF_C"},
{BUILDING_FORT_ARCHERS, {3,1,0,0,0}, "Military", 0},
{BUILDING_ARMOURY, {2,0,0,0,0}, "Military", "Armoury_OFF_C"},
{BUILDING_LATRINES, {1,1,0,0,0}, "Health_Education", "Latrine_N"}
};

Expand Down
2 changes: 2 additions & 0 deletions src/building/rotation.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ static int get_num_rotations(building_type type)
case BUILDING_FORT_LEGIONARIES:
case BUILDING_FORT_MOUNTED:
case BUILDING_FORT_AUXILIA_INFANTRY:
case BUILDING_FORT_ARCHERS:
case BUILDING_WAREHOUSE:
return 4;
case BUILDING_HIPPODROME:
Expand Down Expand Up @@ -233,6 +234,7 @@ int building_rotation_type_has_rotations(building_type type)
case BUILDING_FORT_LEGIONARIES:
case BUILDING_FORT_MOUNTED:
case BUILDING_FORT_AUXILIA_INFANTRY:
case BUILDING_FORT_ARCHERS:
case BUILDING_WAREHOUSE:
case BUILDING_HIPPODROME:
case BUILDING_GATEHOUSE:
Expand Down
5 changes: 3 additions & 2 deletions src/building/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,10 @@ typedef enum {
BUILDING_OVERGROWN_GARDENS = 201,
BUILDING_FORT_AUXILIA_INFANTRY = 202,
BUILDING_ARMOURY = 203,
BUILDING_LATRINES = 204,
BUILDING_FORT_ARCHERS = 204,
BUILDING_LATRINES = 205,
// helper constants
BUILDING_TYPE_MAX = 205
BUILDING_TYPE_MAX = 206
} building_type;

/**
Expand Down
20 changes: 14 additions & 6 deletions src/city/health.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,29 +295,37 @@ static void adjust_sickness_level_in_plague_buildings(int hospital_coverage_bonu
}
}

int city_health_get_house_health_level(const building *b)
int city_health_get_house_health_level(const building *b, int update_city_data)
{
int house_health = 0;

if (building_is_house(b->type)) {
house_health = calc_bound(b->subtype.house_level, 0, 10);
if (b->data.house.clinic && b->data.house.hospital) {
house_health += 50;
city_data.health.population_access.clinic += b->house_population;
if (update_city_data) {
city_data.health.population_access.clinic += b->house_population;
}
} else if (b->data.house.hospital) {
house_health += 40;
} else if (b->data.house.clinic) {
house_health += 30;
city_data.health.population_access.clinic += b->house_population;
if (update_city_data) {
city_data.health.population_access.clinic += b->house_population;
}
}

if (b->data.house.bathhouse) {
house_health += 15;
city_data.health.population_access.baths += b->house_population;
if (update_city_data) {
city_data.health.population_access.baths += b->house_population;
}
}
if (b->data.house.barber) {
house_health += 10;
city_data.health.population_access.barber += b->house_population;
if (update_city_data) {
city_data.health.population_access.barber += b->house_population;
}
}
if (b->has_latrines_access || b->has_water_access) {
house_health += 10;
Expand Down Expand Up @@ -360,7 +368,7 @@ void city_health_update(void)
b->sickness_level = 0;
continue;
}
int house_health = city_health_get_house_health_level(b);
int house_health = city_health_get_house_health_level(b, 1);

total_population += b->house_population;
healthy_population += calc_adjust_with_percentage(b->house_population, house_health);
Expand Down
2 changes: 1 addition & 1 deletion src/city/health.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void city_health_change(int amount);

void city_health_set(int new_value);

int city_health_get_house_health_level(const building *b);
int city_health_get_house_health_level(const building *b, int update_city_data);

void city_health_update(void);

Expand Down
2 changes: 2 additions & 0 deletions src/core/lang.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,8 @@ const uint8_t *lang_get_string(int group, int index)
return translation_for(TR_BUILDING_FORT_AUXILIA_INFANTRY);
case BUILDING_ARMOURY:
return translation_for(TR_BUILDING_ARMOURY);
case BUILDING_FORT_ARCHERS:
return translation_for(TR_BUILDING_FORT_ARCHERS);
case BUILDING_LATRINES:
return translation_for(TR_BUILDING_LATRINES);
default:
Expand Down
16 changes: 11 additions & 5 deletions src/core/xml_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,18 @@ static void handle_element_text(const sxmltok_t *token)
if (data.current_element && data.current_element->on_text) {
const char *text = data.buffer.data + token->startpos;
int length = token->endpos - token->startpos;
// Remove whitespace at beginning
while (*text == ' ' && length > 0) {
text++;
length--;
while (length) {
char *end = memchr(text, '\n', length);
int line_length = end ? end - text + 1: length;
length -= line_length;
// Remove whitespace at beginning
while (*text == ' ' && line_length > 0) {
text++;
line_length--;
}
append_to_text(&data.texts[data.depth], text, line_length);
text += line_length;
}
append_to_text(&data.texts[data.depth], text, length);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/figure/action.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ static void (*figure_action_callbacks[])(figure *f) = {
figure_depot_cartpusher_action,
figure_soldier_action,
figure_beggar_action,
figure_soldier_action,
};

void figure_action_handle(void)
Expand Down
2 changes: 1 addition & 1 deletion src/figure/figure.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ int figure_is_enemy(const figure *f)

int figure_is_legion(const figure *f)
{
return (f->type >= FIGURE_FORT_JAVELIN && f->type <= FIGURE_FORT_LEGIONARY) || f->type == FIGURE_FORT_INFANTRY;
return (f->type >= FIGURE_FORT_JAVELIN && f->type <= FIGURE_FORT_LEGIONARY) || f->type == FIGURE_FORT_INFANTRY || f->type == FIGURE_FORT_ARCHER;
}

int figure_is_herd(const figure *f)
Expand Down
3 changes: 2 additions & 1 deletion src/figure/formation.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ void formation_change_morale(formation *m, int amount)
max_morale = m->has_military_training ? 90 : 80;
} else if (m->figure_type == FIGURE_ENEMY_CAESAR_LEGIONARY) {
max_morale = 100;
} else if (m->figure_type == FIGURE_FORT_JAVELIN || m->figure_type == FIGURE_FORT_MOUNTED || m->figure_type == FIGURE_FORT_INFANTRY) {
} else if (m->figure_type == FIGURE_FORT_JAVELIN || m->figure_type == FIGURE_FORT_MOUNTED
|| m->figure_type == FIGURE_FORT_INFANTRY || m->figure_type == FIGURE_FORT_ARCHER) {
max_morale = m->has_military_training ? 70 : 60;
} else {
switch (m->enemy_type) {
Expand Down
2 changes: 1 addition & 1 deletion src/figure/formation.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ enum {
LEGION_RECRUIT_JAVELIN = 2,
LEGION_RECRUIT_LEGIONARY = 3,
LEGION_RECRUIT_INFANTRY = 4,
LEGION_RECRUIT_ARCHERY = 5
LEGION_RECRUIT_ARCHER = 5,
};

typedef enum {
Expand Down
2 changes: 2 additions & 0 deletions src/figure/formation_legion.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ void formation_legion_update_recruit_status(building *fort)
m->legion_recruit_type = LEGION_RECRUIT_MOUNTED;
} else if (type == FIGURE_FORT_INFANTRY) {
m->legion_recruit_type = LEGION_RECRUIT_INFANTRY;
} else if (type == FIGURE_FORT_ARCHER) {
m->legion_recruit_type = LEGION_RECRUIT_ARCHER;
}
} else { // too many figures
int too_many = m->num_figures - m->max_figures;
Expand Down
1 change: 1 addition & 0 deletions src/figure/name.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ int figure_name_get(figure_type type, enemy_type_t enemy)

case FIGURE_FORT_JAVELIN:
case FIGURE_ENEMY_CAESAR_JAVELIN:
case FIGURE_FORT_ARCHER:
return get_next_name(&data.javelin_thrower, 231, 32);

case FIGURE_FORT_MOUNTED:
Expand Down
1 change: 1 addition & 0 deletions src/figure/phrase.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ static int phrase_based_on_figure_state(figure *f)
case FIGURE_FORT_MOUNTED:
case FIGURE_FORT_LEGIONARY:
case FIGURE_FORT_INFANTRY:
case FIGURE_FORT_ARCHER:
return soldier_phrase();
case FIGURE_DOCKER:
return docker_phrase(f);
Expand Down
5 changes: 5 additions & 0 deletions src/figure/properties.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,11 @@ static const figure_properties properties[FIGURE_TYPE_MAX] = {
.max_damage = 10, .attack_value = 0, .defense_value = 0,
.missile_defense_value = 0, .missile_attack_value = 0, .missile_delay = 0
},
[FIGURE_FORT_ARCHER] = {
.category = FIGURE_CATEGORY_ARMED,
.max_damage = 80, .attack_value = 6, .defense_value = 0,
.missile_defense_value = 0, .missile_attack_value = 4, .missile_delay = 50
},

};

Expand Down
1 change: 1 addition & 0 deletions src/figure/sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void figure_play_die_sound(const figure *f)
case FIGURE_PREFECT:
case FIGURE_FORT_JAVELIN:
case FIGURE_FORT_LEGIONARY:
case FIGURE_FORT_ARCHER:
case FIGURE_GLADIATOR:
case FIGURE_INDIGENOUS_NATIVE:
case FIGURE_TOWER_SENTRY:
Expand Down
3 changes: 2 additions & 1 deletion src/figure/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ typedef enum {
FIGURE_DEPOT_CART_PUSHER = 91,
FIGURE_FORT_INFANTRY = 92,
FIGURE_BEGGAR = 93,
FIGURE_TYPE_MAX = 94
FIGURE_FORT_ARCHER = 94,
FIGURE_TYPE_MAX = 95
} figure_type;

typedef enum {
Expand Down
Loading

0 comments on commit 9f3888d

Please sign in to comment.