Esempio n. 1
0
void Road::build(const int i, const int j)
{
  Construction::build(i, j);
  setPicture(computePicture());

  // update adjacent roads
  for (std::list<Tile*>::iterator itTile = _accessRoads.begin(); itTile != _accessRoads.end(); ++itTile)
  {
    Tile &tile = **itTile;
    Road &road = (Road&) *tile.get_terrain().getOverlay();
    road.computeAccessRoads();
    road.setPicture(road.computePicture());
  }
  // NOTE: also we need to update accessRoads for adjacent building
  // how to detect them if MaxDistance2Road can be any
  // so let's recompute accessRoads for every _building_
  std::list<LandOverlay*> list = Scenario::instance().getCity().getOverlayList(); // it looks terrible!!!!
  for (std::list<LandOverlay*>::iterator itOverlay = list.begin(); itOverlay!=list.end(); ++itOverlay)
  {
    LandOverlay *overlay = *itOverlay;
    Building *construction = dynamic_cast<Building*>(overlay);
    if (construction != NULL) // if NULL then it ISN'T building
    {
      construction->computeAccessRoads();
    }    
  }
}
Esempio n. 2
0
Plaza::Plaza()
{
  //std::cout << "Plaza::Plaza" << std::endl;

  // somewhere we need to delete original road and then we need to think
  // because as we remove original road we need to recompute adjacent tiles
  // or we will run into big troubles
 
  setType(B_PLAZA);
  setPicture(computePicture()); // 102 ~ 107
  _size = 1;
}
Esempio n. 3
0
void Road::build(const TilePos& pos )
{
    Tilemap& tilemap = Scenario::instance().getCity().getTilemap();
    LandOverlay* saveOverlay = tilemap.at( pos ).get_terrain().getOverlay();

    Construction::build( pos );
    setPicture(computePicture());

    if( Aqueduct* aqua = safety_cast< Aqueduct* >( saveOverlay ) )
    {
        aqua->build( pos );
        return;
    }

  // update adjacent roads
  for (std::list<Tile*>::iterator itTile = _accessRoads.begin(); itTile != _accessRoads.end(); ++itTile)
  {
    Road* road = safety_cast< Road* >( (*itTile)->get_terrain().getOverlay() ); // let's think: may here different type screw up whole program?
    if( road )
    {
        road->computeAccessRoads();
        road->setPicture(road->computePicture());
    }
  }
  // NOTE: also we need to update accessRoads for adjacent building
  // how to detect them if MaxDistance2Road can be any
  // so let's recompute accessRoads for every _building_
  std::list<LandOverlay*> list = Scenario::instance().getCity().getOverlayList(); // it looks terrible!!!!
  for (std::list<LandOverlay*>::iterator itOverlay = list.begin(); itOverlay!=list.end(); ++itOverlay)
  {
    LandOverlay *overlay = *itOverlay;
    Building *construction = dynamic_cast<Building*>(overlay);
    if (construction != NULL) // if NULL then it ISN'T building
    {
      construction->computeAccessRoads();
    }
  }
}
Esempio n. 4
0
WarehouseTile::WarehouseTile( const TilePos& pos )
{
   _pos = pos;
   _stock._maxQty = 400;
   computePicture();
}