CvStepPathFinder::GetStepDistanceBetweenPoints(PlayerTypes, PlayerTypes, CvPlot *, CvPlot *)
- Defined in
- CvAStar.cpp, line 2935
- Class
- CvStepPathFinder
- Hook name
CivHooks::CvStepPathFinder_GetStepDistanceBetweenPoints
Hooks
static bool BeforeCvStepPathFinder_GetStepDistanceBetweenPoints(CvStepPathFinder* self, PlayerTypes ePlayer, PlayerTypes eEnemy, CvPlot* pStartPlot, CvPlot* pEndPlot, int& result);static void AfterCvStepPathFinder_GetStepDistanceBetweenPoints(CvStepPathFinder* self, PlayerTypes ePlayer, PlayerTypes eEnemy, CvPlot* pStartPlot, CvPlot* pEndPlot, int& result);static int ReplaceCvStepPathFinder_GetStepDistanceBetweenPoints(int (*original)(CvStepPathFinder*, PlayerTypes, PlayerTypes, CvPlot*, CvPlot*), CvStepPathFinder* self, PlayerTypes ePlayer, PlayerTypes eEnemy, CvPlot* pStartPlot, CvPlot* pEndPlot);CivRegisterBefore<CivHooks::CvStepPathFinder_GetStepDistanceBetweenPoints>(host, &BeforeCvStepPathFinder_GetStepDistanceBetweenPoints);CivRegisterAfter<CivHooks::CvStepPathFinder_GetStepDistanceBetweenPoints>(host, &AfterCvStepPathFinder_GetStepDistanceBetweenPoints);CivRegisterReplace<CivHooks::CvStepPathFinder_GetStepDistanceBetweenPoints>(host, &ReplaceCvStepPathFinder_GetStepDistanceBetweenPoints);
Code
2934/// Get distance between two plots on same land mass (return -1 if plots are in different areas)2935int CvStepPathFinder::GetStepDistanceBetweenPoints(PlayerTypes ePlayer, PlayerTypes eEnemy, CvPlot* pStartPlot, CvPlot* pEndPlot)2936{2937 CvAStarNode* pPathfinderNode;29382939 if(pStartPlot == NULL || pEndPlot == NULL || pStartPlot->getArea() != pEndPlot->getArea())2940 {2941 return -1;2942 }29432944 SetData(&eEnemy);2945 bool bPathfinderSuccess = GeneratePath(pStartPlot->getX(), pStartPlot->getY(), pEndPlot->getX(), pEndPlot->getY(), ePlayer, false);2946 if(bPathfinderSuccess)2947 {2948 pPathfinderNode = GetLastNode();29492950 if(pPathfinderNode != NULL)2951 {2952 return pPathfinderNode->m_iData1;2953 }2954 }29552956 return -1;2957}
Calls
Called by
- CvAIOperation::PercentFromMusterPointToTarget()
- CvAIOperationDestroyBarbarianCamp::FindBestTarget()
- CvAIOperationPillageEnemy::FindBestTarget()
- CvStepPathFinder::GetLastOwnedPlot(PlayerTypes, PlayerTypes, CvPlot *, CvPlot *) const
- CvStepPathFinder::GetXPlotsFromEnd(PlayerTypes, PlayerTypes, CvPlot *, CvPlot *, int, bool) const
- CvTacticalAI::PlotNavalEscortOperationMoves(CvAINavalEscortedOperation *)