I want to determine how much gold a player "could" get per turn if research is at 0%.
Below is what im working with right now. the function CvPlayer::calculateTotalCommerce() is not working really well, cause it also returns high values even if the player has very high maintenance or unit costs.
About the iFundedPercent. What does it return? Does it get as high as 100 but not above?
Below is what im working with right now. the function CvPlayer::calculateTotalCommerce() is not working really well, cause it also returns high values even if the player has very high maintenance or unit costs.
About the iFundedPercent. What does it return? Does it get as high as 100 but not above?
Code:
int iNetCommerce = 1 + getCommerceRate(COMMERCE_GOLD) + getCommerceRate(COMMERCE_RESEARCH) + std::max(0, getGoldPerTurn());
int iNetExpenses = calculateInflatedCosts() + std::min(0, getGoldPerTurn());
int iFundedPercent = (100 * (iNetCommerce - iNetExpenses)) / std::max(1, iNetCommerce);
Code:
int CvPlayer::calculateTotalCommerce() const
{
int iTotalCommerce = calculateBaseNetGold() + calculateBaseNetResearch();
for (int i = 0; i < NUM_COMMERCE_TYPES; ++i)
{
if (COMMERCE_GOLD != i && COMMERCE_RESEARCH != i)
{
iTotalCommerce += getCommerceRate((CommerceTypes)i);
}
}
return iTotalCommerce;
}