Bazaar developer reference

CvUnit::IsStackedGreatGeneral() const

Defined in
CvUnit.cpp, line 18693
Class
CvUnit
Hook name
CivHooks::CvUnit_IsStackedGreatGeneral

Hooks

static bool BeforeCvUnit_IsStackedGreatGeneral(const CvUnit* self, bool& result);static void AfterCvUnit_IsStackedGreatGeneral(const CvUnit* self, bool& result);static bool ReplaceCvUnit_IsStackedGreatGeneral(bool (*original)(const CvUnit*), const CvUnit* self);CivRegisterBefore<CivHooks::CvUnit_IsStackedGreatGeneral>(host, &BeforeCvUnit_IsStackedGreatGeneral);CivRegisterAfter<CivHooks::CvUnit_IsStackedGreatGeneral>(host, &AfterCvUnit_IsStackedGreatGeneral);CivRegisterReplace<CivHooks::CvUnit_IsStackedGreatGeneral>(host, &ReplaceCvUnit_IsStackedGreatGeneral);

Code

18692/// Great General in our hex?18693bool CvUnit::IsStackedGreatGeneral() const18694{18695	CvPlot* pLoopPlot = plot();18696	IDInfo* pUnitNode;18697	CvUnit* pLoopUnit;1869818699	if(pLoopPlot != NULL)18700	{18701		// If there are Units here, loop through them18702		if(pLoopPlot->getNumUnits() > 0)18703		{18704			pUnitNode = pLoopPlot->headUnitNode();1870518706			while(pUnitNode != NULL)18707			{18708				pLoopUnit = ::getUnit(*pUnitNode);18709				pUnitNode = pLoopPlot->nextUnitNode(pUnitNode);1871018711				if(pLoopUnit)18712				{18713					// Great General unit18714#if defined(MOD_BUGFIX_MINOR)18715					// IsNearGreatGeneral() includes GAs, so we'll add them here as well18716					if(pLoopUnit->IsGreatGeneral() || pLoopUnit->IsGreatAdmiral())18717#else18718					if(pLoopUnit->IsGreatGeneral())18719#endif18720					{18721						// Same domain18722						if(pLoopUnit->getDomainType() == getDomainType())18723						{18724							return true;18725						}18726					}18727				}18728			}18729		}18730	}1873118732	return false;18733}

Calls

Called by