MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / ServerSendObjectsList

Method ServerSendObjectsList

src/openrct2/network/NetworkBase.cpp:1353–1385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1351 }
1352
1353 void NetworkBase::ServerSendObjectsList(
1354 Connection& connection, const std::vector<const ObjectRepositoryItem*>& objects) const
1355 {
1356 LOG_VERBOSE("Server sends objects list with %u items", objects.size());
1357
1358 Packet packet(Command::objectsList);
1359
1360 // Count.
1361 packet << static_cast<uint32_t>(objects.size());
1362
1363 // List
1364 for (size_t i = 0; i < objects.size(); ++i)
1365 {
1366 const auto* object = objects[i];
1367
1368 if (object->Identifier.empty())
1369 {
1370 // DAT
1371 LOG_VERBOSE("Object %.8s (checksum %x)", object->ObjectEntry.name, object->ObjectEntry.checksum);
1372 packet << static_cast<uint8_t>(0);
1373 packet.write(&object->ObjectEntry, sizeof(RCTObjectEntry));
1374 }
1375 else
1376 {
1377 // JSON
1378 LOG_VERBOSE("Object %s", object->Identifier.c_str());
1379 packet << static_cast<uint8_t>(1);
1380 packet.writeString(object->Identifier);
1381 }
1382 }
1383
1384 connection.queuePacket(std::move(packet));
1385 }
1386
1387 void NetworkBase::ServerSendScripts(Connection& connection)
1388 {

Callers

nothing calls this directly

Calls 5

queuePacketMethod · 0.80
writeMethod · 0.65
sizeMethod · 0.45
emptyMethod · 0.45
writeStringMethod · 0.45

Tested by

no test coverage detected