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

Method ServerClientJoined

src/openrct2/network/NetworkBase.cpp:2425–2450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2423 }
2424
2425 void NetworkBase::ServerClientJoined(std::string_view name, const std::string& keyhash, Connection& connection)
2426 {
2427 auto player = AddPlayer(std::string(name), keyhash);
2428 connection.player = player;
2429 if (player != nullptr)
2430 {
2431 char text[256];
2432 const char* player_name = static_cast<const char*>(player->name.c_str());
2433 FormatStringLegacy(text, 256, STR_MULTIPLAYER_PLAYER_HAS_JOINED_THE_GAME, &player_name);
2434 ChatAddHistory(text);
2435
2436 auto& context = GetContext();
2437 auto& objManager = context.GetObjectManager();
2438 auto objects = objManager.GetPackableObjects();
2439 ServerSendObjectsList(connection, objects);
2440 ServerSendScripts(connection);
2441
2442 // Log player joining event
2443 std::string playerNameHash = player->name + " (" + keyhash + ")";
2444 player_name = static_cast<const char*>(playerNameHash.c_str());
2445 FormatStringLegacy(text, 256, STR_MULTIPLAYER_PLAYER_HAS_JOINED_THE_GAME, &player_name);
2446 AppendServerLog(text);
2447
2448 ProcessPlayerJoinedPluginHooks(player->id);
2449 }
2450 }
2451
2452 void NetworkBase::ServerHandleToken(Connection& connection, [[maybe_unused]] Packet& packet)
2453 {

Callers

nothing calls this directly

Calls 6

FormatStringLegacyFunction · 0.85
ChatAddHistoryFunction · 0.85
GetContextFunction · 0.85
AppendServerLogFunction · 0.85
GetPackableObjectsMethod · 0.80

Tested by

no test coverage detected