Bazaar developer reference

CvTacticalAI::GetNextUnitTarget()

Defined in
CvTacticalAI.cpp, line 6194
Class
CvTacticalAI
Hook name
CivHooks::CvTacticalAI_GetNextUnitTarget

Hooks

static bool BeforeCvTacticalAI_GetNextUnitTarget(CvTacticalAI* self, CvTacticalTarget*& result);static void AfterCvTacticalAI_GetNextUnitTarget(CvTacticalAI* self, CvTacticalTarget*& result);static CvTacticalTarget* ReplaceCvTacticalAI_GetNextUnitTarget(CvTacticalTarget* (*original)(CvTacticalAI*), CvTacticalAI* self);CivRegisterBefore<CivHooks::CvTacticalAI_GetNextUnitTarget>(host, &BeforeCvTacticalAI_GetNextUnitTarget);CivRegisterAfter<CivHooks::CvTacticalAI_GetNextUnitTarget>(host, &AfterCvTacticalAI_GetNextUnitTarget);CivRegisterReplace<CivHooks::CvTacticalAI_GetNextUnitTarget>(host, &ReplaceCvTacticalAI_GetNextUnitTarget);

Code

6193/// Find the next unit target (call after GetFirstUnitTarget())6194CvTacticalTarget* CvTacticalAI::GetNextUnitTarget()6195{6196	m_iCurrentUnitTargetIndex++;61976198	while(m_iCurrentUnitTargetIndex < (int)m_AllTargets.size())6199	{6200		if(m_AllTargets[m_iCurrentUnitTargetIndex].GetTargetType() == AI_TACTICAL_TARGET_HIGH_PRIORITY_UNIT ||6201		        m_AllTargets[m_iCurrentUnitTargetIndex].GetTargetType() == AI_TACTICAL_TARGET_MEDIUM_PRIORITY_UNIT ||6202		        m_AllTargets[m_iCurrentUnitTargetIndex].GetTargetType() == AI_TACTICAL_TARGET_LOW_PRIORITY_UNIT)6203		{6204			return &m_AllTargets[m_iCurrentUnitTargetIndex];6205		}6206		m_iCurrentUnitTargetIndex++;6207	}62086209	return NULL;6210}

Calls

Called by