CvPlot::getLayerUnit(int, int) const
- Defined in
- CvPlot.cpp, line 10174
- Class
- CvPlot
- Hook name
CivHooks::CvPlot_getLayerUnit
Hooks
static bool BeforeCvPlot_getLayerUnit(const CvPlot* self, int iIndex, int iLayerID, CvUnit*& result);static void AfterCvPlot_getLayerUnit(const CvPlot* self, int iIndex, int iLayerID, CvUnit*& result);static CvUnit* ReplaceCvPlot_getLayerUnit(CvUnit* (*original)(const CvPlot*, int, int), const CvPlot* self, int iIndex, int iLayerID);CivRegisterBefore<CivHooks::CvPlot_getLayerUnit>(host, &BeforeCvPlot_getLayerUnit);CivRegisterAfter<CivHooks::CvPlot_getLayerUnit>(host, &AfterCvPlot_getLayerUnit);CivRegisterReplace<CivHooks::CvPlot_getLayerUnit>(host, &ReplaceCvPlot_getLayerUnit);
Code
10174CvUnit* CvPlot::getLayerUnit(int iIndex, int iLayerID /*= -1*/) const10175{10176 if (iIndex >= 0)10177 {10178 if (iLayerID == DEFAULT_UNIT_MAP_LAYER)10179 // The base layer10180 return getUnitByIndex(iIndex);10181 else10182 if (iLayerID == -1)10183 {10184 // All layers10185 int iCount = m_units.getLength();10186 if (iIndex < iCount)10187 return getUnitByIndex(iIndex);10188 else10189 {10190 const CvPlotManager& kManager = GC.getMap().plotManager();10191 int iNumLayers = kManager.GetNumLayers();10192 for (int iLayerIndex = 0; iLayerIndex < iNumLayers; ++iLayerIndex)10193 { 10194 const CvIDInfoFixedVector& kUnits = kManager.GetUnitsByIndex(m_iX, m_iY, iLayerIndex);10195 if (iIndex < (iCount + (int)kUnits.size()))10196 return ::getUnit( kUnits[iIndex - iCount] );10197 else10198 iCount += kUnits.size();10199 } 10200 }10201 }10202 else10203 {10204 // Specific layer10205 const CvIDInfoFixedVector& kUnits = GC.getMap().plotManager().GetUnits(m_iX, m_iY, iLayerID);10206 if (iIndex < (int)kUnits.size())10207 return ::getUnit( kUnits[iIndex] );10208 }10209 }1021010211 return NULL;10212}
Calls
BaseVector::operator[]BaseVector::size- CvGlobals::getMap()
- CvMap::plotManager()
- CvPlot::getUnitByIndex(int) const
- CvPlotManager::GetNumLayers() const
- CvPlotManager::GetUnits(int, int, uint) const
- CvPlotManager::GetUnitsByIndex(int, int, int) const
FFastSmallFixedList::getLength- getUnit(const IDInfo &)