Bazaar developer reference

GetLastTargetingPathIndex(int)

Defined in
CvTargeting.cpp, line 34
Hook name
CivHooks::GetLastTargetingPathIndex

Hooks

static bool BeforeGetLastTargetingPathIndex(int plotIndex, int& result);static void AfterGetLastTargetingPathIndex(int plotIndex, int& result);static int ReplaceGetLastTargetingPathIndex(int (*original)(int), int plotIndex);CivRegisterBefore<CivHooks::GetLastTargetingPathIndex>(host, &BeforeGetLastTargetingPathIndex);CivRegisterAfter<CivHooks::GetLastTargetingPathIndex>(host, &AfterGetLastTargetingPathIndex);CivRegisterReplace<CivHooks::GetLastTargetingPathIndex>(host, &ReplaceGetLastTargetingPathIndex);

Code

33// Access the last cached targeting path.  Debug only please!34int GetLastTargetingPathIndex(int plotIndex)35{36#if defined(TARGETING_DEBUG)37	int iIndex = 0;38	for (std::vector<int>::const_iterator itr = ms_lastTargetingPath.begin(); itr != ms_lastTargetingPath.end(); ++itr)39	{40		if ((*itr) == plotIndex)41			return iIndex;42		++iIndex;43	}44#else45	UNREFERENCED_PARAMETER(plotIndex);46#endif4748	return -1;49}

Called by