CvGame::calculateSyncChecksum()
- Defined in
- CvGame.cpp, line 9318
- Class
- CvGame
- Hook name
CivHooks::CvGame_calculateSyncChecksum
Hooks
static bool BeforeCvGame_calculateSyncChecksum(CvGame* self, int& result);static void AfterCvGame_calculateSyncChecksum(CvGame* self, int& result);static int ReplaceCvGame_calculateSyncChecksum(int (*original)(CvGame*), CvGame* self);CivRegisterBefore<CivHooks::CvGame_calculateSyncChecksum>(host, &BeforeCvGame_calculateSyncChecksum);CivRegisterAfter<CivHooks::CvGame_calculateSyncChecksum>(host, &AfterCvGame_calculateSyncChecksum);CivRegisterReplace<CivHooks::CvGame_calculateSyncChecksum>(host, &ReplaceCvGame_calculateSyncChecksum);
Code
9318int CvGame::calculateSyncChecksum()9319{9320 CvUnit* pLoopUnit;9321 int iMultiplier;9322 int iValue;9323 int iLoop;9324 int iI, iJ;93259326 iValue = 0;93279328 iValue += getMapRand().getSeed();9329 iValue += getJonRand().getSeed();93309331 iValue += getNumCities();9332 iValue += getTotalPopulation();93339334 iValue += GC.getMap().getOwnedPlots();9335 iValue += GC.getMap().getNumAreas();93369337 for(iI = 0; iI < MAX_PLAYERS; iI++)9338 {9339 if(GET_PLAYER((PlayerTypes)iI).isEverAlive())9340 {9341 iMultiplier = getPlayerScore((PlayerTypes)iI);93429343 switch(getTurnSlice() % 4)9344 {9345 case 0:9346 iMultiplier += (GET_PLAYER((PlayerTypes)iI).getTotalPopulation() * 543271);9347 iMultiplier += (GET_PLAYER((PlayerTypes)iI).getTotalLand() * 327382);9348 iMultiplier += (GET_PLAYER((PlayerTypes)iI).GetTreasury()->GetGold() * 107564);9349 iMultiplier += (GET_PLAYER((PlayerTypes)iI).getPower() * 135647);9350 iMultiplier += (GET_PLAYER((PlayerTypes)iI).getNumCities() * 436432);9351 iMultiplier += (GET_PLAYER((PlayerTypes)iI).getNumUnits() * 324111);9352 break;93539354 case 1:9355 for(iJ = 0; iJ < NUM_YIELD_TYPES; iJ++)9356 {9357 iMultiplier += (GET_PLAYER((PlayerTypes)iI).calculateTotalYield((YieldTypes)iJ) * 432754);9358 }9359 break;93609361 case 2:9362 for(iJ = 0; iJ < GC.getNumImprovementInfos(); iJ++)9363 {9364 iMultiplier += (GET_PLAYER((PlayerTypes)iI).getImprovementCount((ImprovementTypes)iJ) * 883422);9365 }93669367 for(iJ = 0; iJ < GC.getNumBuildingClassInfos(); iJ++)9368 {9369 CvBuildingClassInfo* pkBuildingClassInfo = GC.getBuildingClassInfo((BuildingClassTypes)iJ);9370 if(!pkBuildingClassInfo)9371 {9372 continue;9373 }93749375 iMultiplier += (GET_PLAYER((PlayerTypes)iI).getBuildingClassCountPlusMaking((BuildingClassTypes)iJ) * 954531);9376 }93779378 for(iJ = 0; iJ < GC.getNumUnitClassInfos(); iJ++)9379 {9380 CvUnitClassInfo* pkUnitClassInfo = GC.getUnitClassInfo((UnitClassTypes)iJ);9381 if(!pkUnitClassInfo)9382 {9383 continue;9384 }93859386 iMultiplier += (GET_PLAYER((PlayerTypes)iI).getUnitClassCountPlusMaking((UnitClassTypes)iJ) * 754843);9387 }9388 break;93899390 case 3:9391 for(pLoopUnit = GET_PLAYER((PlayerTypes)iI).firstUnit(&iLoop); pLoopUnit != NULL; pLoopUnit = GET_PLAYER((PlayerTypes)iI).nextUnit(&iLoop))9392 {9393 iMultiplier += (pLoopUnit->getX() * 876543);9394 iMultiplier += (pLoopUnit->getY() * 985310);9395 iMultiplier += (pLoopUnit->getDamage() * 736373);9396#if defined(MOD_UNITS_XP_TIMES_100)9397 iMultiplier += ((pLoopUnit->getExperienceTimes100() / 100) * 820622);9398#else9399 iMultiplier += (pLoopUnit->getExperience() * 820622);9400#endif9401 iMultiplier += (pLoopUnit->getLevel() * 367291);9402 }9403 break;9404 }94059406 if(iMultiplier != 0)9407 {9408 iValue *= iMultiplier;9409 }9410 }9411 }94129413 return iValue;9414}
Calls
- CvGame::getJonRand()
- CvGame::getMapRand()
- CvGame::getNumCities() const
- CvGame::getPlayerScore(PlayerTypes)
- CvGame::getTotalPopulation() const
- CvGame::getTurnSlice() const
- CvGlobals::getBuildingClassInfo(BuildingClassTypes)
- CvGlobals::getMap()
- CvGlobals::getNumBuildingClassInfos()
- CvGlobals::getNumImprovementInfos()
- CvGlobals::getNumUnitClassInfos()
- CvGlobals::getUnitClassInfo(UnitClassTypes)
- CvMap::getNumAreas()
- CvMap::getOwnedPlots()
- CvPlayer::calculateTotalYield(YieldTypes) const
- CvPlayer::firstUnit(int *, bool)
- CvPlayer::getBuildingClassCountPlusMaking(BuildingClassTypes) const
- CvPlayer::getImprovementCount(ImprovementTypes) const
- CvPlayer::getNumCities() const
- CvPlayer::getNumUnits() const
- CvPlayer::getPower() const
- CvPlayer::getTotalLand() const
- CvPlayer::getTotalPopulation() const
- CvPlayer::GetTreasury() const
- CvPlayer::getUnitClassCountPlusMaking(UnitClassTypes) const
- CvPlayer::isEverAlive() const
- CvPlayer::nextUnit(int *, bool)
- CvPlayerAI::getPlayer(PlayerTypes)
- CvRandom::getSeed() const
- CvTreasury::GetGold() const
- CvUnit::getDamage() const
- CvUnit::getExperienceTimes100() const
- CvUnit::getLevel() const
- CvUnit::getX() const
- CvUnit::getY() const