QtCraft API C++ classes QML types Handbook

QcWorldTypeParser Namespace

Parses the settings of the flat and void world types (worldgen/flat.json, worldgen/void.json, decision E-223). More...

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

Functions

QcResult<QcFlatDefinition> parseFlat(const QJsonObject &json, const QString &packNamespace)
QcResult<QcVoidDefinition> parseVoid(const QJsonObject &json, const QString &packNamespace)
QString shortPreset(const QString &preset)
QString unknownPresetBlock(const QString &preset, const QcContentRegistry &content)

Detailed Description

Function Documentation

QcResult<QcFlatDefinition> QcWorldTypeParser::parseFlat(const QJsonObject &json, const QString &packNamespace)

Returns the flat world settings read from json, or the first error. Block names of the preset without a namespace are qualified with packNamespace.

QcResult<QcVoidDefinition> QcWorldTypeParser::parseVoid(const QJsonObject &json, const QString &packNamespace)

Returns the void world settings read from json, or the first error. The platform block is qualified with packNamespace.

QString QcWorldTypeParser::shortPreset(const QString &preset)

Returns the layer list preset with the base game's namespace left out of its block names ("qtcraft:stone" becomes "stone"), as the menu shows it and a flat world stores it; the flat generator reads names without a namespace as the base game's.

QString QcWorldTypeParser::unknownPresetBlock(const QString &preset, const QcContentRegistry &content)

Returns the first block name of the layer list preset that content does not know, or an empty string when it knows them all (or the list is malformed: parsing reports that).