From b5936cdecc16c077382287a25547acdc459e1c4f Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 12 Oct 2023 22:12:10 +0300 Subject: [PATCH 5/5] Player removal: 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 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/client/client_main.c b/client/client_main.c index 06a2a3e0dc..2016dae533 100644 --- a/client/client_main.c +++ b/client/client_main.c @@ -1369,6 +1369,7 @@ static void fc_interface_init_client(void) funcs->create_extra = NULL; funcs->destroy_extra = NULL; + funcs->destroy_city = NULL; funcs->player_tile_vision_get = client_map_is_known_and_seen; funcs->gui_color_free = color_free; diff --git a/common/fc_interface.h b/common/fc_interface.h index 03d4348498..2661bb9645 100644 --- a/common/fc_interface.h +++ b/common/fc_interface.h @@ -33,6 +33,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 87ea3c3626..f28a04f1b7 100644 --- a/common/player.c +++ b/common/player.c @@ -674,7 +674,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 536483c8ad..e0f85fa21b 100644 --- a/server/srv_main.c +++ b/server/srv_main.c @@ -3428,6 +3428,7 @@ static void fc_interface_init_server(void) 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->gui_color_free = server_gui_color_free; -- 2.42.0