From 6a8fb9642e4fb337ffdd1048941bb6975ad6bd0c Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 12 Oct 2023 22:05:17 +0300 Subject: [PATCH 49/49] Player removel: Clear city border claims See osdn #48837 Signed-off-by: Marko Lindqvist --- client/client_main.c | 1 + common/fc_interface.h | 1 + common/player.c | 6 +++++- server/srv_main.c | 1 + tools/shared/tools_fc_interface.c | 2 ++ 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/client/client_main.c b/client/client_main.c index 03c8159b61..800d73a31e 100644 --- a/client/client_main.c +++ b/client/client_main.c @@ -1524,6 +1524,7 @@ static void fc_interface_init_client(void) funcs->server_setting_val_bitwise_get = client_ss_val_bitwise_get; funcs->create_extra = NULL; funcs->destroy_extra = NULL; + funcs->destroy_city = NULL; funcs->player_tile_vision_get = client_map_is_known_and_seen; funcs->player_tile_city_id_get = client_plr_tile_city_id_get; funcs->gui_color_free = color_free; diff --git a/common/fc_interface.h b/common/fc_interface.h index 75df5902b8..6bd5946637 100644 --- a/common/fc_interface.h +++ b/common/fc_interface.h @@ -40,6 +40,7 @@ struct functions { void (*create_extra)(struct tile *ptile, struct extra_type *pextra, struct player *pplayer); void (*destroy_extra)(struct tile *ptile, struct extra_type *pextra); + void (*destroy_city)(struct city *pcity); /* Returns iff the player 'pplayer' has the vision in the layer 'vision' at tile given by 'ptile'. */ bool (*player_tile_vision_get)(const struct tile *ptile, diff --git a/common/player.c b/common/player.c index 9968cfec9e..ac833e9d88 100644 --- a/common/player.c +++ b/common/player.c @@ -707,7 +707,11 @@ void player_clear(struct player *pplayer, bool full) } unit_list_iterate_end; city_list_iterate(pplayer->cities, pcity) { - game_remove_city(&wld, pcity); + if (fc_funcs->destroy_city != NULL) { + fc_funcs->destroy_city(pcity); + } else { + game_remove_city(&wld, pcity); + } } city_list_iterate_end; if (full) { diff --git a/server/srv_main.c b/server/srv_main.c index 94a15e7280..a704497d03 100644 --- a/server/srv_main.c +++ b/server/srv_main.c @@ -3706,6 +3706,7 @@ static void fc_interface_init_server(void) funcs->server_setting_val_bitwise_get = server_ss_val_bitwise_get; funcs->create_extra = create_extra; funcs->destroy_extra = destroy_extra; + funcs->destroy_city = remove_city; funcs->player_tile_vision_get = map_is_known_and_seen; funcs->player_tile_city_id_get = server_plr_tile_city_id_get; funcs->gui_color_free = server_gui_color_free; diff --git a/tools/shared/tools_fc_interface.c b/tools/shared/tools_fc_interface.c index a90444ea4c..0cf0d613c4 100644 --- a/tools/shared/tools_fc_interface.c +++ b/tools/shared/tools_fc_interface.c @@ -61,6 +61,8 @@ void fc_interface_init_tool(void) { struct functions *funcs = fc_interface_funcs(); + memset(funcs, 0, sizeof(*funcs)); + /* May be used when generating help texts */ funcs->server_setting_by_name = server_ss_by_name; funcs->server_setting_name_get = server_ss_name_get; -- 2.42.0