コード例 #1
0
ファイル: Planet.cpp プロジェクト: Shikifuyin/Scarab-Engine
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 );
    }
}
コード例 #2
0
ファイル: Planet.cpp プロジェクト: Shikifuyin/Scarab-Engine
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;
}
コード例 #3
0
ファイル: Planet.cpp プロジェクト: Shikifuyin/Scarab-Engine
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 );
    }
}
コード例 #4
0
ファイル: Planet.cpp プロジェクト: Shikifuyin/Scarab-Engine
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;
}