QtCraft API C++ classes QML types Handbook

QcVillagePlan Struct

One village as the world generator builds it (decision E-403): a pure function of the seed, the region and the content, computed from the terrain noise alone (never from generated chunks), so every chunk writes its own columns of it and a village spanning chunks comes out the same in any generation order (QcVillageGenerator::build). More...

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

Public Types

struct Deck
struct Mob
struct Run
struct Wetland
Spot

Public Functions

bool covers(int x, int z, int margin) const
bool overlaps(QcChunkPos chunk, int margin) const
void squeeze()

Public Variables

bool alwaysLivedIn
QList<QcVillagePlan::Spot> beds
QcBlockId branchPathBlock
QList<QcBlockPos> branchRoads
QList<QcVillagePlan::Deck> bridges
QcBlockPos centre
int centreBlend
QList<QcVillagePlan::Deck> decks
QSet<QcBlockPos> fields
QcBlockId foundation
qint64 id
QString layout
int maxX
int maxZ
int minX
int minZ
QList<QcVillagePlan::Mob> mobs
QcBlockId pathBlock
QList<QcStructurePlacement> pieces
bool residentsConfined
int roadLength
QList<QcBlockPos> roads
QList<QcVillagePlan::Run> runs
QList<QcPlacedBlock> steps
QcBlockId stiltPost
int stiltSpacing
QString style
QList<QcBlockPos> thresholds
QcVillagePlan::Wetland wetland
bool winding
QList<QcVillagePlan::Spot> workstations

Static Public Members

const int reach
qint64 regionId(int x, int z)
int regionX(qint64 id)
int regionZ(qint64 id)

Detailed Description

Member Type Documentation

[alias] QcVillagePlan::Spot

A bed head or workstation in world coordinates.

Member Function Documentation

bool QcVillagePlan::covers(int x, int z, int margin) const

Returns whether the column x, z lies within margin blocks of the covered columns.

bool QcVillagePlan::overlaps(QcChunkPos chunk, int margin) const

Returns whether chunk comes within margin blocks of the covered columns.

[static constexpr] qint64 QcVillagePlan::regionId(int x, int z)

Returns the id of the village planned in region (x, z) (QcVillagePlanner::plan): bit 61 set, bits 62 and 63 clear, the region's x in bits 24 to 47 and its z in bits 0 to 23 (each 24 bits, two's complement). Never 0, which stands for no village (QcVillager::village), and never a settlement's id (QcVillage::settlementId, bit 62).

[static constexpr] int QcVillagePlan::regionX(qint64 id)

Returns the region x of the regionId() id.

[static constexpr] int QcVillagePlan::regionZ(qint64 id)

Returns the region z of the regionId() id.

void QcVillagePlan::squeeze()

Frees the room the lists of a finished plan grew into: the generator caches hundreds of plans (QcVillageGenerator::cachedPlans).

Member Variable Documentation

bool QcVillagePlan::alwaysLivedIn

Residents move into its free beds even while creatures do not spawn (the rows of the showcase world, decision E-411); other villages get theirs only with the creatures.

QList<QcVillagePlan::Spot> QcVillagePlan::beds

The bed heads of its pieces.

QList<QcVillagePlan::Deck> QcVillagePlan::bridges

The decks of the bridges that carry roads on land over rivers (decision E-841).

QcBlockPos QcVillagePlan::centre

The meeting point: the bell of the centre piece, else the centre's floor in its middle.

int QcVillagePlan::centreBlend

The ground within this many blocks of the centre piece is blended to its floor (decision E-893): the blend of the centre's surface rule, like a temple standing alone; 0: none.

QList<QcVillagePlan::Deck> QcVillagePlan::decks

The cells of the jetties' walkways, and over water of the boardwalks and their stairs.

QSet<QcBlockPos> QcVillagePlan::fields

The crop cells of its pieces in the world: its fields, the only crops its farmers harvest (decision E-411).

QcBlockId QcVillagePlan::foundation

The style's block that fills the ground below the pieces down to solid ground (air: none).

qint64 QcVillagePlan::id

regionId() of its region; the showcase and test fixtures number their villages from 1.

QList<QcVillagePlan::Mob> QcVillagePlan::mobs

The creatures of its pieces.

QList<QcStructurePlacement> QcVillagePlan::pieces

The pieces (centre, houses, farms, lamps), each turned towards its road: the first layer replaces the ground's top block, the foundation fills the ground below it down to solid ground and the terrain above it is cleared.

const int QcVillagePlan::reach

Beds and workstations this far outside the generated area still belong to the village (QcVillage::reach); the showcase keeps its villages further apart than that.

bool QcVillagePlan::residentsConfined

Its residents, the ones moving into its beds and the children born there, are confined (QcCreature::confined, decision E-510): they change no block, so the rows of the showcase world keep their ripe fields with the game rule mobGriefing on.

int QcVillagePlan::roadLength

The length of all roads' middle lines in blocks: the village's size for the rules (decision E-408).

QList<QcVillagePlan::Run> QcVillagePlan::runs

The runs of the roads' middle lines, in the order they were laid.

QList<QcPlacedBlock> QcVillagePlan::steps

The slabs where a road steps up by one block (QcVillageRoads::steps).

QString QcVillagePlan::style

The name of the village's style.

QList<QcBlockPos> QcVillagePlan::thresholds

Doorsteps (decision E-409): on land, the cell in front of each outer door of a piece at the height of its floor; the ground there is levelled to it and it is a side road cell too.

QcVillagePlan::Wetland QcVillagePlan::wetland

Over water: the ground the village shapes around itself.

QList<QcVillagePlan::Spot> QcVillagePlan::workstations

The workstations of its pieces, with their kind of work.