Class group6::BiomeGenerator
ClassList > group6 > BiomeGenerator
#include <BiomeGenerator.hpp>
Public Functions
| Type | Name |
|---|---|
| BiomeGenerator (BiomeType biome, unsigned int width, unsigned int height, unsigned int seed) |
|
| void | applyPathToGrid (const std::vector< GridPosition > & path) |
| std::vector< GridPosition > | clearPath () const |
| void | generate () |
| BiomeType | getBiome () const |
| unsigned int | getSeed () const |
| void | oceanHandler () |
| void | placeDoorTile (const size_t & doorTile) |
| void | placeSpecialTiles (const size_t & genericTile, const size_t & specialTile, double percentage) |
| void | placeTileRandom (const size_t & tile, const size_t & spawnTile) |
| void | placeTrees () |
| void | saveToFile (const std::string & filename) const |
| void | setTiles (const size_t & firstTile, const size_t & secondTile) |
| void | setWorld (WorldBase * world) |
| ~BiomeGenerator () = default |
Detailed Description
Generates a new grid based on a specified biome
Public Functions Documentation
function BiomeGenerator
group6::BiomeGenerator::BiomeGenerator (
BiomeType biome,
unsigned int width,
unsigned int height,
unsigned int seed
)
Creates a generator with a grid of the given size and using the given seed
Parameters:
biomeThe biome of the gridwidthThe width of the gridheightThe height of the gridseedThe seed used for random number generation
function applyPathToGrid
void group6::BiomeGenerator::applyPathToGrid (
const std::vector< GridPosition > & path
)
Clears the walls out of the grid, guaranteeing a path from the left of the grid, to any point on the rightmost side of the map
Parameters:
pathA vector of GridPositions necessary for this path
function clearPath
std::vector< GridPosition > group6::BiomeGenerator::clearPath () const
Clears a randomized path from the top left of the grid, to any point on the rightmost side of the map
Returns:
A vector of GridPositions necessary for this path
function generate
void group6::BiomeGenerator::generate ()
Generates the grid with two types of tiles
function getBiome
inline BiomeType group6::BiomeGenerator::getBiome () const
function getSeed
inline unsigned int group6::BiomeGenerator::getSeed () const
function oceanHandler
void group6::BiomeGenerator::oceanHandler ()
Handles logic for Ocean biome
function placeDoorTile
void group6::BiomeGenerator::placeDoorTile (
const size_t & doorTile
)
Generates door tile on grid at [1][1]
Parameters:
doorTileDoor Tile
function placeSpecialTiles
void group6::BiomeGenerator::placeSpecialTiles (
const size_t & genericTile,
const size_t & specialTile,
double percentage
)
Generates special tiles on the grid
Parameters:
genericTileThe tile that the special tile can spawn onspecialTileThe special tile to generatepercentageChance of special tile generating on the generic tile
function placeTileRandom
void group6::BiomeGenerator::placeTileRandom (
const size_t & tile,
const size_t & spawnTile
)
Generates random coordinates to place the given tile
Parameters:
tileThe tile being placedspawnTileThe type of tile allowed to be replaced
function placeTrees
void group6::BiomeGenerator::placeTrees ()
Places trees on the grid
function saveToFile
void group6::BiomeGenerator::saveToFile (
const std::string & filename
) const
Saves the grid to the given filepath
Parameters:
filenameThe filename the grid will be saved to
function setTiles
void group6::BiomeGenerator::setTiles (
const size_t & firstTile,
const size_t & secondTile
)
Sets the tile vector for the biome
Parameters:
firstTileTile #1 for the biomesecondTileTile #2 for the biome
function setWorld
void group6::BiomeGenerator::setWorld (
WorldBase * world
)
function ~BiomeGenerator
group6::BiomeGenerator::~BiomeGenerator () = default
The documentation for this class was generated from the following file source/Worlds/BiomeGenerator.hpp