CvGame::setInitialItems(CvGameInitialItemsOverrides &)
- Defined in
- CvGame.cpp, line 720
- Class
- CvGame
- Hook name
CivHooks::CvGame_setInitialItems
Hooks
static bool BeforeCvGame_setInitialItems(CvGame* self, CvGameInitialItemsOverrides& kInitialItemOverrides);static void AfterCvGame_setInitialItems(CvGame* self, CvGameInitialItemsOverrides& kInitialItemOverrides);static void ReplaceCvGame_setInitialItems(void (*original)(CvGame*, CvGameInitialItemsOverrides&), CvGame* self, CvGameInitialItemsOverrides& kInitialItemOverrides);CivRegisterBefore<CivHooks::CvGame_setInitialItems>(host, &BeforeCvGame_setInitialItems);CivRegisterAfter<CivHooks::CvGame_setInitialItems>(host, &AfterCvGame_setInitialItems);CivRegisterReplace<CivHooks::CvGame_setInitialItems>(host, &ReplaceCvGame_setInitialItems);
Code
717//718// Set initial items (units, techs, etc...)719//720void CvGame::setInitialItems(CvGameInitialItemsOverrides& kInitialItemOverrides)721{722 initFreeState(kInitialItemOverrides);723724 if(CvPreGame::isWBMapScript())725 assignStartingPlots();726727 // Adjust FLAVOR_GROWTH and FLAVOR_EXPANSION based on map size728 for(int iPlayerLoop = 0; iPlayerLoop < MAX_CIV_PLAYERS; iPlayerLoop++)729 {730 CvPlayer& kPlayer = GET_PLAYER((PlayerTypes) iPlayerLoop);731732 if(kPlayer.isAlive() && !kPlayer.isMinorCiv() && !kPlayer.isBarbarian())733 {734 kPlayer.GetFlavorManager()->AdjustWeightsForMap();735 }736 }737738 initFreeUnits(kInitialItemOverrides);739740 m_iEarliestBarbarianReleaseTurn = getHandicapInfo().getEarliestBarbarianReleaseTurn() + GC.getGame().getJonRandNum(GC.getAI_TACTICAL_BARBARIAN_RELEASE_VARIATION(), "Barbarian Release Turn") + 1;741742 // What route type forms an industrial connection743 DoUpdateIndustrialRoute();744745 bool bCanWorkWater = GC.getCAN_WORK_WATER_FROM_GAME_START();746747 // Team Stuff748 TeamTypes eTeam;749 for(int iTeamLoop = 0; iTeamLoop < MAX_CIV_TEAMS; iTeamLoop++)750 {751 eTeam = (TeamTypes) iTeamLoop;752753 if(bCanWorkWater)754 {755 GET_TEAM(eTeam).changeWaterWorkCount(1);756 }757758 GET_TEAM(eTeam).DoUpdateBestRoute();759 }760761 // Player Stuff762 PlayerTypes ePlayer;763 for(int iPlayerLoop = 0; iPlayerLoop < MAX_CIV_PLAYERS; iPlayerLoop++)764 {765 ePlayer = (PlayerTypes) iPlayerLoop;766767 if(GET_PLAYER(ePlayer).isAlive())768 {769 // Major Civ init770 if(!GET_PLAYER(ePlayer).isMinorCiv())771 {772 GET_PLAYER(ePlayer).GetDiplomacyAI()->DoInitializePersonality();773 }774 // Minor Civ init775 else776 {777 GET_PLAYER(ePlayer).GetMinorCivAI()->DoPickInitialItems();778 }779780 // Set Policy Costs before game starts, or else it'll be 0 on the first turn and Players can get something with any amount!781 GET_PLAYER(ePlayer).DoUpdateNextPolicyCost();782 }783 }784785 // Which Tech unlocks the Religion Race? (based on a CvBuildingEntry)786 for(int iBuildingLoop = 0; iBuildingLoop < GC.getNumBuildingInfos(); iBuildingLoop++)787 {788 const BuildingTypes eBuilding = static_cast<BuildingTypes>(iBuildingLoop);789 CvBuildingEntry* pkBuildingInfo = GC.getBuildingInfo(eBuilding);790 if(pkBuildingInfo)791 {792 if(pkBuildingInfo->IsFoundsReligion())793 {794 const TechTypes eReligionTech = (TechTypes) pkBuildingInfo->GetPrereqAndTech();795 SetReligionTech(eReligionTech);796 break;797 }798 }799 }800801 DoUpdateTotalReligionTechCost();802 DoCacheMapScoreMod();803804 // Diplomacy Victory805 DoInitDiploVictory();806807 LogGameState();808}
Calls
- CvBuildingEntry::GetPrereqAndTech() const
- CvBuildingEntry::IsFoundsReligion() const
- CvDiplomacyAI::DoInitializePersonality()
- CvFlavorManager::AdjustWeightsForMap()
- CvGame::assignStartingPlots()
- CvGame::DoCacheMapScoreMod()
- CvGame::DoInitDiploVictory()
- CvGame::DoUpdateIndustrialRoute()
- CvGame::DoUpdateTotalReligionTechCost()
- CvGame::getHandicapInfo() const
- CvGame::getJonRandNum(int, const char *)
- CvGame::initFreeState(CvGameInitialItemsOverrides &)
- CvGame::initFreeUnits(CvGameInitialItemsOverrides &)
- CvGame::LogGameState(bool)
- CvGame::SetReligionTech(TechTypes)
- CvGlobals::getAI_TACTICAL_BARBARIAN_RELEASE_VARIATION()
- CvGlobals::getBuildingInfo(BuildingTypes)
- CvGlobals::getCAN_WORK_WATER_FROM_GAME_START()
- CvGlobals::getGame()
- CvGlobals::getNumBuildingInfos()
- CvHandicapInfo::getEarliestBarbarianReleaseTurn() const
- CvMinorCivAI::DoPickInitialItems()
- CvPlayer::DoUpdateNextPolicyCost()
- CvPlayer::GetDiplomacyAI() const
- CvPlayer::GetFlavorManager() const
- CvPlayer::GetMinorCivAI() const
- CvPlayer::isAlive() const
- CvPlayer::isBarbarian() const
- CvPlayer::isMinorCiv() const
- CvPlayerAI::getPlayer(PlayerTypes)
- CvPreGame::isWBMapScript()
- CvTeam::changeWaterWorkCount(int)
- CvTeam::DoUpdateBestRoute()
- CvTeam::getTeam(TeamTypes)