Show the status message of all clients on the console. */
| 1923 | |
| 1924 | /** Show the status message of all clients on the console. */ |
| 1925 | void 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 |
no test coverage detected