1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-20 13:09:15 +00:00

(svn r14715) -Codechange: move some network code from the main gui file into one of the the network files.

This commit is contained in:
rubidium
2008-12-22 21:15:02 +00:00
parent a687667448
commit 5b7cd460e9
3 changed files with 20 additions and 14 deletions

View File

@@ -956,4 +956,22 @@ void NetworkClientSetPassword(const char *password)
SEND_COMMAND(PACKET_CLIENT_SET_PASSWORD)(password);
}
/**
* Tell whether the client has team members where he/she can chat to.
* @param cio client to check members of.
* @return true if there is at least one team member.
*/
bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio)
{
/* Only companies actually playing can speak to team. Eg spectators cannot */
if (!_settings_client.gui.prefer_teamchat || !IsValidCompanyID(cio->client_playas)) return false;
const NetworkClientInfo *ci;
FOR_ALL_ACTIVE_CLIENT_INFOS(ci) {
if (ci->client_playas == cio->client_playas && ci != cio) return true;
}
return false;
}
#endif /* ENABLE_NETWORK */

View File

@@ -41,6 +41,7 @@ bool NetworkClientConnectGame(const char *host, uint16 port);
void NetworkClientSendRcon(const char *password, const char *command);
void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const char *msg);
void NetworkClientSetPassword(const char *password);
bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio);
/*** Commands ran by the server ***/
void NetworkServerMonthlyLoop();