[Freeciv-Dev] (PR#13538) AI tax calculation ignores gold bonus
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13538 >
> [per - Mon Jul 25 23:49:20 2005]:
> Because these values are dependent on tax settings, which is what we are
> iterating through to find the optimal setting?
Oh. Right. In that case maybe you should just approximate the bonus as
the average of gold, science, and luxury bonuses:
trade = city_trade * pcity->bonus[O_TRADE] * (pcity->bonus[O_GOLD] +
pcity->bonus[O_LUXURY] + pcity->bonus[O_SCIENCE]) / (3 * 100 * 100)
...although this probably defies the purpose of the search, since which
bonus is larger (on a player-wide basis) has a great impact on where you
should put your taxes.
Or maybe you should calculate up the bonuses globally:
player_bonus[O_GOLD] = 0;
base_trade = 0;
city_list_iterate(pplayer->cities, pcity) {
/* Ignores city's bonus[O_TRADE] */
base_trade += city_trade;
player_bonus[O_GOLD] += city_trade * pcity->bonus[O_GOLD];
} cities_iterate_end;
player_bonus[O_GOLD] /= base_trade;
...then this gives a good approximation of the player-wide gold bonus
that can then be used for all calculations (and the same for science and
lux bonus, of course).
-jason
|
|