engine/generators/crypts/source/CryptGenerator.cpp
// Create the central crypt, a long room with an ascending staircase near 
// the end (by one of the N/S/E/W walls)
Create the central crypt, a long room with an ascending staircase near
the end (by one of the N/S/E/W walls)
Create the central crypt a long room with an ascending staircase near the end ( by one of the N / S / E / W walls )
tuple<Coordinate, Coordinate, Coordinate> CryptGenerator::generate_central_crypt(MapPtr map)
{
  Dimensions dim = map->size();
  int rows = dim.get_y();
  int cols = dim.get_x();
  int width = RNG::range(cols / 2, cols - (cols / 5));
  int height = RNG::range(rows / 2, rows - (rows / 5));
  int startx = (cols / 2) - (width / 2);
  int endx = startx + width;
  int starty = (rows / 2) - (height / 2);
  int endy = starty + height;
  Coordinate top_left = make_pair(starty, startx);
  Coordinate bottom_right = make_pair(endy, endx);
  TilePtr tile;
  vector<Coordinate> coords = CoordUtils::get_coordinates_in_range(top_left, bottom_right);
  for (const auto& coord : coords)
  {
    tile = tg.generate(TileType::TILE_TYPE_DUNGEON);
    map->insert(coord.first, coord.second, tile);
  }
  Coordinate stair_loc = generate_up_staircase(top_left, bottom_right, map);
  return make_tuple(stair_loc, top_left, bottom_right);
}
tuple < Coordinate , Coordinate , Coordinate > CryptGenerator :: generate_central_crypt ( MapPtr map ) { Dimensions dim = map -> size ( ) ; int rows = dim . get_y ( ) ; int cols = dim . get_x ( ) ; int width = RNG :: range ( cols / 2 , cols - ( cols / 5 ) ) ; int height = RNG :: range ( rows / 2 , rows - ( rows / 5 ) ) ; int startx = ( cols / 2 ) - ( width / 2 ) ; int endx = startx + width ; int starty = ( rows / 2 ) - ( height / 2 ) ; int endy = starty + height ; Coordinate top_left = make_pair ( starty , startx ) ; Coordinate bottom_right = make_pair ( endy , endx ) ; TilePtr tile ; vector < Coordinate > coords = CoordUtils :: get_coordinates_in_range ( top_left , bottom_right ) ; for ( const auto & coord : coords ) { tile = tg . generate ( TileType :: TILE_TYPE_DUNGEON ) ; map -> insert ( coord . first , coord . second , tile ) ; } Coordinate stair_loc = generate_up_staircase ( top_left , bottom_right , map ) ; return make_tuple ( stair_loc , top_left , bottom_right ) ; }
Create the central crypt, a long room with an ascending staircase near
the end (by one of the N/S/E/W walls)
Create the central crypt a long room with an ascending staircase near the end ( by one of the N / S / E / W walls )
// Centre the crypt on the map. // Return the boundaries of the crypt.