Skip to content

Commit

Permalink
Server: Backport 0025-Autoworkers-Use-ADV_WANTS_EQ-for-comparing-tile…
Browse files Browse the repository at this point in the history
…-valu.patch

Signed-off-by: Marko Lindqvist <[email protected]>
  • Loading branch information
cazfi committed Oct 15, 2023
1 parent 630acf4 commit 00e8e07
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
4 changes: 4 additions & 0 deletions freeciv/apply_patches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,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
# ----------------------------------
Expand Down Expand Up @@ -67,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"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From 7a363dfc060e5aaeef57db560d00785bf92ea50a Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <[email protected]>
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 <[email protected]>
---
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

0 comments on commit 00e8e07

Please sign in to comment.