int CvPlayer::calculateInflationRate() const
{
int iTurns = ((GC.getGameINLINE().getGameTurn() + GC.getGameINLINE().getElapsedGameTurns()) / 2);
if (GC.getGameINLINE().getMaxTurns() > 0)
{
iTurns = std::min(GC.getGameINLINE().getMaxTurns(), iTurns);
}
iTurns += GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getInflationOffset();
if (iTurns <= 0)
{
return 0;
}
int iInflationPerTurnTimes10000 = GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getInflationPercent();
iInflationPerTurnTimes10000 *= GC.getHandicapInfo(getHandicapType()).getInflationPercent();
iInflationPerTurnTimes10000 /= 100;
int iModifier = m_iInflationModifier;
if (!isHuman() && !isBarbarian())
{
int iAIModifier = GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIInflationPercent();
iAIModifier *= std::max(0, ((GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIPerEraModifier() * getCurrentEra()) + 100));
iAIModifier /= 100;
iModifier += iAIModifier - 100;
}
/************************************************************************************************/
/* REVOLUTION_MOD 01/31/08 jdog5000 */
/* */
/* Reduced inflation cost for rebels */
/************************************************************************************************/
if( isRebel() )
iModifier -= 50;
/************************************************************************************************/
/* REVOLUTION_MOD END */
/************************************************************************************************/
iInflationPerTurnTimes10000 *= std::max(0, 100 + iModifier);
iInflationPerTurnTimes10000 /= 100;
// Keep up to second order terms in binomial series
int iRatePercent = (iTurns * iInflationPerTurnTimes10000) / 100;
iRatePercent += (iTurns * (iTurns - 1) * iInflationPerTurnTimes10000 * iInflationPerTurnTimes10000) / 2000000;
FAssert(iRatePercent >= 0);
return iRatePercent;
}