QtCraft API C++ classes QML types Handbook

QcTickSystems Class

The systems of the server tick as one list (decision E-700). More...

Header: #include <server/tick/QcTickSystems.h>

Public Types

struct System
enum class When { Always, Simulating }

Public Functions

void add(QcTickPhase phase, QcTickSystems::When when, std::function<void ()> run)
void run(bool simulating, QcTickPhaseTimer &timer) const
const std::vector<QcTickSystems::System> &systems() const

Detailed Description

A system is one entry point with the phase its time goes to (QcTickPhase, whose id names it in the phase timing, the debug display, the /tick and /worldinfo reports and the BENCH line) and the condition it runs under. The systems run in the order they were added; a phase may have several systems. The server builds the list once; it lives in the server's thread.

Member Type Documentation

enum class QcTickSystems::When

When a system runs.

ConstantValueDescription
QcTickSystems::When::Always0In every tick, also in a frozen world (players, saving, chunks, the clients).
QcTickSystems::When::Simulating1Only in ticks that simulate the world (not frozen, or a /tick step; decision E-249).

Member Function Documentation

void QcTickSystems::add(QcTickPhase phase, QcTickSystems::When when, std::function<void ()> run)

Adds the system run of phase, running when, after the others. Messages is no phase of the tick and is refused.

void QcTickSystems::run(bool simulating, QcTickPhaseTimer &timer) const

Runs one tick's systems in order (those of When::Simulating only when simulating); after each its phase gets a lap of timer. A system that laps another phase inside (the client sync laps the streaming per client) gives the rest to its own.

const std::vector<QcTickSystems::System> &QcTickSystems::systems() const

Returns the systems in the order they run.