QtCraft API C++ classes QML types Handbook

QcVillagePlanner Class

Lays out the village of one region (decision E-403) from the seed and the terrain noise: a chance per region, a centre on flat land of a biome with villages, roads after one of the style's street plans (decision E-408: cross, street, T, L, plaza, tree; roads stop at water and steep steps and may wind with the terrain) with side roads, pieces of the biome's style on both sides of the roads facing them, lamps along stretches without houses. More...

Header: #include <worldgen/villages/QcVillagePlanner.h>

Public Functions

QcVillagePlanner(const QcTerrainGenerator &terrain, const QcContentRegistry &content, const QcVillageStyles &styles, quint64 seed)
std::shared_ptr<const QcVillagePlan> plan(int regionX, int regionZ) const
int spacing() const

Static Public Members

int freeMargin(const QcVillageSettings &settings)
int spacingOf(const QcVillageSettings &settings)

Detailed Description

It chooses the region's centre and passes the village's draft (QcVillageDraft) in a fixed order to the road network planner (QcRoadNetworkPlanner), the piece placer (QcPiecePlacer) and the planners over water (QcBoardwalkPlanner, QcJettyPlanner) (decision E-419). Deterministic and thread-safe (const).

Member Function Documentation

QcVillagePlanner::QcVillagePlanner(const QcTerrainGenerator &terrain, const QcContentRegistry &content, const QcVillageStyles &styles, quint64 seed)

Plans villages over terrain with the village settings of content and styles, its draw sequences seeded from seed.

[static] int QcVillagePlanner::freeMargin(const QcVillageSettings &settings)

Returns the blocks every village of settings keeps free between its radius and the edge of its region, at least 8: a wetland reaching further would end in a straight line there (QcVillageStyles fits it).

std::shared_ptr<const QcVillagePlan> QcVillagePlanner::plan(int regionX, int regionZ) const

Returns the village of region regionX, regionZ; null when the region has none (by chance, no style, no fitting centre or no room for the centre piece).

int QcVillagePlanner::spacing() const

Returns the edge of a region in blocks, a multiple of the chunk size.

[static] int QcVillagePlanner::spacingOf(const QcVillageSettings &settings)

Returns the edge of a region in blocks for settings: their spacing rounded down to whole chunks, at least 8 chunks.