Exemplo n.º 1
0
void Wall::destroy()
{
  Construction::destroy();

  if( _city().isValid() )
  {
    TilesArea area( _city()->tilemap(), pos() - TilePos( 2, 2), Size( 5 ) );

    foreach( tile, area )
    {
      WallPtr wall = ptr_cast<Wall>( (*tile)->overlay() );
      if( wall.isValid()  )
      {
        wall->updatePicture( _city() );
      }
    }
Exemplo n.º 2
0
bool Wall::build( const city::AreaInfo& info )
{
  Tilemap& tilemap = info.city->tilemap();
  Tile& terrain = tilemap.at( info.pos );

  // we can't build if already have wall here
  WallPtr wall = ptr_cast<Wall>( terrain.overlay() );
  if( wall.isValid() )
  {
    return false;
  }

  Construction::build( info );

  WallList walls = info.city->statistic().objects.find<Wall>( object::wall );

  for( auto wall : walls ) { wall->updatePicture( info.city ); }

  updatePicture( info.city );

  return true;
}