Bazaar developer reference

CvPlot::getNumLayerUnits(int) const

Defined in
CvPlot.cpp, line 10148
Class
CvPlot
Hook name
CivHooks::CvPlot_getNumLayerUnits

Hooks

static bool BeforeCvPlot_getNumLayerUnits(const CvPlot* self, int iLayerID, int& result);static void AfterCvPlot_getNumLayerUnits(const CvPlot* self, int iLayerID, int& result);static int ReplaceCvPlot_getNumLayerUnits(int (*original)(const CvPlot*, int), const CvPlot* self, int iLayerID);CivRegisterBefore<CivHooks::CvPlot_getNumLayerUnits>(host, &BeforeCvPlot_getNumLayerUnits);CivRegisterAfter<CivHooks::CvPlot_getNumLayerUnits>(host, &AfterCvPlot_getNumLayerUnits);CivRegisterReplace<CivHooks::CvPlot_getNumLayerUnits>(host, &ReplaceCvPlot_getNumLayerUnits);

Code

10148int CvPlot::getNumLayerUnits(int iLayerID /*= -1*/) const10149{10150	if (iLayerID == DEFAULT_UNIT_MAP_LAYER)10151		// Base layer10152		return m_units.getLength();10153	else10154		if (iLayerID == -1)10155		{10156			// All layers10157			int iCount = m_units.getLength();10158			const CvPlotManager& kManager = GC.getMap().plotManager();10159			int iNumLayers = kManager.GetNumLayers();10160			for (int iIndex = 0; iIndex < iNumLayers; ++iIndex)10161			{		10162				iCount += kManager.GetNumUnitsByIndex(m_iX, m_iY, iIndex);10163			}10164			return iCount;10165		}10166		else10167		{10168			// Specific layer10169			return GC.getMap().plotManager().GetNumUnits(m_iX, m_iY, iLayerID);10170		}10171}

Calls

Called by