Code
11708void CvCity::updateStrengthValue()11709{11710 VALIDATE_OBJECT11711 AI_PERF_FORMAT("City-AI-perf.csv", ("CvCity::updateStrengthValue, Turn %03d, %s, %s", GC.getGame().getElapsedGameTurns(), GetPlayer()->getCivilizationShortDescription(), getName().c_str()) );11712 // Default Strength11713 int iStrengthValue = /*600*/ GC.getCITY_STRENGTH_DEFAULT();1171411715 // Population mod11716 iStrengthValue += getPopulation() * /*25*/ GC.getCITY_STRENGTH_POPULATION_CHANGE();1171711718 // Building Defense11719 int iBuildingDefense = m_pCityBuildings->GetBuildingDefense();1172011721 iBuildingDefense *= (100 + m_pCityBuildings->GetBuildingDefenseMod());11722 iBuildingDefense /= 100;1172311724 iStrengthValue += iBuildingDefense;1172511726 // Garrisoned Unit11727 CvUnit* pGarrisonedUnit = GetGarrisonedUnit();11728 int iStrengthFromUnits = 0;11729 if(pGarrisonedUnit)11730 {11731#if defined(MOD_UNITS_MAX_HP)11732 int iMaxHits = pGarrisonedUnit->GetMaxHitPoints();11733#else11734 int iMaxHits = GC.getMAX_HIT_POINTS();11735#endif11736 iStrengthFromUnits = pGarrisonedUnit->GetBaseCombatStrength() * 100 * (iMaxHits - pGarrisonedUnit->getDamage()) / iMaxHits;11737 }1173811739 iStrengthValue += ((iStrengthFromUnits * 100) / /*300*/ GC.getCITY_STRENGTH_UNIT_DIVISOR());1174011741 // Tech Progress increases City Strength11742 int iTechProgress = GET_TEAM(getTeam()).GetTeamTechs()->GetNumTechsKnown() * 100 / GC.getNumTechInfos();1174311744 // Want progress to be a value between 0 and 511745 double fTechProgress = iTechProgress / 100.0 * /*5*/ GC.getCITY_STRENGTH_TECH_BASE();11746 double fTechExponent = /*2.0f*/ GC.getCITY_STRENGTH_TECH_EXPONENT();11747 int iTechMultiplier = /*2*/ GC.getCITY_STRENGTH_TECH_MULTIPLIER();1174811749 // The way all of this adds up...11750 // 25% of the way through the game provides an extra 3.1211751 // 50% of the way through the game provides an extra 12.5011752 // 75% of the way through the game provides an extra 28.1211753 // 100% of the way through the game provides an extra 50.001175411755 double fTechMod = pow(fTechProgress, fTechExponent);11756 fTechMod *= iTechMultiplier;1175711758 fTechMod *= 100; // Bring it back into hundreds11759 iStrengthValue += (int)(fTechMod + 0.005); // Adding a small amount to prevent small fp accuracy differences from generating a different integer result on the Mac and PC. Assuming fTechMod is positive, round to nearest hundredth1176011761 int iStrengthMod = 0;1176211763 // Player-wide strength mod (Policies, etc.)11764 iStrengthMod += GET_PLAYER(getOwner()).GetCityStrengthMod();1176511766 // Apply Mod11767 iStrengthValue *= (100 + iStrengthMod);11768 iStrengthValue /= 100;1176911770 m_iStrengthValue = iStrengthValue;1177111772 // Terrain mod11773 if(plot()->isHills())11774 {11775 m_iStrengthValue += /*3*/ GC.getCITY_STRENGTH_HILL_CHANGE();11776 }1177711778 DLLUI->setDirty(CityInfo_DIRTY_BIT, true);11779}