QcSignTexts Class
The text on the signs of the loaded chunks (decision E-766): up to four lines per sign block, filed by chunk so that they are saved, unloaded and loaded with their chunk (QcBlockEntityRecord::Table::Signs), like the monster spawners. More...
| Header: | #include <server/blockentities/QcSignTexts.h> |
Public Types
Public Functions
| const QcSignTexts::Lines * | at(QcBlockPos pos) const |
| void | clear() |
| QString | colorAt(QcBlockPos pos) const |
| bool | contains(QcBlockPos pos) const |
| void | forgetChunk(QcChunkPos pos) |
| bool | isSign(QcBlockId block) const |
| void | noteBlock(QcBlockPos pos, QcBlockId after) |
| QList<QcBlockPos> | positionsIn(QcChunkPos pos) const |
| void | restore(const QList<QcSignTexts::Entry> &entries, const QcChunk &chunk) |
| QList<QcSignTexts::Entry> | savedOf(QcChunkPos pos) const |
| void | set(QcBlockPos pos, const QcSignTexts::Lines &lines) |
| void | setColor(QcBlockPos pos, const QString &color) |
| qsizetype | size() const |
| QList<QcBlockPos> | takeChanges() |
| QList<QcSignTexts::Entry> | takeChunk(QcChunkPos pos) |
Detailed Description
A sign also keeps the colour a dye gave its text (decision E-830); a sign without text in the default colour has no entry. Kept in step with the blocks by QcServerWorld: a block that is no sign any more loses its text (another state of a sign keeps it). Clients learn the text of each sign they see (QcMsg::SignText): after its chunk and whenever it changes.
Member Type Documentation
[alias] QcSignTexts::Lines
The lines of a sign's text (QcSignText::Lines).
Member Function Documentation
const QcSignTexts::Lines *QcSignTexts::at(QcBlockPos pos) const
Returns the lines at pos; null for a sign without an entry.
void QcSignTexts::clear()
Forgets every text.
QString QcSignTexts::colorAt(QcBlockPos pos) const
Returns the colour of the text at pos; empty for the default.
bool QcSignTexts::contains(QcBlockPos pos) const
Returns whether the sign at pos has an entry.
void QcSignTexts::forgetChunk(QcChunkPos pos)
Forgets the texts of the chunk at pos (it left the world or was generated again).
bool QcSignTexts::isSign(QcBlockId block) const
Returns whether block is a sign state.
void QcSignTexts::noteBlock(QcBlockPos pos, QcBlockId after)
The block at pos changed to after (QcServerWorld::setBlock): no sign, no text.
QList<QcBlockPos> QcSignTexts::positionsIn(QcChunkPos pos) const
Returns the positions of the entries in the chunk at pos.
void QcSignTexts::restore(const QList<QcSignTexts::Entry> &entries, const QcChunk &chunk)
Puts back the saved entries where chunk still has a sign block (others are dropped), cleaned again to that block's line count and line length (QcSignText::cleaned); an unknown colour becomes the default.
QList<QcSignTexts::Entry> QcSignTexts::savedOf(QcChunkPos pos) const
Returns the entries of the chunk at pos in position order, to be saved.
void QcSignTexts::set(QcBlockPos pos, const QcSignTexts::Lines &lines)
Sets the text of the sign at pos to lines and keeps its colour; the caller checked the block and cleaned the lines. A changed text is announced to the clients.
void QcSignTexts::setColor(QcBlockPos pos, const QString &color)
Sets the color of the text of the sign at pos (QcSignText::colorOfDye) and keeps its lines; the caller checked the block. A changed colour is announced to the clients.
qsizetype QcSignTexts::size() const
Returns the number of entries.
QList<QcBlockPos> QcSignTexts::takeChanges()
Returns the signs whose text changed, appeared or went since the last call, in position order.
QList<QcSignTexts::Entry> QcSignTexts::takeChunk(QcChunkPos pos)
Returns the entries of the chunk at pos like savedOf() and forgets them.