MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / queueUpdatePackets

Method queueUpdatePackets

source/game/StarSystemWorldServer.cpp:262–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260}
261
262void SystemWorldServer::queueUpdatePackets() {
263 for (auto clientId : m_clientNetVersions.keys()) {
264 auto versions = m_clientNetVersions.ptr(clientId);
265
266 HashMap<Uuid, ByteArray> shipUpdates;
267 for (auto ship : m_ships.values()) {
268 uint64_t version = versions->ships.maybe(ship->uuid()).value(0);
269 auto shipUpdate = ship->writeNetState(version, {});
270 versions->ships.set(ship->uuid(), shipUpdate.second);
271 if (!shipUpdate.first.empty())
272 shipUpdates.set(ship->uuid(), shipUpdate.first);
273 }
274
275 HashMap<Uuid, ByteArray> objectUpdates;
276 for (auto object : m_objects.values()) {
277 uint64_t version = versions->objects.maybe(object->uuid()).value(0);
278 auto objectUpdate = object->writeNetState(version, {});
279 versions->objects.set(object->uuid(), objectUpdate.second);
280 if (!objectUpdate.first.empty())
281 objectUpdates.set(object->uuid(), objectUpdate.first);
282 }
283 m_outgoingPackets[clientId].append(make_shared<SystemWorldUpdatePacket>(objectUpdates, shipUpdates));
284 }
285}
286
287void SystemWorldServer::handleIncomingPacket(ConnectionId, PacketPtr packet) {
288 if (auto objectSpawn = as<SystemObjectSpawnPacket>(packet)) {

Callers

nothing calls this directly

Calls 10

keysMethod · 0.45
ptrMethod · 0.45
valuesMethod · 0.45
valueMethod · 0.45
maybeMethod · 0.45
uuidMethod · 0.45
writeNetStateMethod · 0.45
setMethod · 0.45
emptyMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected