[BETA] - Displayed number of turns to next social policy is sometimes off by 1

lockstep

Prince
Joined
Jan 15, 2004
Messages
399
Location
Vienna, Austria
(This bug has been present since the first version of Civ V Vanilla.)

At the moment, the number of turns to the next social policy is calculated as follows (SocialPolicyPopup.lua, line 255; TopPanel.lua, line 879):

Code:
iTurns = iCultureNeeded / pPlayer:GetTotalJONSCulturePerTurn();
iTurns = iTurns + 1;
iTurns = math.floor(iTurns);

However, increasing the number of turns by 1 and then calculating the floor will yield the wrong result if the number of turns was an integer to begin with. (Example: At the start of a standard speed, ancient era game, the number of turns to the first policy will be shown as "26", whereas the correct result is "25".) To always obtain the correct result, the above code lines must be replaced with

Code:
iTurns = iCultureNeeded / pPlayer:GetTotalJONSCulturePerTurn();
iTurns = math.ceil(iTurns);

A mod comprising only this fix can be found here: Turns to Next Policy Fix (BNW).
 
Back
Top Bottom