[FIXED] Turns to Complete for Production bonus from railroads is not calc'd correctly

The_J

Say No 2 Net Validations
Administrator
Supporter
Joined
Oct 22, 2008
Messages
42,070
Location
DE/NL/FR
Originally posted here:

railroadq.jpg


Short translation of the image:
Watermill will be built in 29 rounds
Current advance: 23,9/360
10 hammers basis
17 hammers total
Modifikator for railroad bonus: 50%
Modifikator for buildings: 20%

You will say now, yes, that's right, 70% more from 10 hammers is 17.
But: There are 336 hammers needed to finish the watermill.
336/29 Rounds = 11.58 ~12, which would be if the railroads did not work.

Can anyone confirm this?
I'll try to get a savegame from this.

Edit: Another user is saying that the 29 rounds for finishing the production is shown wrong and that the hammers are applied correctly.
 
confirmed - but luckily it is just the forecast - the progress seams to be calculated correct ;)

ah, forgot, the calculation: 1090 hammers left / 54 per turn = 20,1 = 21, not 27.
The thing that is really calculated is 1090 / 40, witch is exactly the 27 + 50% from buildings but without railroad

attachment.php


and just for the record: the save to reproduce, but it seams to be a general problem
 

Attachments

Possibly related issue, the production bonus isn't included on "economy overview" screen either.
 
Bonjour,
I confirm this bug in the french version.
that's very misleading, in particular at the end of the game!
the calculation is wrong (or I did not unterstand how it's computed)
and the display of the production in the overview is wrong, too.

example (see screenshot joined)

base production: 42
bonus (railroad): 50%
total prod. : **63**

stealth bomber cost =800
800/63 = 13 turns, not 18 !

BadProductionWhileBuildingNewUnit.jpg
 
It is possible to workaround this bug.

For example in CityView.lua:
(from assets\UI\InGame\CityView folder)

There is line with this:
local productionTurnsLeft = pCity:GetProductionTurnsLeft();

How many turns are left is then pulled from GetProductionTurnsLeft() and used to display that value in the UI. But since GetProductionTurnsLeft() is bugged it will not take into account bonus from railroads.

So, let's use workaround instead.

If you put beneath that line this:
productionTurnsLeft = math.ceil((iProductionNeeded - iStoredProduction) / iProductionPerTurn)

It will manually recalculate remaining turns and get correct value, without using buggy function. Of course, this would fix remaining turns only for that single screen (city view) and not for others (city build screen, F2 screen, turns remaining on the map, etc...).
 
Proper version of workaround. Previous one was not taking into account production overflow.

Code:
local iProductionNextTurn = pCity:GetCurrentProductionDifferenceTimes100(false, true) / 100;
if ((iStoredProduction + iProductionNextTurn) >= iProductionNeeded) then
	productionTurnsLeft = 1;
else
	productionTurnsLeft = 1 + math.ceil((iProductionNeeded - iStoredProduction - iProductionNextTurn) / iProductionPerTurn);
end
 
Back
Top Bottom