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; }
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; }