From 3fad101fb841eb59a92e37878096ab7128504d82 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 12 Oct 2023 22:09:46 +0300 Subject: [PATCH 10/10] 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 a6e49549db..db6d6fd389 100644 --- a/client/client_main.c +++ b/client/client_main.c @@ -1526,6 +1526,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 bf13601545..be510c9fac 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 1e05c2f3d3..87f3b3e972 100644 --- a/common/player.c +++ b/common/player.c @@ -698,7 +698,11 @@ void player_clear(struct player *pplayer, bool full) } unit_list_iterate_end; city_list_iterate(pplayer->cities, pcity) { - game_remove_city(pcity); + if (fc_funcs->destroy_city != NULL) { + fc_funcs->destroy_city(pcity); + } else { + game_remove_city(pcity); + } } city_list_iterate_end; if (full) { diff --git a/server/srv_main.c b/server/srv_main.c index 474b00febf..d4f203cdf6 100644 --- a/server/srv_main.c +++ b/server/srv_main.c @@ -3554,6 +3554,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 f99acbc038..d0f73ec878 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