QtCraft API C++ classes QML types Handbook

QcPiecePlacer Class

The buildings of a village (decision E-403, E-404, E-419): the centre piece facing the main road, the kinds with rules where their rules hold (a kind with a water rule beside a road end with its jetty), pieces of the style by weight on both sides of the roads facing them (beside diagonal roads with a forecourt to the road), their doorsteps, and lamps along the roads. More...

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

Public Types

Road

Public Functions

void placeAlong(QcVillageDraft &draft, const QcPiecePlacer::Road &road) const
void placeCentre(QcVillageDraft &draft) const
void placeLamps(QcVillageDraft &draft, const QcPiecePlacer::Road &road) const
void placeRulePieces(QcVillageDraft &draft, const QList<QcPiecePlacer::Road> &roads) const

Static Public Members

const int maxPieces

Detailed Description

Deterministic and thread-safe (const).

Member Type Documentation

[alias] QcPiecePlacer::Road

A road of the draft, along which pieces and lamps are placed.

Member Function Documentation

void QcPiecePlacer::placeAlong(QcVillageDraft &draft, const QcPiecePlacer::Road &road) const

Adds pieces by weight to draft along the sides of road that take pieces, until none is left to place or the village has maxPieces.

void QcPiecePlacer::placeCentre(QcVillageDraft &draft) const

Adds the centre piece to draft (the style's rare centre with its chance, decision E-592, else or where the rare one does not fit the usual centre), its door towards the main road; none where the ground does not fit.

void QcPiecePlacer::placeLamps(QcVillageDraft &draft, const QcPiecePlacer::Road &road) const

Adds the style's lamp to draft every lampSpacing blocks (village settings) along the whole road, sides taking turns, just beside the road where the spot is free and flat.

void QcPiecePlacer::placeRulePieces(QcVillageDraft &draft, const QList<QcPiecePlacer::Road> &roads) const

Adds to draft the kinds with rules (decision E-404, E-408) whose chance is drawn and whose minimum road length the village reaches, each up to its maximum (at least one) while a spot fits: beside a road end of roads with water ahead for a kind with a water rule, else on a random spot along one of roads.

Member Variable Documentation

const int QcPiecePlacer::maxPieces

Pieces of one village at most (the centre and lamps not counted).