Bazaar developer reference

CvUnit::GetPathFirstPlot() const

Defined in
CvUnit.cpp, line 23952
Class
CvUnit
Hook name
CivHooks::CvUnit_GetPathFirstPlot

Hooks

static bool BeforeCvUnit_GetPathFirstPlot(const CvUnit* self, CvPlot*& result);static void AfterCvUnit_GetPathFirstPlot(const CvUnit* self, CvPlot*& result);static CvPlot* ReplaceCvUnit_GetPathFirstPlot(CvPlot* (*original)(const CvUnit*), const CvUnit* self);CivRegisterBefore<CivHooks::CvUnit_GetPathFirstPlot>(host, &BeforeCvUnit_GetPathFirstPlot);CivRegisterAfter<CivHooks::CvUnit_GetPathFirstPlot>(host, &AfterCvUnit_GetPathFirstPlot);CivRegisterReplace<CivHooks::CvUnit_GetPathFirstPlot>(host, &ReplaceCvUnit_GetPathFirstPlot);

Code

23951/// What is the first plot along this path?23952CvPlot* CvUnit::GetPathFirstPlot() const23953{23954	VALIDATE_OBJECT2395523956	uint uiPathSize = m_kLastPath.size();23957	if(uiPathSize > 0)23958	{23959		if(uiPathSize == 1)23960		{23961			const CvPathNode& kNode = m_kLastPath.front();23962			return GC.getMap().plotCheckInvalid(kNode.m_iX, kNode.m_iY);23963		}23964		else23965		{23966			// The 'first' plot we want is the next to last one.  The last one is always where the unit is currently.23967			// Should we even bother caching that one?23968			const CvPathNode& kNode = m_kLastPath[ uiPathSize - 2];23969			return GC.getMap().plotCheckInvalid(kNode.m_iX, kNode.m_iY);23970		}23971	}2397223973	CvAssert(false);2397423975	return NULL;23976}

Calls

Called by