Bazaar developer reference

CvHomelandAI::RecruitUnits()

Defined in
CvHomelandAI.cpp, line 102
Class
CvHomelandAI
Hook name
CivHooks::CvHomelandAI_RecruitUnits

Hooks

static bool BeforeCvHomelandAI_RecruitUnits(CvHomelandAI* self);static void AfterCvHomelandAI_RecruitUnits(CvHomelandAI* self);static void ReplaceCvHomelandAI_RecruitUnits(void (*original)(CvHomelandAI*), CvHomelandAI* self);CivRegisterBefore<CivHooks::CvHomelandAI_RecruitUnits>(host, &BeforeCvHomelandAI_RecruitUnits);CivRegisterAfter<CivHooks::CvHomelandAI_RecruitUnits>(host, &AfterCvHomelandAI_RecruitUnits);CivRegisterReplace<CivHooks::CvHomelandAI_RecruitUnits>(host, &ReplaceCvHomelandAI_RecruitUnits);

Code

101/// Mark all the units that will be under tactical AI control this turn102void CvHomelandAI::RecruitUnits()103{104	CvUnit* pLoopUnit;105	int iLoop;106107	m_CurrentTurnUnits.clear();108109	// Loop through our units110	for(pLoopUnit = m_pPlayer->firstUnit(&iLoop); pLoopUnit != NULL; pLoopUnit = m_pPlayer->nextUnit(&iLoop))111	{112		// Never want immobile/dead units or ones that have already moved113		if(!pLoopUnit->TurnProcessed() && !pLoopUnit->isDelayedDeath() && pLoopUnit->AI_getUnitAIType() != UNITAI_UNKNOWN && pLoopUnit->canMove())114		{115			m_CurrentTurnUnits.push_back(pLoopUnit->GetID());116		}117	}118}

Calls

Called by