CvTacticalAI::GetFirstUnitTarget()
- Defined in
- CvTacticalAI.cpp, line 6175
- Class
- CvTacticalAI
- Hook name
CivHooks::CvTacticalAI_GetFirstUnitTarget
Hooks
static bool BeforeCvTacticalAI_GetFirstUnitTarget(CvTacticalAI* self, CvTacticalTarget*& result);static void AfterCvTacticalAI_GetFirstUnitTarget(CvTacticalAI* self, CvTacticalTarget*& result);static CvTacticalTarget* ReplaceCvTacticalAI_GetFirstUnitTarget(CvTacticalTarget* (*original)(CvTacticalAI*), CvTacticalAI* self);CivRegisterBefore<CivHooks::CvTacticalAI_GetFirstUnitTarget>(host, &BeforeCvTacticalAI_GetFirstUnitTarget);CivRegisterAfter<CivHooks::CvTacticalAI_GetFirstUnitTarget>(host, &AfterCvTacticalAI_GetFirstUnitTarget);CivRegisterReplace<CivHooks::CvTacticalAI_GetFirstUnitTarget>(host, &ReplaceCvTacticalAI_GetFirstUnitTarget);
Code
6174/// Find the first unit target (in full list of targets -- NOT by zone)6175CvTacticalTarget* CvTacticalAI::GetFirstUnitTarget()6176{6177 m_iCurrentUnitTargetIndex = 0;61786179 while(m_iCurrentUnitTargetIndex < (int)m_AllTargets.size())6180 {6181 if(m_AllTargets[m_iCurrentUnitTargetIndex].GetTargetType() == AI_TACTICAL_TARGET_HIGH_PRIORITY_UNIT ||6182 m_AllTargets[m_iCurrentUnitTargetIndex].GetTargetType() == AI_TACTICAL_TARGET_MEDIUM_PRIORITY_UNIT ||6183 m_AllTargets[m_iCurrentUnitTargetIndex].GetTargetType() == AI_TACTICAL_TARGET_LOW_PRIORITY_UNIT)6184 {6185 return &m_AllTargets[m_iCurrentUnitTargetIndex];6186 }6187 m_iCurrentUnitTargetIndex++;6188 }61896190 return NULL;6191}
Calls
BaseVector::operator[]BaseVector::size- CvTacticalTarget::GetTargetType()