diff --git a/freeciv-web/src/main/webapp/javascript/action_dialog.js b/freeciv-web/src/main/webapp/javascript/action_dialog.js index edf3e3f2d..d69b89d23 100644 --- a/freeciv-web/src/main/webapp/javascript/action_dialog.js +++ b/freeciv-web/src/main/webapp/javascript/action_dialog.js @@ -333,14 +333,12 @@ function popup_action_selection(actor_unit, action_probabilities, } for (var action_id = 0; action_id < ACTION_COUNT; action_id++) { - if (action_id != ACTION_UNUSED_1 && action_id != ACTION_UNUSED_2) { - if (actions[action_id]['tgt_kind'] == tgt_kind - && action_prob_possible( - action_probabilities[action_id])) { - buttons.push(create_act_sel_button(id, actor_unit['id'], - tgt_id, sub_tgt_id, action_id, - action_probabilities)); - } + if (actions[action_id]['tgt_kind'] == tgt_kind + && action_prob_possible( + action_probabilities[action_id])) { + buttons.push(create_act_sel_button(id, actor_unit['id'], + tgt_id, sub_tgt_id, action_id, + action_probabilities)); } } } diff --git a/freeciv-web/src/main/webapp/javascript/control.js b/freeciv-web/src/main/webapp/javascript/control.js index 576df147a..200f8b8a9 100644 --- a/freeciv-web/src/main/webapp/javascript/control.js +++ b/freeciv-web/src/main/webapp/javascript/control.js @@ -1669,32 +1669,30 @@ function do_unit_paradrop_to(punit, ptile) var paradrop_action = null; for (act_id = 0; act_id < ACTION_COUNT; act_id++) { - if (action_id != ACTION_UNUSED_1 && action_id != ACTION_UNUSED_2) { - var paction = action_by_number(act_id); + var paction = action_by_number(act_id); - if (!(action_has_result(paction, ACTRES_PARADROP_CONQUER) - || action_has_result(paction, ACTRES_PARADROP))) { - /* Not relevant. */ - continue; - } + if (!(action_has_result(paction, ACTRES_PARADROP_CONQUER) + || action_has_result(paction, ACTRES_PARADROP))) { + /* Not relevant. */ + continue; + } - if (utype_can_do_action(unit_type(punit), act_id)) { - if (paradrop_action == null) { - /* This is the first possible paradrop action. */ - paradrop_action = paction; - } else { - /* More than one paradrop action may be possible. The user must - * choose. Have the server record that an action decision is wanted - * for this unit so the dialog will be brought up. */ - var packet = { - "pid" : packet_unit_sscs_set, - "unit_id" : punit['id'], - "type" : USSDT_QUEUE, - "value" : ptile['index'] - }; - send_request(JSON.stringify(packet)); - return; - } + if (utype_can_do_action(unit_type(punit), act_id)) { + if (paradrop_action == null) { + /* This is the first possible paradrop action. */ + paradrop_action = paction; + } else { + /* More than one paradrop action may be possible. The user must + * choose. Have the server record that an action decision is wanted + * for this unit so the dialog will be brought up. */ + var packet = { + "pid" : packet_unit_sscs_set, + "unit_id" : punit['id'], + "type" : USSDT_QUEUE, + "value" : ptile['index'] + }; + send_request(JSON.stringify(packet)); + return; } } } diff --git a/freeciv-web/src/main/webapp/javascript/fc_types.js b/freeciv-web/src/main/webapp/javascript/fc_types.js index 1f35b5fb5..dde35dce4 100644 --- a/freeciv-web/src/main/webapp/javascript/fc_types.js +++ b/freeciv-web/src/main/webapp/javascript/fc_types.js @@ -197,28 +197,28 @@ var ACTION_UPGRADE_UNIT = 42; var ACTION_CONVERT = 43; var ACTION_AIRLIFT = 44; var ACTION_ATTACK = 45; -var ACTION_SUICIDE_ATTACK = 46; -var ACTION_STRIKE_BUILDING = 47; -var ACTION_STRIKE_PRODUCTION = 48; -var ACTION_CONQUER_CITY = 49; -var ACTION_CONQUER_CITY2 = 50; -var ACTION_CONQUER_CITY3 = 51; -var ACTION_CONQUER_CITY4 = 52; -var ACTION_BOMBARD = 53; -var ACTION_BOMBARD2 = 54; -var ACTION_BOMBARD3 = 55; -var ACTION_BOMBARD_LETHAL = 56; -var ACTION_FORTIFY = 57; -var ACTION_CULTIVATE = 58; -var ACTION_PLANT = 59; -var ACTION_TRANSFORM_TERRAIN = 60; -var ACTION_ROAD = 61; -var ACTION_IRRIGATE = 62; -var ACTION_MINE = 63; -var ACTION_BASE = 64; -var ACTION_PILLAGE = 65; -var ACTION_UNUSED_1 = 66; -var ACTION_UNUSED_2 = 67; +var ACTION_ATTACK2 = 46; +var ACTION_SUICIDE_ATTACK = 47; +var ACTION_SUICIDE_ATTACK2 = 48; +var ACTION_STRIKE_BUILDING = 49; +var ACTION_STRIKE_PRODUCTION = 50; +var ACTION_CONQUER_CITY = 51; +var ACTION_CONQUER_CITY2 = 52; +var ACTION_CONQUER_CITY3 = 53; +var ACTION_CONQUER_CITY4 = 54; +var ACTION_BOMBARD = 55; +var ACTION_BOMBARD2 = 56; +var ACTION_BOMBARD3 = 57; +var ACTION_BOMBARD_LETHAL = 58; +var ACTION_FORTIFY = 59; +var ACTION_CULTIVATE = 60; +var ACTION_PLANT = 61; +var ACTION_TRANSFORM_TERRAIN = 62; +var ACTION_ROAD = 63; +var ACTION_IRRIGATE = 64; +var ACTION_MINE = 65; +var ACTION_BASE = 66; +var ACTION_PILLAGE = 67; var ACTION_TRANSPORT_BOARD = 68; var ACTION_TRANSPORT_BOARD2 = 69; var ACTION_TRANSPORT_BOARD3 = 70; diff --git a/freeciv/apply_patches.sh b/freeciv/apply_patches.sh index bede672e4..0e45e185e 100755 --- a/freeciv/apply_patches.sh +++ b/freeciv/apply_patches.sh @@ -5,9 +5,6 @@ # osdn #????? is ticket in freeciv.org tracker: # https://osdn.net/projects/freeciv/ticket/????? # -# 0013-Meson-Replace-boolean-ruledit-option-with-tools-arra.patch -# Refactor meson options -# osdn #48700 # 0031-Lua-Always-pass-lua_Integer-to-API_TYPE_INT.patch # Lua API fix # osdn #48722 @@ -38,6 +35,9 @@ # 0050-Correct-filling-of-territory-claiming-extras-cache.patch # Fix terr claiming extras cache # osdn #48838 +# 0025-Autoworkers-Use-ADV_WANTS_EQ-for-comparing-tile-valu.patch +# Autoworkers work value fix +# osdn #48842 # Not in the upstream Freeciv server # ---------------------------------- @@ -60,7 +60,6 @@ declare -a GIT_PATCHLIST=( ) declare -a PATCHLIST=( - "backports/0013-Meson-Replace-boolean-ruledit-option-with-tools-arra" "backports/0031-Lua-Always-pass-lua_Integer-to-API_TYPE_INT" "backports/0042-Meson-Make-manual-generator-build-optional" "backports/0036-tile_move_cost_ptrs-Make-cardinal_move-signed" @@ -71,6 +70,7 @@ declare -a PATCHLIST=( "backports/0064-featured_text.-ch-Replace-NULL-with-nullptr" "backports/0050-Cache-territory-claiming-base-types" "backports/0050-Correct-filling-of-territory-claiming-extras-cache" + "backports/0025-Autoworkers-Use-ADV_WANTS_EQ-for-comparing-tile-valu" "meson_webperimental" "metachange" "text_fixes" diff --git a/freeciv/patches/backports/0013-Meson-Replace-boolean-ruledit-option-with-tools-arra.patch b/freeciv/patches/backports/0013-Meson-Replace-boolean-ruledit-option-with-tools-arra.patch deleted file mode 100644 index 2343618f6..000000000 --- a/freeciv/patches/backports/0013-Meson-Replace-boolean-ruledit-option-with-tools-arra.patch +++ /dev/null @@ -1,251 +0,0 @@ -From 66ff0e1f6a24908b015240d3057d57ea30d57d40 Mon Sep 17 00:00:00 2001 -From: Marko Lindqvist -Date: Fri, 22 Sep 2023 14:38:54 +0300 -Subject: [PATCH 13/25] Meson: Replace boolean 'ruledit' option with 'tools' - array - -See osdn #48700 - -Signed-off-by: Marko Lindqvist ---- - doc/INSTALL.meson | 6 ++++-- - meson.build | 4 ++-- - meson_options.txt | 9 +++++---- - platforms/flatpak/org.freeciv.gtk322.yml | 2 +- - platforms/flatpak/org.freeciv.gtk4.yml | 2 +- - platforms/flatpak/org.freeciv.mp.gtk3.yml | 2 +- - platforms/flatpak/org.freeciv.mp.gtk4.yml | 2 +- - platforms/flatpak/org.freeciv.qt.yml | 2 +- - platforms/flatpak/org.freeciv.ruledit.yml | 2 +- - platforms/flatpak/org.freeciv.sdl2.yml | 2 +- - .../windows/installer_cross/meson-winbuild.sh | 16 ++++++++-------- - platforms/windows/installer_msys2/Makefile.meson | 4 ++-- - 12 files changed, 28 insertions(+), 25 deletions(-) - -diff --git a/doc/INSTALL.meson b/doc/INSTALL.meson -index 3202b36922..91092f7fd9 100644 ---- a/doc/INSTALL.meson -+++ b/doc/INSTALL.meson -@@ -150,8 +150,10 @@ readline ('try'/'true'/'false') - audio (boolean): - Build sound support to the clients. Defaults to true. - --ruledit (boolean): -- Build ruleset editor. Defaults to true. -+tools (array): -+ Extra tools to build: -+ * ruledit : Ruleset editor -+ Default is to build them all. - - nls (boolean): - Build in Native Language Support. Defaults to true. -diff --git a/meson.build b/meson.build -index b01e924b89..4bc117c207 100644 ---- a/meson.build -+++ b/meson.build -@@ -5,7 +5,7 @@ c_compiler = meson.get_compiler('c') - - b_root = meson.project_build_root() - --if get_option('ruledit') or \ -+if get_option('tools').contains('ruledit') or \ - get_option('clients').contains('qt') or \ - get_option('fcmp').contains('qt') - add_languages('cpp', native: false) -@@ -4093,7 +4093,7 @@ executable('freeciv-ruleup', - install: true - ) - --if get_option('ruledit') -+if get_option('tools').contains('ruledit') - - if not qt_dep.found() - if qtver == 'qt6' or qtver == 'qt6x' -diff --git a/meson_options.txt b/meson_options.txt -index 40134d50d8..83500a504c 100644 ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -50,10 +50,11 @@ option('audio', - value: true, - description: 'Build in sound support') - --option('ruledit', -- type: 'boolean', -- value: true, -- description: 'Build ruleset editor') -+option('tools', -+ type: 'array', -+ choices: ['ruledit'], -+ value: ['ruledit'], -+ description: 'Extra tools to build') - - option('nls', - type: 'boolean', -diff --git a/platforms/flatpak/org.freeciv.gtk322.yml b/platforms/flatpak/org.freeciv.gtk322.yml -index 81dc93ec9b..76cb997af5 100644 ---- a/platforms/flatpak/org.freeciv.gtk322.yml -+++ b/platforms/flatpak/org.freeciv.gtk322.yml -@@ -18,7 +18,7 @@ modules: - config-opts: - - -Dclients=gtk3.22 - - -Dfcmp=[] -- - -Druledit=false -+ - -Dtools=[] - sources: - - type: dir - path: ../.. -diff --git a/platforms/flatpak/org.freeciv.gtk4.yml b/platforms/flatpak/org.freeciv.gtk4.yml -index 1d8c139e02..1d6c62e91c 100644 ---- a/platforms/flatpak/org.freeciv.gtk4.yml -+++ b/platforms/flatpak/org.freeciv.gtk4.yml -@@ -18,7 +18,7 @@ modules: - config-opts: - - -Dclients=gtk4 - - -Dfcmp=[] -- - -Druledit=false -+ - -Dtools=[] - sources: - - type: dir - path: ../.. -diff --git a/platforms/flatpak/org.freeciv.mp.gtk3.yml b/platforms/flatpak/org.freeciv.mp.gtk3.yml -index a38692d0e2..7b89e0d783 100644 ---- a/platforms/flatpak/org.freeciv.mp.gtk3.yml -+++ b/platforms/flatpak/org.freeciv.mp.gtk3.yml -@@ -18,7 +18,7 @@ modules: - - -Dfcmp=gtk3 - - -Dclients=[] - - -Dserver=disabled -- - -Druledit=false -+ - -Dtools=[] - sources: - - type: dir - path: ../.. -diff --git a/platforms/flatpak/org.freeciv.mp.gtk4.yml b/platforms/flatpak/org.freeciv.mp.gtk4.yml -index b88ca4f71f..77e8721ef4 100644 ---- a/platforms/flatpak/org.freeciv.mp.gtk4.yml -+++ b/platforms/flatpak/org.freeciv.mp.gtk4.yml -@@ -18,7 +18,7 @@ modules: - - -Dfcmp=gtk4 - - -Dclients=[] - - -Dserver=disabled -- - -Druledit=false -+ - -Dtools=[] - sources: - - type: dir - path: ../.. -diff --git a/platforms/flatpak/org.freeciv.qt.yml b/platforms/flatpak/org.freeciv.qt.yml -index f8939c65c2..8fcc5bd338 100644 ---- a/platforms/flatpak/org.freeciv.qt.yml -+++ b/platforms/flatpak/org.freeciv.qt.yml -@@ -19,7 +19,7 @@ modules: - - -Dqtver=qt6 - - -Dclients=qt - - -Dfcmp=[] -- - -Druledit=false -+ - -Dtools=[] - sources: - - type: dir - path: ../.. -diff --git a/platforms/flatpak/org.freeciv.ruledit.yml b/platforms/flatpak/org.freeciv.ruledit.yml -index 4605edcef9..d778b57663 100644 ---- a/platforms/flatpak/org.freeciv.ruledit.yml -+++ b/platforms/flatpak/org.freeciv.ruledit.yml -@@ -15,7 +15,7 @@ modules: - no-autogen: true - config-opts: - - -Dqtver=qt6 -- - -Druledit=true -+ - -Dtools=ruledit - - -Dclients=[] - - -Dserver=disabled - - -Dfcmp=[] -diff --git a/platforms/flatpak/org.freeciv.sdl2.yml b/platforms/flatpak/org.freeciv.sdl2.yml -index 0b49e5fea6..0521f6cad5 100644 ---- a/platforms/flatpak/org.freeciv.sdl2.yml -+++ b/platforms/flatpak/org.freeciv.sdl2.yml -@@ -19,7 +19,7 @@ modules: - config-opts: - - -Dclients=sdl2 - - -Dfcmp=[] -- - -Druledit=false -+ - -Dtools=[] - sources: - - type: dir - path: ../.. -diff --git a/platforms/windows/installer_cross/meson-winbuild.sh b/platforms/windows/installer_cross/meson-winbuild.sh -index e3f78c828e..93ac407753 100755 ---- a/platforms/windows/installer_cross/meson-winbuild.sh -+++ b/platforms/windows/installer_cross/meson-winbuild.sh -@@ -7,7 +7,7 @@ - # See COPYING available from the same location you got this script. - # - --MESON_WINBUILD_VERSION="3.1.0-beta" -+MESON_WINBUILD_VERSION="3.2.0-alpha" - MIN_WINVER=0x0603 # Windows 8.1. Qt6-client and Qt6-ruledit builds override this - CROSSER_FEATURE_LEVEL=2.7 - -@@ -77,23 +77,23 @@ QTPARAMS="" - - case "${GUI}" in - gtk3.22) FCMP="gtk3" -- RULEDIT=false ;; -+ TOOLS="[]" ;; - gtk4) FCMP="gtk4" -- RULEDIT=false ;; -+ TOOLS="[]" ;; - sdl2) FCMP="gtk4" -- RULEDIT=false ;; -+ TOOLS="[]" ;; - qt5) CLIENT="qt" - FCMP="qt" -- RULEDIT=true -+ TOOLS="ruledit" - QTPARAMS="-Dqtver=qt5" ;; - qt6) CLIENT="qt" - FCMP="qt" -- RULEDIT=true -+ TOOLS="ruledit" - MIN_WINVER=0x0A00 - QTPARAMS="-Dqtver=qt6" ;; - ruledit) CLIENT="[]" - FCMP="[]" -- RULEDIT=true -+ TOOLS="ruledit" - MIN_WINVER=0x0A00 - QTPARAMS="-Dqtver=qt6" ;; - esac -@@ -158,7 +158,7 @@ if ! meson setup \ - -Dmwand="${MWAND}" \ - -Dreadline=false \ - -Dserver="${SERVER}" \ -- -Druledit="${RULEDIT}" \ -+ -Dtools="${TOOLS}" \ - -Ddefault_library=static \ - ${QTPARAMS} \ - ${EXTRA_CONFIG} \ -diff --git a/platforms/windows/installer_msys2/Makefile.meson b/platforms/windows/installer_msys2/Makefile.meson -index 16615a6dda..a50b69b885 100644 ---- a/platforms/windows/installer_msys2/Makefile.meson -+++ b/platforms/windows/installer_msys2/Makefile.meson -@@ -156,7 +156,7 @@ installer-common: install-freeciv-$(GUI) install-env-$(GUI) - install-freeciv-common: clean-install-client-arch - # Create build directory - mkdir -p $(BUILD_DIR)/$(WINARCH)-client-$(GUI) -- cd $(BUILD_DIR)/$(WINARCH)-client-$(GUI); meson setup $(IMSYS2_DIR)/../../.. -Dprefix=$(IMSYS2_DIR)/$(INST_DIR)/$(WINARCH)-client-$(GUI) -Dfollowtag='windows-S3_3' -Dclients=$(CLIENT) -Dfcmp=$(FCMP) -Druledit=false -Dreadline=false -Dcacert-path='./ssl/certs/ca-bundle.crt' -Dmin-win-ver=$(MIN_WIN_VER) -Dsyslua=false $(EXTRA_CONFIG) -+ cd $(BUILD_DIR)/$(WINARCH)-client-$(GUI); meson setup $(IMSYS2_DIR)/../../.. -Dprefix=$(IMSYS2_DIR)/$(INST_DIR)/$(WINARCH)-client-$(GUI) -Dfollowtag='windows-S3_3' -Dclients=$(CLIENT) -Dfcmp=$(FCMP) -Dtools=[] -Dreadline=false -Dcacert-path='./ssl/certs/ca-bundle.crt' -Dmin-win-ver=$(MIN_WIN_VER) -Dsyslua=false $(EXTRA_CONFIG) - cd $(BUILD_DIR)/$(WINARCH)-client-$(GUI); ninja - cd $(BUILD_DIR)/$(WINARCH)-client-$(GUI); ninja install - cd $(BUILD_DIR)/$(WINARCH)-client-$(GUI); ninja langstat_core.txt -@@ -172,7 +172,7 @@ install-freeciv-common: clean-install-client-arch - install-ruledit-common: clean-ruledit-install-arch - # Create build directory - mkdir -p $(BUILD_DIR)/$(WINARCH)-ruledit-$(GUI) -- cd $(BUILD_DIR)/$(WINARCH)-ruledit-$(GUI); meson setup $(IMSYS2_DIR)/../../.. -Dprefix=$(IMSYS2_DIR)/$(INST_DIR)/$(WINARCH)-ruledit-$(GUI) -Dfollowtag='windows-S3_3' -Dclients=[] -Dfcmp=[] -Dserver=disabled -Druledit=true -Dreadline=false -Dcacert-path='./ssl/certs/ca-bundle.crt' -Dmin-win-ver=$(MIN_WIN_VER) -Dsyslua=false $(EXTRA_CONFIG) -+ cd $(BUILD_DIR)/$(WINARCH)-ruledit-$(GUI); meson setup $(IMSYS2_DIR)/../../.. -Dprefix=$(IMSYS2_DIR)/$(INST_DIR)/$(WINARCH)-ruledit-$(GUI) -Dfollowtag='windows-S3_3' -Dclients=[] -Dfcmp=[] -Dserver=disabled -Dtools=ruledit -Dreadline=false -Dcacert-path='./ssl/certs/ca-bundle.crt' -Dmin-win-ver=$(MIN_WIN_VER) -Dsyslua=false $(EXTRA_CONFIG) - cd $(BUILD_DIR)/$(WINARCH)-ruledit-$(GUI); ninja - cd $(BUILD_DIR)/$(WINARCH)-ruledit-$(GUI); ninja install - cd $(BUILD_DIR)/$(WINARCH)-ruledit-$(GUI); ninja langstat_core.txt langstat_ruledit.txt --- -2.40.1 - diff --git a/freeciv/patches/backports/0025-Autoworkers-Use-ADV_WANTS_EQ-for-comparing-tile-valu.patch b/freeciv/patches/backports/0025-Autoworkers-Use-ADV_WANTS_EQ-for-comparing-tile-valu.patch new file mode 100644 index 000000000..72ec1c545 --- /dev/null +++ b/freeciv/patches/backports/0025-Autoworkers-Use-ADV_WANTS_EQ-for-comparing-tile-valu.patch @@ -0,0 +1,38 @@ +From 7a363dfc060e5aaeef57db560d00785bf92ea50a Mon Sep 17 00:00:00 2001 +From: Marko Lindqvist +Date: Fri, 13 Oct 2023 01:56:36 +0300 +Subject: [PATCH 25/32] Autoworkers: Use ADV_WANTS_EQ() for comparing tile + values + +See osdn #48842 + +Signed-off-by: Marko Lindqvist +--- + server/advisors/autoworkers.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/server/advisors/autoworkers.c b/server/advisors/autoworkers.c +index a875cabcfe..c8a10a1ff1 100644 +--- a/server/advisors/autoworkers.c ++++ b/server/advisors/autoworkers.c +@@ -335,7 +335,7 @@ static void consider_worker_action(const struct player *pplayer, + + if (new_tile_value > old_tile_value) { + improves = TRUE; +- } else if (new_tile_value == old_tile_value && extra > 0) { ++ } else if (ADV_WANTS_EQ(new_tile_value, old_tile_value) && extra > 0) { + improves = TRUE; + } else { + improves = FALSE; +@@ -386,7 +386,7 @@ static void consider_worker_action(const struct player *pplayer, + } + + if (total_value > old_improvement_value +- || (total_value == old_improvement_value ++ || (ADV_WANTS_EQ(total_value, old_improvement_value) + && old_tile_value > *best_old_tile_value)) { + if (in_use) { + *best_value = total_value; +-- +2.42.0 + diff --git a/freeciv/version.txt b/freeciv/version.txt index b56e67d3c..ffbc22143 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=cffdf1a2ff580d07f615c4f8cdac42cf743ca921 +FCREV=2348fcd8d45fc589fc67c07373e1c4a8d0a4ae76 -ORIGCAPSTR="+Freeciv.Devel-\${MAIN_VERSION}-2023.Sep.20" +ORIGCAPSTR="+Freeciv.Devel-\${MAIN_VERSION}-2023.Sep.23" # There's no need to bump this constantly as current freeciv-web # makes no connections to outside world - all connections are