From 2bbfe75f0e826ed70da7d324292b2eb1165bfedc Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 29 May 2024 08:39:43 +0300 Subject: [PATCH 1/2] Update to Freeciv server freeciv/freeciv@3c41f4e1ac Signed-off-by: Marko Lindqvist --- freeciv/apply_patches.sh | 8 -- ...stent-city-workers-after-vision-loss.patch | 49 ------------ ...-C23-nullptr-usability-as-a-sentinel.patch | 74 ------------------- freeciv/version.txt | 4 +- scripts/generate_js_hand/generate_packets.py | 13 ++-- 5 files changed, 8 insertions(+), 140 deletions(-) delete mode 100644 freeciv/patches/backports/0054-Fix-inconsistent-city-workers-after-vision-loss.patch delete mode 100644 freeciv/patches/backports/0060-Check-C23-nullptr-usability-as-a-sentinel.patch diff --git a/freeciv/apply_patches.sh b/freeciv/apply_patches.sh index 0a32a3c4b..a3ccaa88a 100755 --- a/freeciv/apply_patches.sh +++ b/freeciv/apply_patches.sh @@ -9,15 +9,9 @@ # 0050-savegame-Fix-loading-invalid-resources-on-FoW-map.patch # Savegame resources loading fix # RM #463 -# 0054-Fix-inconsistent-city-workers-after-vision-loss.patch -# Fix to inconsistent city state -# RM #472 # 0049-Trigger-action-system-when-client-requests-activity-.patch # Activity action fix (esp. Pillage) # osdn #57670 -# 0060-Check-C23-nullptr-usability-as-a-sentinel.patch -# C23 compile fix -# RM #475 # 0048-Handle-CoastStrict-units-correctly-on-city-removal.patch # Fix to unit placement after city destruction # RM #525 @@ -63,9 +57,7 @@ declare -a GIT_PATCHLIST=( declare -a PATCHLIST=( "backports/0050-savegame-Fix-loading-invalid-resources-on-FoW-map" - "backports/0054-Fix-inconsistent-city-workers-after-vision-loss" "backports/0049-Trigger-action-system-when-client-requests-activity-" - "backports/0060-Check-C23-nullptr-usability-as-a-sentinel" "backports/0048-Handle-CoastStrict-units-correctly-on-city-removal" "backports/0061-savegame-Correct-loading-last-turn-change-time" "backports/0073-savecompat-Fix-adding-ACTION_NONE-actions-for-units-" diff --git a/freeciv/patches/backports/0054-Fix-inconsistent-city-workers-after-vision-loss.patch b/freeciv/patches/backports/0054-Fix-inconsistent-city-workers-after-vision-loss.patch deleted file mode 100644 index 2f88c5a2e..000000000 --- a/freeciv/patches/backports/0054-Fix-inconsistent-city-workers-after-vision-loss.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 6d0a68373ffd38ece9be93ddc71f1393392dc73d Mon Sep 17 00:00:00 2001 -From: Marko Lindqvist -Date: Thu, 18 Apr 2024 19:01:25 +0300 -Subject: [PATCH 54/54] Fix inconsistent city workers after vision loss - -See RM #472 - -Signed-off-by: Marko Lindqvist ---- - server/maphand.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/server/maphand.c b/server/maphand.c -index e462ba0fe9..11e74e969e 100644 ---- a/server/maphand.c -+++ b/server/maphand.c -@@ -1055,6 +1055,9 @@ void map_change_seen(struct player *pplayer, - if (pcity != NULL && city_owner(pcity) == pplayer) { - city_map_update_empty(pcity, ptile); - pcity->specialists[DEFAULT_SPECIALIST]++; -+ if (pcity->server.needs_arrange == CNA_NOT) { -+ pcity->server.needs_arrange = CNA_NORMAL; -+ } - } - - update_player_tile_last_seen(pplayer, ptile); -@@ -2522,6 +2525,19 @@ void vision_clear_sight(struct vision *vision) - const v_radius_t vision_radius_sq = V_RADIUS(-1, -1, -1); - - vision_change_sight(vision, vision_radius_sq); -+ -+ /* Owner of some city might have lost vision of a tile previously worked */ -+ players_iterate(pplayer) { -+ city_list_iterate(pplayer->cities, pcity) { -+ /* We are not interested about CNA_BROADCAST_PENDING, as the vision loss has -+ * not set it, and whatever set it should take care of it. */ -+ if (pcity->server.needs_arrange == CNA_NORMAL) { -+ city_refresh(pcity); -+ auto_arrange_workers(pcity); -+ pcity->server.needs_arrange = CNA_NOT; -+ } -+ } city_list_iterate_end; -+ } players_iterate_end; - } - - /**********************************************************************//** --- -2.43.0 - diff --git a/freeciv/patches/backports/0060-Check-C23-nullptr-usability-as-a-sentinel.patch b/freeciv/patches/backports/0060-Check-C23-nullptr-usability-as-a-sentinel.patch deleted file mode 100644 index 6dbe6b2d2..000000000 --- a/freeciv/patches/backports/0060-Check-C23-nullptr-usability-as-a-sentinel.patch +++ /dev/null @@ -1,74 +0,0 @@ -From ac5ef97b9a6c833011278db8eeb845774062f046 Mon Sep 17 00:00:00 2001 -From: Marko Lindqvist -Date: Fri, 19 Apr 2024 17:06:10 +0300 -Subject: [PATCH 60/60] Check C23 nullptr usability as a sentinel - -See RM #475 - -Signed-off-by: Marko Lindqvist ---- - m4/c23.m4 | 21 +++++++++++++-------- - meson.build | 9 ++++++--- - 2 files changed, 19 insertions(+), 11 deletions(-) - -diff --git a/m4/c23.m4 b/m4/c23.m4 -index 0c57f04856..9a265a0065 100644 ---- a/m4/c23.m4 -+++ b/m4/c23.m4 -@@ -1,18 +1,23 @@ - # Check for the presence of C23 features. - --# Check for C23 nullptr, and define FREECIV_HAVE_C23_NULLPTR if it's available -+# Check for C23 nullptr that can be passed as sentinel -+# and define FREECIV_HAVE_C23_NULLPTR if such is available - # - AC_DEFUN([FC_C23_NULLPTR], - [ - AC_LANG_PUSH([C]) -- AC_CHECK_HEADERS([stddef]) -+ AC_CHECK_HEADERS([stddef.h]) - AC_CACHE_CHECK([for C23 nullptr], [ac_cv_c23_nullptr], -- [AC_LINK_IFELSE([AC_LANG_PROGRAM( --[[#ifdef HAVE_STDDEF --#include --#endif]], -- [[ int *var = nullptr; ]])], --[ac_cv_c23_nullptr=yes], [ac_cv_c23_nullptr=no])]) -+ [_cflags_="$CFLAGS" -+ CFLAGS="$EXTRA_DEBUG_CFLAGS $CFLAGS" -+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM( -+[[#ifdef HAVE_STDDEF_H -+#include -+#endif -+void sentinental(...) __attribute__((__sentinel__(0)));]], -+ [[ sentinental(nullptr); ]])], -+[ac_cv_c23_nullptr=yes], [ac_cv_c23_nullptr=no])] -+ CFLAGS="$_cflags_") - if test "x${ac_cv_c23_nullptr}" = "xyes" ; then - AC_DEFINE([FREECIV_HAVE_C23_NULLPTR], [1], [C23 nullptr available]) - fi -diff --git a/meson.build b/meson.build -index 0a0b904599..c6b7483303 100644 ---- a/meson.build -+++ b/meson.build -@@ -585,11 +585,14 @@ if zstd_dep.found() - pub_conf_data.set('FREECIV_HAVE_LIBZSTD', 1) - endif - -+# Check for c23 nullptr that can be passed as sentinel - if c_compiler.compiles(''' --#include --int main(void) { int *var = nullptr; return 0; }''', -+#include -+void sentinental(...) __attribute__((__sentinel__(0))); -+void caller(void) { sentinental(nullptr); }''', - name: 'c23 nullptr', -- include_directories: include_directories(cross_inc_path)) -+ include_directories: include_directories(cross_inc_path), -+ args: ['-Wformat']) - pub_conf_data.set('FREECIV_HAVE_C23_NULLPTR', 1) - endif - --- -2.43.0 - diff --git a/freeciv/version.txt b/freeciv/version.txt index bd033abd0..1d2520d5f 100644 --- a/freeciv/version.txt +++ b/freeciv/version.txt @@ -1,9 +1,9 @@ # The Git SHA hash for the commit to checkout from # https://github.com/freeciv/freeciv -FCREV=861a93b2a4909d0e134b7112ac33fab82d0be9e5 +FCREV=3c41f4e1ac25fe1ff8b383740ebabfe044907c0b -ORIGCAPSTR="+Freeciv.Devel-\${MAIN_VERSION}-2024.Apr.23b" +ORIGCAPSTR="+Freeciv.Devel-\${MAIN_VERSION}-2024.Apr.30" # There's no need to bump this constantly as current freeciv-web # makes no connections to outside world - all connections are diff --git a/scripts/generate_js_hand/generate_packets.py b/scripts/generate_js_hand/generate_packets.py index 5dda93cdd..6260dcd2f 100755 --- a/scripts/generate_js_hand/generate_packets.py +++ b/scripts/generate_js_hand/generate_packets.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 # -*- coding: latin-1 -*- - # # Freeciv - Copyright (C) 2003 - Raimar Falke # This program is free software; you can redistribute it and/or modify @@ -532,7 +531,7 @@ def __init__(self,poscaps,negcaps,name,fields,packet,no): self.type=packet.type self.delta=packet.delta self.is_info=packet.is_info - self.cancel=packet.cancel + self.reset=packet.reset self.want_force=packet.want_force self.poscaps=poscaps @@ -825,8 +824,8 @@ def get_delta_send_body(self): hash_insert(*hash, clone, clone); ''' - # Cancel some is-info packets. - for i in self.cancel: + # Reset some is-info packets. + for i in self.reset: body=body+''' hash = &pc->phs.sent[%s]; if (NULL != *hash) { @@ -1005,12 +1004,12 @@ def __init__(self,str, types): self.want_force="force" in arr if self.want_force: arr.remove("force") - self.cancel=[] + self.reset=[] remaining=[] for i in arr: - mo=re.search("^cancel\((.*)\)$",i) + mo=re.search("^reset\((.*)\)$",i) if mo: - self.cancel.append(mo.group(1)) + self.reset.append(mo.group(1)) continue remaining.append(i) arr=remaining From 73d16167b63721fbf26a20b9ecdddd1d26f2e428 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 29 May 2024 08:56:46 +0300 Subject: [PATCH 2/2] Server: Backport 0074-Meson-Make-fc_server-to-depend-on-verhdr.patch Signed-off-by: Marko Lindqvist --- freeciv/apply_patches.sh | 4 +++ ...n-Make-fc_server-to-depend-on-verhdr.patch | 28 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 freeciv/patches/backports/0074-Meson-Make-fc_server-to-depend-on-verhdr.patch diff --git a/freeciv/apply_patches.sh b/freeciv/apply_patches.sh index a3ccaa88a..93f3286bc 100755 --- a/freeciv/apply_patches.sh +++ b/freeciv/apply_patches.sh @@ -30,6 +30,9 @@ # 0068-Meson-Make-libfreeciv-to-depend-on-gitrev.patch # Build fix # RM #597 +# 0074-Meson-Make-fc_server-to-depend-on-verhdr.patch +# Build fix +# RM #682 # 0077-city_freeze_workers_queue-Set-needs_arrange-for-citi.patch # City status legality fix # RM #661 @@ -64,6 +67,7 @@ declare -a PATCHLIST=( "backports/0089-Meson-Make-fc_client_common-to-depend-on-verhdr" "backports/0080-savegame-Save-ACTION_NONE-as-1" "backports/0068-Meson-Make-libfreeciv-to-depend-on-gitrev" + "backports/0074-Meson-Make-fc_server-to-depend-on-verhdr" "backports/0077-city_freeze_workers_queue-Set-needs_arrange-for-citi" "RevertAmplio2ExtraUnits" "meson_webperimental" diff --git a/freeciv/patches/backports/0074-Meson-Make-fc_server-to-depend-on-verhdr.patch b/freeciv/patches/backports/0074-Meson-Make-fc_server-to-depend-on-verhdr.patch new file mode 100644 index 000000000..dcbac934b --- /dev/null +++ b/freeciv/patches/backports/0074-Meson-Make-fc_server-to-depend-on-verhdr.patch @@ -0,0 +1,28 @@ +From 6228415a558a8adf6f715abe2d91ed2fd145b79a Mon Sep 17 00:00:00 2001 +From: Marko Lindqvist +Date: Tue, 28 May 2024 00:11:05 +0300 +Subject: [PATCH 74/74] Meson: Make fc_server to depend on verhdr + +See RM #682 + +Signed-off-by: Marko Lindqvist +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/meson.build b/meson.build +index 5938236ee7..7a3f0288e8 100644 +--- a/meson.build ++++ b/meson.build +@@ -1503,7 +1503,7 @@ server_lib = static_library('fc_server', + 'server/unittools.c', + 'server/voting.c', + include_directories: server_inc, +- sources: [ pack_server, ++ sources: [ verhdr, pack_server, + tolua.process('server/scripting/tolua_fcdb.pkg', + 'server/scripting/tolua_server.pkg')], + dependencies: lua_dep +-- +2.43.0 +