QtCraft API C++ classes QML types Handbook

QcVillagerCodec Namespace

A villager's record as the villager component of its creature's entry (decisions E-411, E-414, E-420): its village, home, workstation, profession, level, experience, look, the crops it brought in (version 1), then the uses and demand of its offers and its last restock (version 2), then when it last slept (version 3, decision E-470). More...

Header: #include <server/storage/QcVillagerCodec.h>

Variables

const quint16 version

Functions

std::optional<QcVillagerRecord> read(QDataStream &stream, quint16 fileVersion)
void write(QDataStream &stream, const QcVillagerRecord &villager)

Detailed Description

Variable Documentation

const quint16 QcVillagerCodec::version

The current version of the villager component.

Function Documentation

std::optional<QcVillagerRecord> QcVillagerCodec::read(QDataStream &stream, quint16 fileVersion)

Returns the fields of version fileVersion (up to the current one) read from stream, defaults for those it lacks; std::nullopt for damaged data (a stream error, numbers out of range, a place outside the world).

void QcVillagerCodec::write(QDataStream &stream, const QcVillagerRecord &villager)

Writes the fields of villager of the current version to stream.