Bazaar developer reference

CvDllGameContext::TEMPOnHexUnitChangedAttack(ICvUnit1 *)

Defined in
CvDllContext.cpp, line 1276
Class
CvDllGameContext
Hook name
CivHooks::CvDllGameContext_TEMPOnHexUnitChangedAttack

Hooks

static bool BeforeCvDllGameContext_TEMPOnHexUnitChangedAttack(CvDllGameContext* self, ICvUnit1* pUnit);static void AfterCvDllGameContext_TEMPOnHexUnitChangedAttack(CvDllGameContext* self, ICvUnit1* pUnit);static void ReplaceCvDllGameContext_TEMPOnHexUnitChangedAttack(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_TEMPOnHexUnitChangedAttack::ID, CIV_HOOK_BEFORE, (void*)&BeforeCvDllGameContext_TEMPOnHexUnitChangedAttack);host->RegisterHook(host->pluginIndex, CivHooks::CvDllGameContext_TEMPOnHexUnitChangedAttack::ID, CIV_HOOK_AFTER, (void*)&AfterCvDllGameContext_TEMPOnHexUnitChangedAttack);host->RegisterHook(host->pluginIndex, CivHooks::CvDllGameContext_TEMPOnHexUnitChangedAttack::ID, CIV_HOOK_REPLACE, (void*)&ReplaceCvDllGameContext_TEMPOnHexUnitChangedAttack);

Code

1276void CvDllGameContext::TEMPOnHexUnitChangedAttack(ICvUnit1* pUnit)1277{1278	CvUnit* pkUnit = GC.UnwrapUnitPointer(pUnit);1279	CvTwoLayerPathFinder& thePathfinder = GC.getInterfacePathFinder();12801281	// change the unit pathfinder to use these funcs instead1282	thePathfinder.SetDestValidFunc(NULL);1283	thePathfinder.SetValidFunc(UIPathValid);1284	thePathfinder.SetNotifyChildFunc(AttackPathAdd);12851286	// call the pathfinder1287	thePathfinder.SetData(pkUnit);1288	bool bCanFindPath = thePathfinder.GeneratePath(pkUnit->getX(), pkUnit->getY(), -1, -1, MOVE_DECLARE_WAR, false);12891290	// change the unit pathfinder back1291	thePathfinder.SetDestValidFunc(PathDestValid);1292	thePathfinder.SetValidFunc(PathValid);1293	thePathfinder.SetNotifyChildFunc(PathAdd);1294	thePathfinder.ForceReset();1295}

Calls