CvDllGameContext::TEMPOnHexUnitChanged(ICvUnit1 *)
- Defined in
- CvDllContext.cpp, line 1254
- Class
- CvDllGameContext
- Hook name
CivHooks::CvDllGameContext_TEMPOnHexUnitChanged
Hooks
static bool BeforeCvDllGameContext_TEMPOnHexUnitChanged(CvDllGameContext* self, ICvUnit1* pUnit);static void AfterCvDllGameContext_TEMPOnHexUnitChanged(CvDllGameContext* self, ICvUnit1* pUnit);static void ReplaceCvDllGameContext_TEMPOnHexUnitChanged(void (*original)(CvDllGameContext*, ICvUnit1*), CvDllGameContext* self, ICvUnit1* pUnit);// CivHooks.h gives this hook point no types, so nothing checks these hooks' parameters.host->RegisterHook(host->pluginIndex, CivHooks::CvDllGameContext_TEMPOnHexUnitChanged::ID, CIV_HOOK_BEFORE, (void*)&BeforeCvDllGameContext_TEMPOnHexUnitChanged);host->RegisterHook(host->pluginIndex, CivHooks::CvDllGameContext_TEMPOnHexUnitChanged::ID, CIV_HOOK_AFTER, (void*)&AfterCvDllGameContext_TEMPOnHexUnitChanged);host->RegisterHook(host->pluginIndex, CivHooks::CvDllGameContext_TEMPOnHexUnitChanged::ID, CIV_HOOK_REPLACE, (void*)&ReplaceCvDllGameContext_TEMPOnHexUnitChanged);
Code
1254void CvDllGameContext::TEMPOnHexUnitChanged(ICvUnit1* pUnit)1255{1256 CvUnit* pkUnit = GC.UnwrapUnitPointer(pUnit);1257 CvTwoLayerPathFinder& thePathfinder = GC.getInterfacePathFinder();12581259 // change the unit pathfinder to use these funcs instead1260 thePathfinder.SetDestValidFunc(NULL);1261 thePathfinder.SetValidFunc(UIPathValid);1262 thePathfinder.SetNotifyChildFunc(UIPathAdd);12631264 // call the pathfinder1265 thePathfinder.SetData(pkUnit);1266 bool bCanFindPath = thePathfinder.GeneratePath(pkUnit->getX(), pkUnit->getY(), -1, -1, MOVE_DECLARE_WAR, false);12671268 // change the unit pathfinder back1269 thePathfinder.SetDestValidFunc(PathDestValid);1270 thePathfinder.SetValidFunc(PathValid);1271 thePathfinder.SetNotifyChildFunc(PathAdd);1272 thePathfinder.ForceReset();12731274}
Calls
- CvAStar::ForceReset()
- CvAStar::GeneratePath(int, int, int, int, int, bool)
- CvAStar::SetData(const void *)
- CvAStar::SetDestValidFunc(CvAPointFunc)
- CvAStar::SetNotifyChildFunc(CvAStarFunc)
- CvAStar::SetValidFunc(CvAStarFunc)
- CvGlobals::getInterfacePathFinder()
- CvGlobals::UnwrapUnitPointer(ICvUnit1 *)
- CvUnit::getX() const
- CvUnit::getY() const
- PathAdd(CvAStarNode *, CvAStarNode *, int, const void *, CvAStar *)
- PathDestValid(int, int, const void *, CvAStar *)
- PathValid(CvAStarNode *, CvAStarNode *, int, const void *, CvAStar *)
- UIPathAdd(CvAStarNode *, CvAStarNode *, int, const void *, CvAStar *)
- UIPathValid(CvAStarNode *, CvAStarNode *, int, const void *, CvAStar *)