//Uses a recursive method to elimate adjacent tiles of structure information. //The code will attempt to delete the current mapindex, then search using this method: //1) if there isn't structure info here, return. //2) if there is structure info here, delete it now. //3) KillBuilding at x-1, y. //4) KillBuilding at x , y-1. //5) KillBuilding at x+1, y. //6) KillBuilding at x , y+1. void KillBuilding( UINT32 iMapIndex ) { BOOLEAN fFound = FALSE; if( !gfBasement ) fFound |= RemoveAllRoofsOfTypeRange( iMapIndex, FIRSTTEXTURE, LASTITEM ); fFound |= RemoveAllLandsOfTypeRange( iMapIndex, FIRSTFLOOR, LASTFLOOR ); EraseBuilding( iMapIndex ); gubWorldRoomInfo[ iMapIndex ] = 0; if( !fFound ) { if( gfBasement ) RebuildRoof( iMapIndex, 0 ); return; } if( GridNoOnVisibleWorldTile( (UINT16)( iMapIndex - WORLD_COLS ) ) ) KillBuilding( iMapIndex - WORLD_COLS ); if( GridNoOnVisibleWorldTile( (UINT16)( iMapIndex + WORLD_COLS ) ) ) KillBuilding( iMapIndex + WORLD_COLS ); if( GridNoOnVisibleWorldTile( (UINT16)( iMapIndex + 1 ) ) ) KillBuilding( iMapIndex + 1 ); if( GridNoOnVisibleWorldTile( (UINT16)( iMapIndex - 1 ) ) ) KillBuilding( iMapIndex - 1 ); if( gfBasement ) RebuildRoof( iMapIndex, 0 ); }
void EraseFloor( UINT32 iMapIndex ) { AddToUndoList( iMapIndex ); RemoveAllLandsOfTypeRange( iMapIndex, FIRSTFLOOR, LASTFLOOR ); }