QcBlockIndex Class
The exact positions of the loaded blocks of some marked states (Signal Hoppers, decision E-344), kept up to date as chunks arrive and blocks are set, so that a tick never scans sections for them. More...
| Header: | #include <server/chunks/QcBlockIndex.h> |
Public Functions
| QcBlockIndex() | |
| QcBlockIndex(std::vector<bool> marked) | |
| bool | contains(QcBlockPos pos) const |
| void | forgetChunk(QcChunkPos pos) |
| bool | isMarked(QcBlockId block) const |
| void | noteBlock(QcBlockPos pos, QcBlockId block) |
| void | noteChunk(QcChunkPos pos, const QcChunk &chunk) |
| qsizetype | size() const |
| QList<QcBlockPos> | takeTouched() |
Detailed Description
It also notes the cells whose block changed on or next to an indexed block ("touched"), so that sleeping hoppers wake only when something around them changed.
Member Function Documentation
[noexcept default] QcBlockIndex::QcBlockIndex()
Default-constructs an instance of QcBlockIndex.
[explicit] QcBlockIndex::QcBlockIndex(std::vector<bool> marked)
marked is indexed by block state id.
bool QcBlockIndex::contains(QcBlockPos pos) const
Returns whether an indexed block is at pos.
void QcBlockIndex::forgetChunk(QcChunkPos pos)
Forgets the positions of the chunk pos that left the world.
bool QcBlockIndex::isMarked(QcBlockId block) const
Returns whether the state block is indexed.
void QcBlockIndex::noteBlock(QcBlockPos pos, QcBlockId block)
The block block was set at pos: adds or removes the position and notes the cell as touched when an indexed block is at it or next to it.
void QcBlockIndex::noteChunk(QcChunkPos pos, const QcChunk &chunk)
Replaces the positions of chunk at pos that entered the world; only sections whose palette holds a marked state are scanned. The new positions count as touched.
qsizetype QcBlockIndex::size() const
Returns the number of indexed positions.
QList<QcBlockPos> QcBlockIndex::takeTouched()
Returns the cells touched since the last call.