MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / NetworkServerShowStatusToConsole

Function NetworkServerShowStatusToConsole

src/network/network_server.cpp:1925–1952  ·  view source on GitHub ↗

Show the status message of all clients on the console. */

Source from the content-addressed store, hash-verified

1923
1924/** Show the status message of all clients on the console. */
1925void NetworkServerShowStatusToConsole()
1926{
1927 static const std::string_view stat_str[] = {
1928 "inactive",
1929 "authorizing",
1930 "identifying client",
1931 "checking NewGRFs",
1932 "authorized",
1933 "waiting",
1934 "loading map",
1935 "map done",
1936 "ready",
1937 "active"
1938 };
1939 static_assert(lengthof(stat_str) == NetworkClientSocket::STATUS_END);
1940
1941 for (NetworkClientSocket *cs : NetworkClientSocket::Iterate()) {
1942 NetworkClientInfo *ci = cs->GetInfo();
1943 if (ci == nullptr) continue;
1944 uint lag = NetworkCalculateLag(cs);
1945
1946 std::string_view status = (cs->status < (ptrdiff_t)lengthof(stat_str) ? stat_str[cs->status] : "unknown");
1947 IConsolePrint(CC_INFO, "Client #{} name: '{}' status: '{}' frame-lag: {} company: {} IP: {}",
1948 cs->client_id, ci->client_name, status, lag,
1949 ci->client_playas + (Company::IsValidID(ci->client_playas) ? 1 : 0),
1950 cs->GetClientIP());
1951 }
1952}
1953
1954/**
1955 * Send Config Update

Callers 1

ConStatusFunction · 0.85

Calls 4

NetworkCalculateLagFunction · 0.85
GetClientIPMethod · 0.80
IConsolePrintFunction · 0.50
GetInfoMethod · 0.45

Tested by

no test coverage detected