QtCraft API C++ classes QML types Handbook

QcBiomeMap Class

A top-down map of a terrain world (decision E-921): biome, height and water of one column per cell, each exactly the column QcTerrainGenerator::column() computes at the cell's north-west corner (the same call that decides the biomes of the game), without generating chunks. More...

Header: #include <worldgen/generators/QcBiomeMap.h>

Public Types

struct Area
struct Cell
struct Site
Cancelled
enum class Water { Land, Sea, River }

Public Functions

QcBiomeMap::Area area() const
QList<int> biomeCells(int biomeCount) const
const QcBiomeMap::Cell &cell(int x, int z) const
int size() const

Static Public Members

QcBiomeMap::Cell cellAt(const QcTerrainGenerator &generator, int x, int z)
std::optional<QcBiomeMap> sample(const QcTerrainGenerator &generator, QcBiomeMap::Area area, const QcBiomeMap::Cancelled &cancelled = {})
QStringList siteKinds(const QcTerrainGenerator &generator)
std::optional<QList<QcBiomeMap::Site>> sites(const QcTerrainGenerator &generator, QcBiomeMap::Area area, const QcBiomeMap::Cancelled &cancelled = {})

Detailed Description

The map preview of a new world and qtcraft-headless –biome-map draw it; sites() adds the villages and structures the generator plans there.

Member Type Documentation

[alias] QcBiomeMap::Cancelled

Asked between rows (and regions); true stops the work.

enum class QcBiomeMap::Water

What covers a column: land, still water (the sea and lakes under the sea level) or the water of a river channel (a river biome, decision E-840).

ConstantValueDescription
QcBiomeMap::Water::Land0No water on the column.
QcBiomeMap::Water::Sea1Water up to the sea level: the sea and basins below it, not surface lakes.
QcBiomeMap::Water::River2The water of a river channel.

Member Function Documentation

QcBiomeMap::Area QcBiomeMap::area() const

Returns the area the map covers.

QList<int> QcBiomeMap::biomeCells(int biomeCount) const

Returns how many cells of land and river each of the first biomeCount biomes has (index: biome); the sea counts for none.

const QcBiomeMap::Cell &QcBiomeMap::cell(int x, int z) const

Returns the cell in column x and row z of the map (counted from the north-west corner, not world coordinates).

[static] QcBiomeMap::Cell QcBiomeMap::cellAt(const QcTerrainGenerator &generator, int x, int z)

Returns the cell generator computes for the column x, z.

[static] std::optional<QcBiomeMap> QcBiomeMap::sample(const QcTerrainGenerator &generator, QcBiomeMap::Area area, const QcBiomeMap::Cancelled &cancelled = {})

Returns the map of area with the cells generator computes; none when cancelled said so first.

[static] QStringList QcBiomeMap::siteKinds(const QcTerrainGenerator &generator)

Returns the kinds sites() can find with generator, in a fixed order: "village", "coastal_tower", then the surface structures by name (QcSurfacePlanner::kinds), so a kind keeps its place (and its marker on the map) whatever the world's options turn off.

[static] std::optional<QList<QcBiomeMap::Site>> QcBiomeMap::sites(const QcTerrainGenerator &generator, QcBiomeMap::Area area, const QcBiomeMap::Cancelled &cancelled = {})

Returns the villages, surface structures and coastal towers whose place lies in area, as generator plans them (this plans their regions, which costs far more than the cells); none when cancelled said so first. Mine shafts and dungeons (underground) are left out: in a debug build their regions over 2048 × 2048 blocks take about 4 s and 3 s to plan (decision E-921).

int QcBiomeMap::size() const

Returns the number of cells along each side.