CvTwoLayerPathFinder::GetPathEndTurnPlot() const
- Defined in
- CvAStar.cpp, line 2846
- Class
- CvTwoLayerPathFinder
- Hook name
CivHooks::CvTwoLayerPathFinder_GetPathEndTurnPlot
Hooks
static bool BeforeCvTwoLayerPathFinder_GetPathEndTurnPlot(const CvTwoLayerPathFinder* self, CvPlot*& result);static void AfterCvTwoLayerPathFinder_GetPathEndTurnPlot(const CvTwoLayerPathFinder* self, CvPlot*& result);static CvPlot* ReplaceCvTwoLayerPathFinder_GetPathEndTurnPlot(CvPlot* (*original)(const CvTwoLayerPathFinder*), const CvTwoLayerPathFinder* self);CivRegisterBefore<CivHooks::CvTwoLayerPathFinder_GetPathEndTurnPlot>(host, &BeforeCvTwoLayerPathFinder_GetPathEndTurnPlot);CivRegisterAfter<CivHooks::CvTwoLayerPathFinder_GetPathEndTurnPlot>(host, &AfterCvTwoLayerPathFinder_GetPathEndTurnPlot);CivRegisterReplace<CivHooks::CvTwoLayerPathFinder_GetPathEndTurnPlot>(host, &ReplaceCvTwoLayerPathFinder_GetPathEndTurnPlot);
Code
2845/// Return the furthest plot we can get to this turn that is on the path2846CvPlot* CvTwoLayerPathFinder::GetPathEndTurnPlot() const2847{2848 CvAStarNode* pNode;28492850 pNode = m_pBest;28512852 if(NULL != pNode)2853 {2854 if((pNode->m_pParent == NULL) || (pNode->m_iData2 == 1))2855 {2856 return GC.getMap().plotUnchecked(pNode->m_iX, pNode->m_iY);2857 }28582859 while(pNode->m_pParent != NULL)2860 {2861 if(pNode->m_pParent->m_iData2 == 1)2862 {2863 return GC.getMap().plotUnchecked(pNode->m_pParent->m_iX, pNode->m_pParent->m_iY);2864 }28652866 pNode = pNode->m_pParent;2867 }2868 }28692870 FAssert(false);28712872 return NULL;2873}