# HG changeset patch # User rubidium # Date 2008-12-22 21:26:26 # Node ID 3494bf73458c2cbdd58657e5329a65891a5daa44 # Parent 5fba179e6ffa8f3063e078a90af060a14ab43938 (svn r14716) -Codechange: move more network core querying to the network files. diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -638,19 +638,12 @@ DEF_CONSOLE_CMD(ConResetCompany) DEF_CONSOLE_CMD(ConNetworkClients) { - NetworkClientInfo *ci; - if (argc == 0) { IConsoleHelp("Get a list of connected clients including their ID, name, company-id, and IP. Usage: 'clients'"); return true; } - FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { - IConsolePrintF(CC_INFO, "Client #%1d name: '%s' company: %1d IP: %s", - ci->client_id, ci->client_name, - ci->client_playas + (IsValidCompanyID(ci->client_playas) ? 1 : 0), - GetClientIP(ci)); - } + NetworkPrintClients(); return true; } diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -974,4 +974,19 @@ bool NetworkClientPreferTeamChat(const N return false; } +/** + * Print all the clients to the console + */ +void NetworkPrintClients() +{ + NetworkClientInfo *ci; + FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { + IConsolePrintF(CC_INFO, "Client #%1d name: '%s' company: %1d IP: %s", + ci->client_id, + ci->client_name, + ci->client_playas + (IsValidCompanyID(ci->client_playas) ? 1 : 0), + GetClientIP(ci)); + } +} + #endif /* ENABLE_NETWORK */ diff --git a/src/network/network_func.h b/src/network/network_func.h --- a/src/network/network_func.h +++ b/src/network/network_func.h @@ -42,6 +42,7 @@ void NetworkClientSendRcon(const char *p void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const char *msg); void NetworkClientSetPassword(const char *password); bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio); +void NetworkPrintClients(); /*** Commands ran by the server ***/ void NetworkServerMonthlyLoop();