Planet::~Planet() { // Destroy content for( UInt i = 0; i < m_iMoonCount; ++i ) DestroyMoon( i ); DestroyOuterSpace(); EnumRegions( REGION_LAYER_ATMOSPHERE ); Region * pRegion = EnumNextRegion(); while( pRegion != NULL ) { DestroyRegion( REGION_LAYER_ATMOSPHERE, pRegion->GetRegionCoords() ); pRegion = EnumNextRegion(); } m_mapAtmosphereRegions.Destroy(); EnumRegions( REGION_LAYER_SURFACE ); pRegion = EnumNextRegion(); while( pRegion != NULL ) { DestroyRegion( REGION_LAYER_SURFACE, pRegion->GetRegionCoords() ); pRegion = EnumNextRegion(); } m_mapSurfaceRegions.Destroy(); EnumRegions( REGION_LAYER_UNDERGROUND ); pRegion = EnumNextRegion(); while( pRegion != NULL ) { DestroyRegion( REGION_LAYER_UNDERGROUND, pRegion->GetRegionCoords() ); pRegion = EnumNextRegion(); } m_mapUndergroundRegions.Destroy(); }
VoidSpace::~VoidSpace() { // Destroy content EnumRegions(); Region * pRegion = EnumNextRegion(); while( pRegion != NULL ) { DestroyRegion( pRegion->GetRegionCoords() ); pRegion = EnumNextRegion(); } m_mapVoidRegions.Destroy(); }
Void Planet::DestroyMoon( MoonID iMoonID ) { Assert( iMoonID < m_iMoonCount ); if ( m_arrMoons[iMoonID] == NULL ) return; EnumMoonRegions( iMoonID ); Region * pMoonRegion = EnumNextMoonRegion(); while( pMoonRegion != NULL ) { DestroyMoonRegion( iMoonID, pMoonRegion->GetRegionCoords() ); pMoonRegion = EnumNextMoonRegion(); } m_arrMoons[iMoonID]->Destroy(); BlockWorldFn->SelectMemory( TEXT("Scratch") ); Delete( m_arrMoons[iMoonID] ); m_arrMoons[iMoonID] = NULL; BlockWorldFn->UnSelectMemory(); }