CvHomelandAI::Update()
- Defined in
- CvHomelandAI.cpp, line 144
- Class
- CvHomelandAI
- Hook name
CivHooks::CvHomelandAI_Update
Hooks
static bool BeforeCvHomelandAI_Update(CvHomelandAI* self);static void AfterCvHomelandAI_Update(CvHomelandAI* self);static void ReplaceCvHomelandAI_Update(void (*original)(CvHomelandAI*), CvHomelandAI* self);CivRegisterBefore<CivHooks::CvHomelandAI_Update>(host, &BeforeCvHomelandAI_Update);CivRegisterAfter<CivHooks::CvHomelandAI_Update>(host, &AfterCvHomelandAI_Update);CivRegisterReplace<CivHooks::CvHomelandAI_Update>(host, &ReplaceCvHomelandAI_Update);
Code
143/// Update the AI for units144void CvHomelandAI::Update()145{146 AI_PERF_FORMAT("AI-perf.csv", ("Homeland AI, Turn %03d, %s", GC.getGame().getElapsedGameTurns(), m_pPlayer->getCivilizationShortDescription()));147148 // Make sure we have a unit to handle149 if(!m_CurrentTurnUnits.empty())150 {151 // Make sure the economic plots are up-to-date, it has a caching system in it.152 CvEconomicAI* pEconomicAI = m_pPlayer->GetEconomicAI();153 pEconomicAI->UpdatePlots();154155 // Start by establishing the priority order for moves this turn156 EstablishHomelandPriorities();157158 // Put together lists of places we may want to move toward159 FindHomelandTargets();160161 // Loop through each move assigning units when available162 AssignHomelandMoves();163 }164}