QtCraft API C++ classes QML types Handbook

QcWorldGenerators Namespace

The world types a world can be created with; world.json names the type and its options (decisions E-221, E-223). More...

Header: #include <worldgen/generators/QcWorldGenerators.h>

Variables

const char *const empty
const char *const flat
const qsizetype maxOptionsLength
const char *const showcase
const char *const terrain

Functions

QcStatus checkOptions(const QString &type, const QString &options, const QcContentRegistry &content)
std::unique_ptr<QcWorldGenerator> create(const QString &type, std::shared_ptr<const QcContentRegistry> content, qint64 seed, const QString &options, int version)
bool isKnown(const QString &type)
QcResult<QString> optionsToStore(const QString &type, const QString &options, const QcContentRegistry &content)
QStringList types()

Detailed Description

Worlds without a type are terrain worlds.

Variable Documentation

const char *const QcWorldGenerators::empty

The name of the void world type (QcVoidGenerator).

const char *const QcWorldGenerators::flat

The name of the flat world type (QcFlatGenerator).

const qsizetype QcWorldGenerators::maxOptionsLength

The longest options a world can store (world.json).

const char *const QcWorldGenerators::showcase

The name of the showcase world type (QcShowcaseGenerator).

const char *const QcWorldGenerators::terrain

The name of the terrain world type.

Function Documentation

QcStatus QcWorldGenerators::checkOptions(const QString &type, const QString &options, const QcContentRegistry &content)

Returns whether options suit the world type type (an error also for an unknown type), with the blocks of content: the layer preset of a flat world, the platform of a void world (QcVoidGenerator::parseOptions; empty: the defaults); the other types take no options. The length limit applies to the text as given.

std::unique_ptr<QcWorldGenerator> QcWorldGenerators::create(const QString &type, std::shared_ptr<const QcContentRegistry> content, qint64 seed, const QString &options, int version)

Returns a generator of type for content, seed and options that generates as world generator version version does (decision E-922, QcGeneratorVersion; a world passes its own, QcWorldInfo::generatorVersion); nullptr for unknown types and versions. Only the terrain generator uses seed. The showcase always generates with the current code, whatever the version. What the generator could not resolve is in its warnings().

bool QcWorldGenerators::isKnown(const QString &type)

Returns whether type names a world type.

QcResult<QString> QcWorldGenerators::optionsToStore(const QString &type, const QString &options, const QcContentRegistry &content)

Returns the options a new world of type stores for options: checked, with the current defaults of content filled in (the flat preset, the void platform), so that later changes of those defaults by mods or updates do not change existing worlds. The flat preset names base-game blocks without their namespace (QcWorldTypeParser::shortPreset).

QStringList QcWorldGenerators::types()

Returns the names of the world types in the order of the menu.