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

summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-07-02 02:02:25 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-07-02 02:02:25 +1000
commit2a610211a19bdd9554dd0f17f4754ed209eb717f (patch)
treeb72879cd5a79f10b198f31077f3d9d56500d5597 /source
parent17af21fd421429b7a64c93c8b09e3f9ea436069a (diff)
Correct UpdateWorldProperties handling on server
Diffstat (limited to 'source')
-rw-r--r--source/game/StarWorldServer.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/game/StarWorldServer.cpp b/source/game/StarWorldServer.cpp
index fd3f765..dffe057 100644
--- a/source/game/StarWorldServer.cpp
+++ b/source/game/StarWorldServer.cpp
@@ -482,7 +482,13 @@ void WorldServer::handleIncomingPackets(ConnectionId clientId, List<PacketPtr> c
clientInfo->outgoingPackets.append(make_shared<PongPacket>());
} else if (auto updateWorldProperties = as<UpdateWorldPropertiesPacket>(packet)) {
- m_worldProperties.merge(updateWorldProperties->updatedProperties, true);
+ // Kae: Properties set to null (nil from Lua) should be erased instead of lingering around
+ for (auto& pair : updateWorldProperties->updatedProperties) {
+ if (pair.second.isNull())
+ m_worldProperties.erase(pair.first);
+ else
+ m_worldProperties[pair.first] = pair.second;
+ }
for (auto const& pair : m_clientInfo)
pair.second->outgoingPackets.append(make_shared<UpdateWorldPropertiesPacket>(updateWorldProperties->updatedProperties));