engine/generators/crypts/source/CryptGenerator.cpp
// Generate the staircase to the surface.
Generate the staircase to the surface.
Generate the staircase to the surface .
Coordinate CryptGenerator::generate_up_staircase(const Coordinate& top_left, const Coordinate& bottom_right, MapPtr map)
{
  CardinalDirection d = static_cast<CardinalDirection>(RNG::range(static_cast<int>(CardinalDirection::CARDINAL_DIRECTION_NORTH), static_cast<int>(CardinalDirection::CARDINAL_DIRECTION_WEST)));
  Coordinate stair_coords(0, 0);
  switch (d)
  {
    case CardinalDirection::CARDINAL_DIRECTION_NORTH:
      stair_coords.first = top_left.first;
      stair_coords.second = (top_left.second + bottom_right.second) / 2;
      break;
    case CardinalDirection::CARDINAL_DIRECTION_SOUTH:
      stair_coords.first = bottom_right.first;
      stair_coords.second = (top_left.second + bottom_right.second) / 2;
      break;
    case CardinalDirection::CARDINAL_DIRECTION_EAST:
      stair_coords.first = (top_left.first + bottom_right.first) / 2;
      stair_coords.second = top_left.second;
      break;
    case CardinalDirection::CARDINAL_DIRECTION_WEST:
    default:
      stair_coords.first = (top_left.first + bottom_right.first) / 2;
      stair_coords.second = bottom_right.second;
      break;
  }
  place_staircase(map, stair_coords.first, stair_coords.second, TileType::TILE_TYPE_UP_STAIRCASE, TileType::TILE_TYPE_CRYPT, Direction::DIRECTION_UP, get_permanence(), true);
  return stair_coords;
}
Coordinate CryptGenerator :: generate_up_staircase ( const Coordinate & top_left , const Coordinate & bottom_right , MapPtr map ) { CardinalDirection d = static_cast < CardinalDirection > ( RNG :: range ( static_cast < int > ( CardinalDirection :: CARDINAL_DIRECTION_NORTH ) , static_cast < int > ( CardinalDirection :: CARDINAL_DIRECTION_WEST ) ) ) ; Coordinate stair_coords ( 0 , 0 ) ; switch ( d ) { case CardinalDirection :: CARDINAL_DIRECTION_NORTH : stair_coords . first = top_left . first ; stair_coords . second = ( top_left . second + bottom_right . second ) / 2 ; break ; case CardinalDirection :: CARDINAL_DIRECTION_SOUTH : stair_coords . first = bottom_right . first ; stair_coords . second = ( top_left . second + bottom_right . second ) / 2 ; break ; case CardinalDirection :: CARDINAL_DIRECTION_EAST : stair_coords . first = ( top_left . first + bottom_right . first ) / 2 ; stair_coords . second = top_left . second ; break ; case CardinalDirection :: CARDINAL_DIRECTION_WEST : default : stair_coords . first = ( top_left . first + bottom_right . first ) / 2 ; stair_coords . second = bottom_right . second ; break ; } place_staircase ( map , stair_coords . first , stair_coords . second , TileType :: TILE_TYPE_UP_STAIRCASE , TileType :: TILE_TYPE_CRYPT , Direction :: DIRECTION_UP , get_permanence ( ) , true ) ; return stair_coords ; }
Generate the staircase to the surface.
Generate the staircase to the surface .
// Generate the up-staircase.