QtCraft API C++ classes QML types Handbook

QcStructureVariationParser Namespace

Parses the variation of a structure (decision E-404): choices (named lists of name swaps, one option taken per placed copy) and parts (optional cells with a chance, in the structure's palette). More...

Header: #include <common/content/worldgen/QcStructureVariationParser.h>

Functions

QList<QcStructureDefinition::Choice> parseChoices(const QJsonObject &json, QcJsonFieldReader &reader, const QString &packNamespace)
QList<QcStructureDefinition::Part> parseParts(const QJsonObject &json, const QHash<QChar, qint16> &keys, const QcStructureDefinition &structure, QcJsonFieldReader &reader)

Detailed Description

Used by QcStructureParser after the palette and layers, choices first.

Function Documentation

QList<QcStructureDefinition::Choice> QcStructureVariationParser::parseChoices(const QJsonObject &json, QcJsonFieldReader &reader, const QString &packNamespace)

Returns the named lists of name swaps at "choices" of json, names qualified with packNamespace; reader fails on an invalid entry.

QList<QcStructureDefinition::Part> QcStructureVariationParser::parseParts(const QJsonObject &json, const QHash<QChar, qint16> &keys, const QcStructureDefinition &structure, QcJsonFieldReader &reader)

Returns the optional parts at "parts" of json; reader fails on an invalid entry. keys maps the palette characters to palette indices of structure (read so far: its palette, size and cells).