Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2005:
[Freeciv-Dev] (PR#13538) AI tax calculation ignores gold bonus
Home

[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]
To: per@xxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#13538) AI tax calculation ignores gold bonus
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 25 Jul 2005 14:17:48 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13538 >

> [per - Mon Jul 25 14:08:43 2005]:

> The problem is not straight-forward to solve, however, due to the way this
> code is optimized: Trade is counted for all cities, then all trade is
> distributed to tax/sci/lux for various combinations of tax settings.

If we ignore rounding a gold bonus can be counted as a trade bonus for
the city.

  trade = city_trade * pcity->bonus[O_TRADE]  * (pcity->bonus[O_GOLD] *
pplayer->gold_pct + pcity->bonus[O_LUXURY] * pplayer->luxury_pct +
pcity->bonus[O_SCIENCE] * pplayer->science_pct) / (100 * 100 * 100)

Make sure to divide by 100 the right number of times. 
pcity->bonus[O_TRADE], pcity->bonus[O_GOLD], and pplayer->gold_pct are
all % values IIRC.  Integer overflow is probably not an issue.

-jason




[Prev in Thread] Current Thread [Next in Thread]