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

Method ServerSendScripts

src/openrct2/network/NetworkBase.cpp:1387–1415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1385 }
1386
1387 void NetworkBase::ServerSendScripts(Connection& connection)
1388 {
1389 Packet packet(Command::scriptsData);
1390
1391 #ifdef ENABLE_SCRIPTING
1392 using namespace OpenRCT2::Scripting;
1393
1394 auto& scriptEngine = GetContext().GetScriptEngine();
1395
1396 // Get remote plugin list.
1397 const auto remotePlugins = scriptEngine.GetRemotePlugins();
1398 LOG_VERBOSE("Server sends %zu scripts", remotePlugins.size());
1399
1400 packet << static_cast<uint32_t>(remotePlugins.size());
1401
1402 for (auto& plugin : remotePlugins)
1403 {
1404 const auto& code = plugin->GetCode();
1405 const auto codeSize = static_cast<uint32_t>(code.size());
1406
1407 packet << codeSize;
1408 packet.write(code.c_str(), code.size());
1409 }
1410 #else
1411 packet << static_cast<uint32_t>(0);
1412 #endif
1413
1414 connection.queuePacket(std::move(packet));
1415 }
1416
1417 void NetworkBase::Client_Send_HEARTBEAT(Connection& connection) const
1418 {

Callers

nothing calls this directly

Calls 5

GetContextFunction · 0.85
GetRemotePluginsMethod · 0.80
queuePacketMethod · 0.80
writeMethod · 0.65
sizeMethod · 0.45

Tested by

no test coverage detected