[Freeciv-Dev] (PR#12946) FACTOR in consider_settler_action
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12946 >
It seems that the multiplier used to prevent rounding
errors in consider_settler_action needs to be reversed
before best_newv is returned from
evaluate_improvements. This patch does that.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
diff -Nur -Xfreeciv/diff_ignore freeciv/server/settlers.c
freeciv-test/server/settlers.c
--- freeciv/server/settlers.c 2005-04-30 08:24:01.000000000 -0400
+++ freeciv-test/server/settlers.c 2005-04-30 16:48:02.217241616 -0400
@@ -48,6 +48,8 @@
#include "settlers.h"
+#define EI_FACTOR 1024
+
BV_DEFINE(nearness, MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS);
static nearness *territory;
#define TERRITORY(ptile) territory[(ptile)->index]
@@ -756,14 +758,13 @@
/* find the present value of the future benefit of this action */
if (consider) {
- const int FACTOR = 1024;
base_value = new_tile_value - old_tile_value;
- total_value = base_value * FACTOR;
+ total_value = base_value * EI_FACTOR;
if (!in_use) {
total_value /= 2;
}
- total_value += extra * FACTOR;
+ total_value += extra * EI_FACTOR;
/* use factor to prevent rounding errors */
total_value = amortize(total_value, delay);
@@ -932,6 +933,8 @@
} city_map_checked_iterate_end;
} city_list_iterate_end;
+ best_newv /= EI_FACTOR;
+
best_newv = (best_newv - food_upkeep * FOOD_WEIGHTING) * 100 / (40 +
food_cost);
if (best_newv < 0)
best_newv = 0; /* Bad Things happen without this line! :( -- Syela */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#12946) FACTOR in consider_settler_action,
Brian Dunstan <=
|
|