Void Planet::DestroyMoonRegion( MoonID iMoonID, const RegionCoords & vRegionCoords ) { Assert( iMoonID < m_iMoonCount ); RegionMap * pMap = m_arrMoons[iMoonID]; if ( pMap->Contains(vRegionCoords) ) { Region * pRegion = (*pMap)[vRegionCoords]; BlockWorldFn->SelectMemory( TEXT("Regions") ); Delete( pRegion ); BlockWorldFn->UnSelectMemory(); Bool bRemoved = pMap->Remove( vRegionCoords ); Assert( bRemoved ); } }
Region * Planet::CreateMoonRegion( MoonID iMoonID, const RegionCoords & vRegionCoords ) { Assert( iMoonID < m_iMoonCount ); RegionMap * pMap = m_arrMoons[iMoonID]; if ( pMap->Contains(vRegionCoords) ) return (*pMap)[vRegionCoords]; BlockWorldFn->SelectMemory( TEXT("Regions") ); Region * pRegion = New Region( this, iMoonID, vRegionCoords ); BlockWorldFn->UnSelectMemory(); Bool bInserted = pMap->Insert( vRegionCoords, pRegion ); Assert( bInserted ); return pRegion; }
Void Planet::DestroyRegion( RegionLayer iRegionLayer, const RegionCoords & vRegionCoords ) { RegionMap * pMap = NULL; switch( iRegionLayer ) { case REGION_LAYER_UNDERGROUND: pMap = &m_mapUndergroundRegions; break; case REGION_LAYER_SURFACE: pMap = &m_mapSurfaceRegions; break; case REGION_LAYER_ATMOSPHERE: pMap = &m_mapAtmosphereRegions; break; default: Assert( false ); break; } if ( pMap->Contains(vRegionCoords) ) { Region * pRegion = (*pMap)[vRegionCoords]; BlockWorldFn->SelectMemory( TEXT("Regions") ); Delete( pRegion ); BlockWorldFn->UnSelectMemory(); Bool bRemoved = pMap->Remove( vRegionCoords ); Assert( bRemoved ); } }
Region * Planet::CreateRegion( RegionLayer iRegionLayer, const RegionCoords & vRegionCoords ) { RegionMap * pMap = NULL; switch( iRegionLayer ) { case REGION_LAYER_UNDERGROUND: pMap = &m_mapUndergroundRegions; break; case REGION_LAYER_SURFACE: pMap = &m_mapSurfaceRegions; break; case REGION_LAYER_ATMOSPHERE: pMap = &m_mapAtmosphereRegions; break; default: Assert( false ); break; } if ( pMap->Contains(vRegionCoords) ) return (*pMap)[vRegionCoords]; BlockWorldFn->SelectMemory( TEXT("Regions") ); Region * pRegion = New Region( this, iRegionLayer, vRegionCoords ); BlockWorldFn->UnSelectMemory(); Bool bInserted = pMap->Insert( vRegionCoords, pRegion ); Assert( bInserted ); return pRegion; }