QcVillageDraft Struct
The village of one region while it is planned (decision E-419): the plan under way with the footprints of its pieces and roads, its road cells and its three draw sequences. More...
| Header: | #include <worldgen/villages/QcVillageDraft.h> |
Public Types
Public Functions
| void | addJetty(const QList<QcVillagePlan::Deck> &decks, QcXzRect deck) |
| const QcStructurePlacement & | addPiece(QcStructurePlacement piece, QcXzRect rect, const QList<QcVillageSpot> &spots, const QList<QcBlockPos> &crops) |
| void | addRoadCell(const QcTerrainGenerator &terrain, std::pair<int, int> cell, bool branch, std::optional<QcVillageDraft::RoadLevel> level = std::nullopt) |
| void | addRun(const QcVillageDraft::Road &run, int arm) |
| void | addStairs(const QcVillageDraft::Stairs &laid) |
| void | addThresholds(const QList<QcBlockPos> &steps) |
| void | countPiece(int index) |
| void | coverArea() |
| double | cropRandom() |
| int | groundTop(const QcTerrainGenerator &terrain, int x, int z) const |
| bool | insideRadius(QcXzRect rect) const |
| void | markRoad(QcXzRect rect) |
| bool | nearPiece(QcXzRect rect) const |
| int | nextArm() const |
| double | random() |
| void | setCentre(QcBlockPos centre) |
| void | setLayout(QcVillageDraft::Layout layout) |
| void | setLayoutKind(QcVillageLayout::Kind kind) |
| void | start() |
| bool | touchesRoad(QcXzRect rect, int gap) const |
| double | variantRandom() |
Public Variables
| QcBlockId | branchStep |
| int | centreX |
| int | centreZ |
| QList<int> | counts |
| int | mainDirection |
| int | nextCrop |
| int | nextRandom |
| int | nextVariant |
| QcBlockId | pathStep |
| QList<QcXzRect> | pieces |
| QcVillagePlan | plan |
| QcVillageDraft::Region | region |
| QSet<qint64> | roadCells |
| QList<QcXzRect> | roads |
| QcVillageDraft::Seeds | seeds |
| const QcVillageLayout * | shape |
| QList<QcXzRect> | stairs |
| const QcVillageStyle * | style |
| bool | winding |
Static Public Members
| QcXzRect | brush(std::pair<int, int> cell, int dx, int dz, bool square) |
| qint64 | cellKey(int x, int z) |
| const std::array<std::pair<int, int>, 8> | directions |
| const int | pieceGap |
| const int | roadHalfWidth |
| int | turnsFacing(int fx, int fz) |
Detailed Description
The village planner (QcVillagePlanner) passes it to the road network planner (QcRoadNetworkPlanner, QcRoadLayer), the piece placer (QcPiecePlacer) and the planners over water (QcBoardwalkPlanner) in turn; every draw advances a sequence here, so the plan follows from the order of these calls alone.
Member Function Documentation
void QcVillageDraft::addJetty(const QList<QcVillagePlan::Deck> &decks, QcXzRect deck)
Adds a jetty's decks; deck (its cells) is kept off by pieces and lamps.
const QcStructurePlacement &QcVillageDraft::addPiece(QcStructurePlacement piece, QcXzRect rect, const QList<QcVillageSpot> &spots, const QList<QcBlockPos> &crops)
Adds the building piece over rect, with its beds and workstations (spots, local), its creatures and its crop cells (crops, local); returns the placed piece, valid until the next piece is added.
void QcVillageDraft::addRoadCell(const QcTerrainGenerator &terrain, std::pair<int, int> cell, bool branch, std::optional<QcVillageDraft::RoadLevel> level = std::nullopt)
Adds the road cell cell (x, z) of a side road when branch, else of a road from the centre: on land at the ground's top block of terrain, or at level (the road's middle line) where that lies at most one block above or below it (decision E-409); in a style over water a boardwalk deck; on land over water where the middle line runs on a bridge the style's bridge deck, and a water cell without a bridge stays water (decision E-907). Cells under a piece or already a road stay as they are: the first rank laid on a cell keeps it.
void QcVillageDraft::addRun(const QcVillageDraft::Road &run, int arm)
Adds the laid run of road arm arm: its extent, its run in the plan and its length.
void QcVillageDraft::addStairs(const QcVillageDraft::Stairs &laid)
Over water: adds the stairs laid down to land, kept off by pieces, with their dry strip.
void QcVillageDraft::addThresholds(const QList<QcBlockPos> &steps)
On land: adds the doorsteps steps of a placed piece, as side road where no road lies yet.
[static] QcXzRect QcVillageDraft::brush(std::pair<int, int> cell, int dx, int dz, bool square)
Returns the brush of the road cell cell of a run in direction (dx, dz): three across an axis run, three by three where square (diagonals and bends).
[static] qint64 QcVillageDraft::cellKey(int x, int z)
Returns the key of the column x, z in roadCells.
void QcVillageDraft::countPiece(int index)
Counts one more piece of kind index placed.
void QcVillageDraft::coverArea()
Sets the columns the village covers (pieces, roads and jetties, the centre's blended ground; over water with the wetland's reach, within the region).
double QcVillageDraft::cropRandom()
Returns the next draw of the crop sequence, in [0, 1).
int QcVillageDraft::groundTop(const QcTerrainGenerator &terrain, int x, int z) const
Returns the ground's top block at the column x, z as the village builds it: inside the centre piece its floor, around it the blended ground (decision E-893), elsewhere the top block of terrain.
bool QcVillageDraft::insideRadius(QcXzRect rect) const
Returns whether rect lies within the square of the radius around the centre.
void QcVillageDraft::markRoad(QcXzRect rect)
Marks the columns of rect as road cells that pieces and lamps keep off (jetties, stairs), and adds rect to roads.
bool QcVillageDraft::nearPiece(QcXzRect rect) const
Returns whether rect comes within the gap of a piece: pieceGap, and around the centre piece at least its blended ground (decision E-893), so no other piece stands on ground that moves.
int QcVillageDraft::nextArm() const
Returns the arm number of the next road laid.
double QcVillageDraft::random()
Returns the next draw of the layout sequence, in [0, 1).
void QcVillageDraft::setCentre(QcBlockPos centre)
Sets the meeting point of the village (its bell) to centre.
void QcVillageDraft::setLayout(QcVillageDraft::Layout layout)
Takes the street plan layout (before the centre piece, which faces the main road).
void QcVillageDraft::setLayoutKind(QcVillageLayout::Kind kind)
Names kind as the plan's kind of street plan (a plaza whose ring could not be laid is a cross).
void QcVillageDraft::start()
Starts the plan: its id and settings from the style, its road surfaces drawn from the variant sequence before any building's variation, the piece counts at 0.
bool QcVillageDraft::touchesRoad(QcXzRect rect, int gap) const
Returns whether a road cell lies within gap of rect.
[static] int QcVillageDraft::turnsFacing(int fx, int fz)
Returns the quarter turns clockwise after which the door of a piece (the south side of its first layer) faces (fx, fz), an axis direction.
double QcVillageDraft::variantRandom()
Returns the next draw of the variant sequence, in [0, 1).
Member Variable Documentation
QList<int> QcVillageDraft::counts
Pieces placed of each kind of the style.
const std::array<std::pair<int, int>, 8> QcVillageDraft::directions
The eight directions of roads, clockwise from east (x up, z down the screen); even ones are the axes.
int QcVillageDraft::mainDirection
The direction the main road leaves the centre in, an index into directions.
const int QcVillageDraft::pieceGap
Gap between neighbouring pieces, and between pieces and lamps.
QList<QcXzRect> QcVillageDraft::pieces
The footprints of the placed pieces, the centre piece first.
QcVillagePlan QcVillageDraft::plan
The plan under way.
QcVillageDraft::Region QcVillageDraft::region
The region and the village's radius.
QSet<qint64> QcVillageDraft::roadCells
Columns of roads, boardwalks, jetties and stairs (cellKey): pieces and lamps keep off them.
const int QcVillageDraft::roadHalfWidth
Roads are three blocks wide.
QList<QcXzRect> QcVillageDraft::roads
The extent of every road run, jetty and stairs (the village's area, the wetland's sources).
QcVillageDraft::Seeds QcVillageDraft::seeds
The seeds of the draw sequences.
const QcVillageLayout *QcVillageDraft::shape
The street plan (setLayout()).
QList<QcXzRect> QcVillageDraft::stairs
Over water: the stairs down to land (also in roads).
const QcVillageStyle *QcVillageDraft::style
The village's style.
bool QcVillageDraft::winding
Whether the roads wind.