Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a501253
birds not taken into account
Johannes-callidus Oct 22, 2025
fc7b520
Merge branch 'Keriew:master' into fix-figure-count-bridge
Johannes-callidus Nov 7, 2025
dd737bd
leftshift
Johannes-callidus Nov 7, 2025
08d2614
Merge branch 'fix-figure-count-bridge' of https://github.com/johannes…
Johannes-callidus Nov 7, 2025
4ea4b2e
first function
Johannes-callidus Nov 7, 2025
5350de9
next function
Johannes-callidus Nov 7, 2025
2e8eb5b
fix build
Johannes-callidus Nov 7, 2025
b8b2bc7
more functions
Johannes-callidus Nov 7, 2025
64e1a5d
Merge branch 'Keriew:master' into fix-figure-count-bridge
Johannes-callidus Nov 7, 2025
b34c35d
more cats
Johannes-callidus Nov 7, 2025
03edd36
reassign cats
Johannes-callidus Nov 8, 2025
54c73fe
all
Johannes-callidus Nov 8, 2025
9050ef4
small re-assigning
Johannes-callidus Nov 9, 2025
85d597d
change the category checks
Johannes-callidus Nov 9, 2025
9832ca7
add that 's'
Johannes-callidus Nov 9, 2025
e753ccf
the bridge thing
Johannes-callidus Nov 9, 2025
c5d82c1
config option
Johannes-callidus Nov 9, 2025
43173f8
Merge branch 'master' into fix-figure-count-bridge
Johannes-callidus Nov 9, 2025
162cb23
fix build errors
Johannes-callidus Nov 9, 2025
8bf739f
hmm
Johannes-callidus Nov 9, 2025
2b663aa
need debuger
Johannes-callidus Nov 9, 2025
a381949
got debugger (lldb)
Johannes-callidus Nov 10, 2025
4377abd
Merge branch 'master' into fix-figure-count-bridge
Johannes-callidus Nov 25, 2025
91f8e1f
Merge branch 'master' into fix-figure-count-bridge
Johannes-callidus Jan 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/building/construction_clear.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ static int clear_land_confirmed(int measure_only, int x_start, int y_start, int
items_placed++;
map_aqueduct_remove(grid_offset);
} else if (map_terrain_is(grid_offset, TERRAIN_WATER)) { //only bridges fall here
if (!measure_only && map_bridge_count_figures(grid_offset) > 0) {
if (!measure_only && (map_bridge_has_figures(grid_offset) && !config_get(CONFIG_GP_CH_ALWAYS_DESTROY_BRIDGES))) {
city_warning_show(WARNING_PEOPLE_ON_BRIDGE, NEW_WARNING_SLOT);
} else if (confirm.bridge_confirmed == 1) {
map_bridge_remove(grid_offset, measure_only);
Expand Down
2 changes: 2 additions & 0 deletions src/core/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ static const char *ini_keys[] = {
[CONFIG_GENERAL_UNLOCK_MOUSE] = "general_unlock_mouse",
[CONFIG_GP_CH_HOUSING_PRE_MERGE_VACANT_LOTS] = "gp_ch_housing_pre_merge_vacant_lots",
[CONFIG_UI_BUILD_SHOW_RESERVOIR_RANGES] = "ui_build_show_reservoir_ranges",
[CONFIG_GP_CH_ALWAYS_DESTROY_BRIDGES] = "always_be_able_to_destroy_bridges"
};

static const char *ini_string_keys[] = {
Expand Down Expand Up @@ -175,6 +176,7 @@ static int default_values[CONFIG_MAX_ENTRIES] = {
[CONFIG_GENERAL_UNLOCK_MOUSE] = 1,
[CONFIG_GP_CH_HOUSING_PRE_MERGE_VACANT_LOTS] = 1,
[CONFIG_UI_BUILD_SHOW_RESERVOIR_RANGES] = 1,
[CONFIG_GP_CH_ALWAYS_DESTROY_BRIDGES] = 0
};

static const char default_string_values[CONFIG_STRING_MAX_ENTRIES][CONFIG_STRING_VALUE_MAX] = { 0 };
Expand Down
1 change: 1 addition & 0 deletions src/core/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ typedef enum {
CONFIG_GENERAL_UNLOCK_MOUSE,
CONFIG_GP_CH_HOUSING_PRE_MERGE_VACANT_LOTS,
CONFIG_UI_BUILD_SHOW_RESERVOIR_RANGES,
CONFIG_GP_CH_ALWAYS_DESTROY_BRIDGES,
CONFIG_MAX_ENTRIES
} config_key;

Expand Down
21 changes: 5 additions & 16 deletions src/figure/combat.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,13 +405,16 @@ int figure_combat_get_missile_target_for_enemy(figure *enemy, int max_distance,

static int can_attack_animal(figure_category category, figure_category opponent_category, formation *l, figure *opponent)
{
if (category != FIGURE_CATEGORY_ARMED || opponent_category != FIGURE_CATEGORY_ANIMAL) {
if (!(category == FIGURE_CATEGORY_ARMED || category == FIGURE_CATEGORY_HOSTILE) || opponent_category != FIGURE_CATEGORY_ANIMAL) {
return 0;
}
if (category == FIGURE_CATEGORY_HOSTILE) {
return 1;
}
if (config_get(CONFIG_GP_CH_AUTO_KILL_ANIMALS)) {
return 1;
}
if (l->target_formation_id && l->target_formation_id == opponent->formation_id) {
if ((l->target_formation_id && l->target_formation_id == opponent->formation_id) || FIGURE_CATEGORY_AGGRESSIVE_ANIMAL) {
return 1;
}
return 0;
Expand Down Expand Up @@ -449,30 +452,16 @@ void figure_combat_attack_figure_at(figure *f, int grid_offset)
if (opponent->action_state == FIGURE_ACTION_159_NATIVE_ATTACKING) {
attack = 1;
}
} else if (category == FIGURE_CATEGORY_ARMED && opponent_category == FIGURE_CATEGORY_CRIMINAL) {
attack = 1;
} else if (category == FIGURE_CATEGORY_ARMED && opponent_category == FIGURE_CATEGORY_HOSTILE) {
attack = 1;
} else if (category == FIGURE_CATEGORY_ARMED && opponent_category == FIGURE_CATEGORY_AGGRESSIVE_ANIMAL) {
attack = 1;
} else if (category == FIGURE_CATEGORY_HOSTILE && opponent_category == FIGURE_CATEGORY_CITIZEN) {
attack = 1;
} else if (category == FIGURE_CATEGORY_HOSTILE && opponent_category == FIGURE_CATEGORY_ARMED) {
attack = 1;
} else if (category == FIGURE_CATEGORY_HOSTILE && opponent_category == FIGURE_CATEGORY_CRIMINAL) {
attack = 1;
} else if (category == FIGURE_CATEGORY_HOSTILE && opponent_category == FIGURE_CATEGORY_ANIMAL) {
attack = 1;
} else if (category == FIGURE_CATEGORY_HOSTILE && opponent_category == FIGURE_CATEGORY_AGGRESSIVE_ANIMAL) {
attack = 1;
} else if (category == FIGURE_CATEGORY_AGGRESSIVE_ANIMAL && opponent_category == FIGURE_CATEGORY_CITIZEN) {
attack = 1;
} else if (category == FIGURE_CATEGORY_AGGRESSIVE_ANIMAL && opponent_category == FIGURE_CATEGORY_ARMED) {
attack = 1;
} else if (category == FIGURE_CATEGORY_AGGRESSIVE_ANIMAL && opponent_category == FIGURE_CATEGORY_CRIMINAL) {
attack = 1;
} else if (category == FIGURE_CATEGORY_AGGRESSIVE_ANIMAL && opponent_category == FIGURE_CATEGORY_ANIMAL) {
attack = 1;
} else if (category == FIGURE_CATEGORY_AGGRESSIVE_ANIMAL && opponent_category == FIGURE_CATEGORY_HOSTILE) {
attack = 1;
} else if (can_attack_animal(category, opponent_category, l, opponent)) {
Expand Down
7 changes: 7 additions & 0 deletions src/figure/figure.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "game/save_version.h"
#include "empire/city.h"
#include "figure/name.h"
#include "figure/properties.h"
#include "figure/route.h"
#include "figure/trader.h"
#include "figure/visited_buildings.h"
Expand Down Expand Up @@ -293,6 +294,12 @@ int figure_is_herd(const figure *f)
return f->type >= FIGURE_SHEEP && f->type <= FIGURE_ZEBRA;
}

int figure_is_category(figure *f, figure_category category)
{
const figure_properties *f_props = figure_properties_for_type(f->type);
return f_props->category & category;
}

static void initialize_new_figure(figure *f, unsigned int position)
{
f->id = position;
Expand Down
3 changes: 3 additions & 0 deletions src/figure/figure.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "core/buffer.h"
#include "core/direction.h"
#include "figure/action.h"
#include "figure/properties.h"
#include "figure/type.h"

#define FIGURE_FACTION_ROAMER_PREVIEW 2
Expand Down Expand Up @@ -156,6 +157,8 @@ int figure_is_legion(const figure *f);

int figure_is_herd(const figure *f);

int figure_is_category(figure *f, figure_category category);

void figure_init_scenario(void);

void figure_kill_all(void);
Expand Down
Loading
Loading