QtCraft API C++ classes QML types Handbook

QcSurfacePlanner Class

Plans where the structures with a surface rule stand (decision E-590), one region of one kind at a time, from the seed, the structure's name and the terrain noise alone (columns, never generated chunks), like the villages: whether the region has a copy (chance), then the first of attempts places (a centre and a turn per attempt) whose footprint and blended ground (decision E-889) lie wholly inside the region, on land above the sea in one of the rule's biomes at its middle and along its edges, with its ground varying by at most maxSlope and its floor on the lowest ground, the ground right beside its walls levelled by the blend, and clear of what occupied reports (villages, other kinds). More...

Header: #include <worldgen/surface/QcSurfacePlanner.h>

Public Types

struct Kind
KindId
Occupied

Public Functions

QcSurfacePlanner(const QcTerrainGenerator &terrain, const QcContentRegistry &content, quint64 seed)
std::optional<QcSurfacePlanner::KindId> kindIndex(const QString &name) const
QcIdList<QcSurfacePlanner::KindId, QcSurfacePlanner::Kind> kinds() const
std::optional<QcStructurePlacement> plan(QcSurfacePlanner::KindId kind, int regionX, int regionZ, const QcSurfacePlanner::Occupied &occupied) const
const QStringList &warnings() const

Static Public Members

const int edgeStep
QcXzRect footprintOf(const QcStructurePlacement &placement)

Detailed Description

With waterDepth the samples may lie under that much water; with preferWater the first place whose middle lies under water wins over the first that fits (a witch hut on stilts, decision E-622). A kind whose structure has choices or parts builds each copy from a selection drawn from the region's own positions (decision E-630). Thread-safe.

Member Type Documentation

[alias] QcSurfacePlanner::KindId

The index of a kind in kinds() (decision E-952).

[alias] QcSurfacePlanner::Occupied

Whether something already stands within margin of a footprint (QcSurfaceStructures asks the villages and the kinds planned before this one).

Member Function Documentation

QcSurfacePlanner::QcSurfacePlanner(const QcTerrainGenerator &terrain, const QcContentRegistry &content, quint64 seed)

Resolves the structures of content with a surface rule into kinds, each with its own seed from seed, planned on the columns of terrain. Structures with an unknown block or foundation are left out with a warning (warnings()); kinds are sorted by name, so their order does not depend on the order the content was loaded in.

[static] QcXzRect QcSurfacePlanner::footprintOf(const QcStructurePlacement &placement)

Returns the footprint of placement, a placed copy.

std::optional<QcSurfacePlanner::KindId> QcSurfacePlanner::kindIndex(const QString &name) const

Returns the index of the kind name, if any.

QcIdList<QcSurfacePlanner::KindId, QcSurfacePlanner::Kind> QcSurfacePlanner::kinds() const

Returns the kinds, sorted by name.

std::optional<QcStructurePlacement> QcSurfacePlanner::plan(QcSurfacePlanner::KindId kind, int regionX, int regionZ, const QcSurfacePlanner::Occupied &occupied) const

Returns the copy of kind kind in region (regionX, regionZ) of its spacing, if any; occupied rules out places too close to something already standing.

const QStringList &QcSurfacePlanner::warnings() const

Returns the warnings from resolving the structures, among them those left out.

Member Variable Documentation

const int QcSurfacePlanner::edgeStep

Blocks between two samples of the ground along a footprint's edge.