Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarNetPackets.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2025-04-16 17:10:00 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2025-04-16 17:10:00 +1000
commitc59fceecf93895c7bd2b2bf9fe327dd79e9d0c51 (patch)
treec69342595e560116a03a35a35f1b0b2fa219f72f /source/game/StarNetPackets.cpp
parent7d1beb6ed8d125286ffa61e909f6389ae648e128 (diff)
add optional data for chat messages, for custom Chat panes to read from
Diffstat (limited to 'source/game/StarNetPackets.cpp')
-rw-r--r--source/game/StarNetPackets.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/game/StarNetPackets.cpp b/source/game/StarNetPackets.cpp
index dfe3ff1..0b9f6a3 100644
--- a/source/game/StarNetPackets.cpp
+++ b/source/game/StarNetPackets.cpp
@@ -495,14 +495,20 @@ ChatSendPacket::ChatSendPacket() : sendMode(ChatSendMode::Broadcast) {}
ChatSendPacket::ChatSendPacket(String text, ChatSendMode sendMode) : text(std::move(text)), sendMode(sendMode) {}
+ChatSendPacket::ChatSendPacket(String text, ChatSendMode sendMode, JsonObject data) : text(std::move(text)), sendMode(sendMode), data(std::move(data)) {}
+
void ChatSendPacket::read(DataStream& ds) {
ds.read(text);
ds.read(sendMode);
+ if (ds.streamCompatibilityVersion() >= 5)
+ ds.read(data);
}
void ChatSendPacket::write(DataStream& ds) const {
ds.write(text);
ds.write(sendMode);
+ if (ds.streamCompatibilityVersion() >= 5)
+ ds.write(data);
}
CelestialRequestPacket::CelestialRequestPacket() {}