QtCraft API C++ classes QML types Handbook

QcBlockSerializer Namespace

Wire format of one block definition in the content sync, with its resolved shape. More...

Header: #include <common/content/blocks/QcBlockSerializer.h>

Functions

bool plausibleFuel(double seconds)
std::optional<QcBlockDefinition> readBlock(QDataStream &stream)
void writeBlock(QDataStream &stream, const QcBlockDefinition &block, const QcShapeDefinition &shape)

Detailed Description

Reading validates everything that later feeds physics, light and the mesher.

Function Documentation

bool QcBlockSerializer::plausibleFuel(double seconds)

Returns whether seconds is a fuel time the parser allows (finite, 0 to 100000).

std::optional<QcBlockDefinition> QcBlockSerializer::readBlock(QDataStream &stream)

Returns the block read from stream, which carries the read shape inline; std::nullopt (and possibly a corrupt stream) on bad data.

void QcBlockSerializer::writeBlock(QDataStream &stream, const QcBlockDefinition &block, const QcShapeDefinition &shape)

Writes the parts of block that reach the client to stream, with shape in place of its own shape.