QtCraft API C++ classes QML types Handbook

QcRailParser Namespace

Parses the rail fields of blocks (decisions E-382, E-384): what a rail does to carts ("railAction") and the states its track is made of. More...

Header: #include <common/content/blockbehaviour/QcRailParser.h>

Functions

void checkStates(const QcBlockDefinition &block, QcJsonFieldReader &reader)
QcRailAction parseAction(const QcBlockDefinition &block, QcJsonFieldReader &reader)

Detailed Description

Function Documentation

void QcRailParser::checkStates(const QcBlockDefinition &block, QcJsonFieldReader &reader)

Checks the rail block and fails reader on problems. A rail needs the states its track is made of (decision E-382): the direction it faces and its shape; a rail without the shape curve never bends (decision E-384). A rail that acts on carts needs its powered state and never bends. A rail is neither solid nor a liquid.

QcRailAction QcRailParser::parseAction(const QcBlockDefinition &block, QcJsonFieldReader &reader)

Returns the "railAction" read by reader for block (read so far, with its "rail" field): none, boost or activate; only a rail may have one. Failures go to reader.