mirror of https://github.com/OpenTTD/OpenTTD
(svn r14716) -Codechange: move more network core querying to the network files.
parent
5b7cd460e9
commit
573d1b324a
|
@ -638,19 +638,12 @@ DEF_CONSOLE_CMD(ConResetCompany)
|
||||||
|
|
||||||
DEF_CONSOLE_CMD(ConNetworkClients)
|
DEF_CONSOLE_CMD(ConNetworkClients)
|
||||||
{
|
{
|
||||||
NetworkClientInfo *ci;
|
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
IConsoleHelp("Get a list of connected clients including their ID, name, company-id, and IP. Usage: 'clients'");
|
IConsoleHelp("Get a list of connected clients including their ID, name, company-id, and IP. Usage: 'clients'");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FOR_ALL_ACTIVE_CLIENT_INFOS(ci) {
|
NetworkPrintClients();
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -974,4 +974,19 @@ bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio)
|
||||||
return false;
|
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 */
|
#endif /* ENABLE_NETWORK */
|
||||||
|
|
|
@ -42,6 +42,7 @@ void NetworkClientSendRcon(const char *password, const char *command);
|
||||||
void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const char *msg);
|
void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const char *msg);
|
||||||
void NetworkClientSetPassword(const char *password);
|
void NetworkClientSetPassword(const char *password);
|
||||||
bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio);
|
bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio);
|
||||||
|
void NetworkPrintClients();
|
||||||
|
|
||||||
/*** Commands ran by the server ***/
|
/*** Commands ran by the server ***/
|
||||||
void NetworkServerMonthlyLoop();
|
void NetworkServerMonthlyLoop();
|
||||||
|
|
Loading…
Reference in New Issue