CvPathNodeArray::GetTurnDest(int)
- Defined in
- CvAStar.cpp, line 4259
- Class
- CvPathNodeArray
- Hook name
CivHooks::CvPathNodeArray_GetTurnDest
Hooks
static bool BeforeCvPathNodeArray_GetTurnDest(CvPathNodeArray* self, int iTurn, const CvPathNode*& result);static void AfterCvPathNodeArray_GetTurnDest(CvPathNodeArray* self, int iTurn, const CvPathNode*& result);static const CvPathNode* ReplaceCvPathNodeArray_GetTurnDest(const CvPathNode* (*original)(CvPathNodeArray*, int), CvPathNodeArray* self, int iTurn);CivRegisterBefore<CivHooks::CvPathNodeArray_GetTurnDest>(host, &BeforeCvPathNodeArray_GetTurnDest);CivRegisterAfter<CivHooks::CvPathNodeArray_GetTurnDest>(host, &AfterCvPathNodeArray_GetTurnDest);CivRegisterReplace<CivHooks::CvPathNodeArray_GetTurnDest>(host, &ReplaceCvPathNodeArray_GetTurnDest);
Code
4259const CvPathNode* CvPathNodeArray::GetTurnDest(int iTurn)4260{4261 for (uint i = size(); i--; )4262 {4263 const CvPathNode& kNode = at(i);4264 if (i == 0)4265 {4266 // Last node, only return it if it is the desired turn4267 if (kNode.m_iData2 == iTurn)4268 return &kNode;4269 return NULL;4270 }4271 else4272 {4273 // Is this node the correct turn and the next node is a turn after it?4274 if (kNode.m_iData2 == iTurn && at(i-1).m_iData2 > iTurn)4275 return &kNode;4276 }4277 }42784279 return NULL;4280}
Calls
BaseVector::atBaseVector::size