QtCraft API C++ classes QML types Handbook

QcVillageCatalog Class

Villages of the content (part of QcContentRegistry, server side only, not synchronised): village styles and settings (decision E-403), villager species and professions (decisions E-411, E-421) and the professions' offers (decision E-414). More...

Header: #include <common/content/villages/QcVillageCatalog.h>

Public Functions

QcVillageGolemSettings golemOfStyle(const QString &style) const
const QcVillagerProfession *profession(const QString &name) const
const QList<QcVillagerProfession> &professions() const
void registerProfession(QcVillagerProfession profession)
void registerStyle(QcVillageStyleDefinition style)
void registerTradeSet(QcTradeSet set)
void registerVillagerSettings(QcVillagerSettings settings)
void removeVillagerSettings(const QString &name)
void setSettings(QcVillageSettings settings)
const QcVillageSettings &settings() const
const QcVillageStyleDefinition *style(const QString &name) const
const QList<QcVillageStyleDefinition> &styles() const
const QList<QcTradeSet> &tradeSets() const
void updateStyle(qsizetype index, Change change)
void updateVillagerSpecies(Change change)
const QcVillagerSettings *villagerSettings(const QString &name) const
std::optional<qsizetype> villagerSettingsIndex(const QString &name) const
const QList<QcVillagerSettings> &villagerSpecies() const

Detailed Description

Definitions are replaced by name, the settings by a later pack.

Member Function Documentation

QcVillageGolemSettings QcVillageCatalog::golemOfStyle(const QString &style) const

Returns the golems guarding villages of style: the style's golem fields over the settings' (decision E-421).

const QcVillagerProfession *QcVillageCatalog::profession(const QString &name) const

Returns the profession name, or nullptr if there is none.

const QList<QcVillagerProfession> &QcVillageCatalog::professions() const

Returns the professions in registration order.

void QcVillageCatalog::registerProfession(QcVillagerProfession profession)

Adds profession, or replaces the one of the same name in its place.

void QcVillageCatalog::registerStyle(QcVillageStyleDefinition style)

Adds style, or replaces the style of the same name in its place; each registration counts QcVillageStyleDefinition::registered up.

void QcVillageCatalog::registerTradeSet(QcTradeSet set)

Adds the set of offers set, or replaces the one of the same name in its place.

void QcVillageCatalog::registerVillagerSettings(QcVillagerSettings settings)

Adds the villager species settings, or replaces the one of the same name in its place.

void QcVillageCatalog::removeVillagerSettings(const QString &name)

Removes the species name (QcVillageContent::resolveSpecies drops a broken one).

void QcVillageCatalog::setSettings(QcVillageSettings settings)

Replaces the village settings with settings.

See also settings().

const QcVillageSettings &QcVillageCatalog::settings() const

Returns the village settings.

const QcVillageStyleDefinition *QcVillageCatalog::style(const QString &name) const

Returns the style name, or nullptr if there is none.

const QList<QcVillageStyleDefinition> &QcVillageCatalog::styles() const

Returns the village styles in registration order.

const QList<QcTradeSet> &QcVillageCatalog::tradeSets() const

Returns the sets of offers in registration order.

template <typename Change> void QcVillageCatalog::updateStyle(qsizetype index, Change change)

Changes the style at index with change, called as change(QcVillageStyleDefinition &); its name stays (QcNamedList::update).

template <typename Change> void QcVillageCatalog::updateVillagerSpecies(Change change)

Changes every species with change, called as change(QcVillagerSettings &); the names stay (QcNamedList::update).

const QcVillagerSettings *QcVillageCatalog::villagerSettings(const QString &name) const

Returns the villager species name, or nullptr if there is none.

std::optional<qsizetype> QcVillageCatalog::villagerSettingsIndex(const QString &name) const

Returns the position of the species name in villagerSpecies(); none if there is none.

const QList<QcVillagerSettings> &QcVillageCatalog::villagerSpecies() const

Returns the villager species in registration order.