[Freeciv-Dev] Re: (PR#13319) Patch: Less idle workers
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13319 >
S2_0 version.
- ML
diff -Nurd -X.diff_ignore freeciv/server/settlers.c freeciv/server/settlers.c
--- freeciv/server/settlers.c 2005-06-24 16:58:11.531250000 +0300
+++ freeciv/server/settlers.c 2005-06-24 17:32:04.703125000 +0300
@@ -877,8 +877,6 @@
int best_oldv = 9999; /* oldv of best target so far; compared
if
newv==best_newv; not initialized to zero,
so that newv=0 activities are not chosen */
- int food_upkeep = unit_food_upkeep(punit);
- int food_cost = unit_foodbox_cost(punit);
bool can_rr = player_knows_techs_with_flag(pplayer, TF_RAILROAD);
int best_newv = 0;
@@ -1002,9 +1000,7 @@
} city_map_checked_iterate_end;
} city_list_iterate_end;
- 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 */
+ best_newv = MAX(best_newv, 0);
if (best_newv > 0) {
freelog(LOG_DEBUG,
@@ -1481,6 +1477,8 @@
virtualunit = create_unit_virtual(pplayer, pcity, unit_type, 0);
virtualunit->tile = pcity->tile;
want = evaluate_improvements(virtualunit, &best_act, &best_tile);
+ want = (want - unit_food_upkeep(virtualunit) * FOOD_WEIGHTING) * 100
+ / (40 + unit_foodbox_cost(virtualunit));
free(virtualunit);
/* Massage our desire based on available statistics to prevent
@@ -1488,7 +1486,8 @@
* the ruleset */
want /= MAX(1, ai->stats.workers[ptile->continent]
/ (ai->stats.cities[ptile->continent] + 1));
- want -= MIN(ai->stats.workers[ptile->continent], want);
+ want -= ai->stats.workers[ptile->continent];
+ want = MAX(want, 0);
CITY_LOG(LOG_DEBUG, pcity, "wants %s with want %d to do %s at (%d,%d), "
"we have %d workers and %d cities on the continent",
- [Freeciv-Dev] Re: (PR#13319) Patch: Less idle workers,
Marko Lindqvist <=
|
|