From 5e75e17572a18c4bb5c1a5b5624ec760f981c8dc Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 9 Dec 2023 02:55:57 +0200 Subject: [PATCH] Update to Freeciv server freeciv/freeciv@019d0cc3f0 Signed-off-by: Marko Lindqvist --- .../src/main/webapp/javascript/fc_types.js | 3 +- freeciv/apply_patches.sh | 4 - ...yer-removal-Clear-city-border-claims.patch | 154 ------------------ freeciv/version.txt | 2 +- 4 files changed, 3 insertions(+), 160 deletions(-) delete mode 100644 freeciv/patches/backports/0020-Player-removal-Clear-city-border-claims.patch diff --git a/freeciv-web/src/main/webapp/javascript/fc_types.js b/freeciv-web/src/main/webapp/javascript/fc_types.js index a4c87dd81..3de69857a 100644 --- a/freeciv-web/src/main/webapp/javascript/fc_types.js +++ b/freeciv-web/src/main/webapp/javascript/fc_types.js @@ -340,7 +340,8 @@ var VUT_ORIGINAL_OWNER = 52; var VUT_IMPR_FLAG = 53; var VUT_WRAP = 54; var VUT_PLAYER_FLAG = 55; -var VUT_COUNT = 56; /* Keep this last. */ +var VUT_PLAYER_STATE = 56; +var VUT_COUNT = 57; /* Keep this last. */ /* Freeciv's gui_type enum */ /* GUI_STUB used for options which do not belong to any gui. */ diff --git a/freeciv/apply_patches.sh b/freeciv/apply_patches.sh index 68f6b3545..167aca429 100755 --- a/freeciv/apply_patches.sh +++ b/freeciv/apply_patches.sh @@ -6,9 +6,6 @@ # https://osdn.net/projects/freeciv/ticket/????? # https://redmine.freeciv.org/issues/? # -# 0020-Player-removal-Clear-city-border-claims.patch -# Player removal fix -# osdn #48837 # 0002-Make-playertile-extras-dynamic-bitvector.patch # Memory usage optimization # osdn #48798 @@ -49,7 +46,6 @@ declare -a GIT_PATCHLIST=( ) declare -a PATCHLIST=( - "backports/0020-Player-removal-Clear-city-border-claims" "backports/0002-Make-playertile-extras-dynamic-bitvector" "backports/0039-Improve-report.c-coding-style" "backports/0002-Pick-random-nations-before-setting-turn-number-to-1" diff --git a/freeciv/patches/backports/0020-Player-removal-Clear-city-border-claims.patch b/freeciv/patches/backports/0020-Player-removal-Clear-city-border-claims.patch deleted file mode 100644 index 723365f66..000000000 --- a/freeciv/patches/backports/0020-Player-removal-Clear-city-border-claims.patch +++ /dev/null @@ -1,154 +0,0 @@ -From 0eb8821d6930e3d772d88e8e0a04c09c69a118c8 Mon Sep 17 00:00:00 2001 -From: Marko Lindqvist -Date: Thu, 12 Oct 2023 22:05:17 +0300 -Subject: [PATCH 20/26] 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/citytools.c | 8 ++++++-- - server/srv_main.c | 1 + - server/unittools.c | 16 ++++++++++------ - tools/shared/tools_fc_interface.c | 2 ++ - 7 files changed, 26 insertions(+), 9 deletions(-) - -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 1017eee669..e49d59a9b1 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/citytools.c b/server/citytools.c -index 197b15262f..982a2c5a7a 100644 ---- a/server/citytools.c -+++ b/server/citytools.c -@@ -1748,6 +1748,7 @@ void remove_city(struct city *pcity) - moved = FALSE; - adjc_iterate(&(wld.map), pcenter, tile1) { - struct unit *ptrans; -+ - if (!moved && is_native_tile(punittype, tile1)) { - if (adv_could_unit_move_to_tile(punit, tile1) == 1) { - /* Move */ -@@ -1792,6 +1793,7 @@ void remove_city(struct city *pcity) - dbv_init(&tile_processed, map_num_tiles()); - for (tile_list_append(process_queue, pcenter); tile_list_size(process_queue) > 0;) { - struct tile *ptile = tile_list_front(process_queue); -+ - tile_list_pop_front(process_queue); - dbv_set(&tile_processed, tile_index(ptile)); - adjc_iterate(&(wld.map), ptile, piter) { -@@ -1914,8 +1916,10 @@ void remove_city(struct city *pcity) - } - } conn_list_iterate_end; - -- vision_clear_sight(old_vision); -- vision_free(old_vision); -+ if (old_vision != NULL) { -+ vision_clear_sight(old_vision); -+ vision_free(old_vision); -+ } - - /* Infrastructures may have changed. */ - send_tile_info(nullptr, pcenter, FALSE); -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/server/unittools.c b/server/unittools.c -index b7328c7cc1..05567041ae 100644 ---- a/server/unittools.c -+++ b/server/unittools.c -@@ -1850,9 +1850,11 @@ static void server_remove_unit_full(struct unit *punit, bool transported, - - /* Clear the vision before sending unit remove. Else, we might duplicate - * the PACKET_UNIT_REMOVE if we lose vision of the unit tile. */ -- vision_clear_sight(punit->server.vision); -- vision_free(punit->server.vision); -- punit->server.vision = NULL; -+ if (punit->server.vision != NULL) { -+ vision_clear_sight(punit->server.vision); -+ vision_free(punit->server.vision); -+ punit->server.vision = NULL; -+ } - - packet.unit_id = punit->id; - /* Send to onlookers. */ -@@ -4124,9 +4126,11 @@ bool unit_move(struct unit *punit, struct tile *pdesttile, int move_cost, - - /* Clear old vision. */ - unit_move_data_list_iterate(plist, pmove_data) { -- vision_clear_sight(pmove_data->old_vision); -- vision_free(pmove_data->old_vision); -- pmove_data->old_vision = NULL; -+ if (pmove_data->old_vision != NULL) { -+ vision_clear_sight(pmove_data->old_vision); -+ vision_free(pmove_data->old_vision); -+ pmove_data->old_vision = NULL; -+ } - } unit_move_data_list_iterate_end; - - /* Move consequences. */ -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 - diff --git a/freeciv/version.txt b/freeciv/version.txt index 8fa5ae9e9..a785a9a93 100644 --- a/freeciv/version.txt +++ b/freeciv/version.txt @@ -1,7 +1,7 @@ # The Git SHA hash for the commit to checkout from # https://github.com/freeciv/freeciv -FCREV=aba0c63eeb1f4eae2bc1f16a693f804200b11e34 +FCREV=019d0cc3f0ebc9864cb0949f14ed85b04b7aa8d4 ORIGCAPSTR="+Freeciv.Devel-\${MAIN_VERSION}-2023.Oct.09"