-
Notifications
You must be signed in to change notification settings - Fork 342
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Server: Backport 0025-Autoworkers-Use-ADV_WANTS_EQ-for-comparing-tile…
…-valu.patch Signed-off-by: Marko Lindqvist <[email protected]>
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
freeciv/patches/backports/0025-Autoworkers-Use-ADV_WANTS_EQ-for-comparing-tile-valu.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|