bool Garden::build( const CityAreaInfo& info ) { // this is the same arrangement of garden tiles as existed in C3 Construction::build( info ); setPicture( MetaDataHolder::randomPicture( type(), size() ) ); if( size().area() == 1 ) { TilesArray tilesAround = info.city->tilemap().getNeighbors(pos(), Tilemap::AllNeighbors); foreach( tile, tilesAround ) { GardenPtr garden = ptr_cast<Garden>( (*tile)->overlay() ); if( garden.isValid() ) { garden->update(); } }
void Garden::build( CityPtr city, const TilePos& pos ) { // this is the same arrangement of garden tiles as existed in C3 int theGrid[2][2] = {{113, 110}, {112, 111}}; Construction::build( city, pos ); setPicture( ResourceGroup::entertaiment, theGrid[pos.getI() % 2][pos.getJ() % 2] ); if( getSize().getArea() == 1 ) { TilemapTiles tilesAround = city->getTilemap().getRectangle( getTilePos() - TilePos( 1, 1), getTilePos() + TilePos( 1, 1 ) ); foreach( Tile* tile, tilesAround ) { GardenPtr garden = tile->getOverlay().as<Garden>(); if( garden.isValid() ) { garden->update(); } }