summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-11-28 22:45:47 +0000
committerrubidium <rubidium@openttd.org>2010-11-28 22:45:47 +0000
commitc60a850fed077a5179d2e7095a509545d8782e53 (patch)
treed79de745f8eb5f5c200e1974f61afe0ff0a5a4f0 /src/network
parent2b258feee78d50d4c9895d2b5eb00073c5e3e04f (diff)
downloadopenttd-c60a850fed077a5179d2e7095a509545d8782e53.tar.xz
(svn r21350) -Fix: some indentation
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_server.cpp168
1 files changed, 84 insertions, 84 deletions
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index 9ccd4399d..705528727 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -1002,109 +1002,109 @@ void NetworkServerSendChat(NetworkAction action, DestType desttype, int dest, co
const NetworkClientInfo *ci, *ci_own, *ci_to;
switch (desttype) {
- case DESTTYPE_CLIENT:
- /* Are we sending to the server? */
- if ((ClientID)dest == CLIENT_ID_SERVER) {
- ci = NetworkFindClientInfoFromClientID(from_id);
- /* Display the text locally, and that is it */
- if (ci != NULL) {
- NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci->client_playas), false, ci->client_name, msg, data);
+ case DESTTYPE_CLIENT:
+ /* Are we sending to the server? */
+ if ((ClientID)dest == CLIENT_ID_SERVER) {
+ ci = NetworkFindClientInfoFromClientID(from_id);
+ /* Display the text locally, and that is it */
+ if (ci != NULL) {
+ NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci->client_playas), false, ci->client_name, msg, data);
- if (_settings_client.network.server_admin_chat) {
+ if (_settings_client.network.server_admin_chat) {
NetworkAdminChat(action, desttype, from_id, msg, data, from_admin);
- }
- }
- } else {
- /* Else find the client to send the message to */
- FOR_ALL_CLIENT_SOCKETS(cs) {
- if (cs->client_id == (ClientID)dest) {
- cs->SendChat(action, from_id, false, msg, data);
- break;
- }
- }
- }
-
- /* Display the message locally (so you know you have sent it) */
- if (from_id != (ClientID)dest) {
- if (from_id == CLIENT_ID_SERVER) {
- ci = NetworkFindClientInfoFromClientID(from_id);
- ci_to = NetworkFindClientInfoFromClientID((ClientID)dest);
- if (ci != NULL && ci_to != NULL) {
- NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci->client_playas), true, ci_to->client_name, msg, data);
+ }
}
} else {
+ /* Else find the client to send the message to */
FOR_ALL_CLIENT_SOCKETS(cs) {
- if (cs->client_id == from_id) {
- cs->SendChat(action, (ClientID)dest, true, msg, data);
+ if (cs->client_id == (ClientID)dest) {
+ cs->SendChat(action, from_id, false, msg, data);
break;
}
}
}
- }
- break;
- case DESTTYPE_TEAM: {
- /* If this is false, the message is already displayed on the client who sent it. */
- bool show_local = true;
- /* Find all clients that belong to this company */
- ci_to = NULL;
- FOR_ALL_CLIENT_SOCKETS(cs) {
- ci = cs->GetInfo();
- if (ci->client_playas == (CompanyID)dest) {
- cs->SendChat(action, from_id, false, msg, data);
- if (cs->client_id == from_id) show_local = false;
- ci_to = ci; // Remember a client that is in the company for company-name
+
+ /* Display the message locally (so you know you have sent it) */
+ if (from_id != (ClientID)dest) {
+ if (from_id == CLIENT_ID_SERVER) {
+ ci = NetworkFindClientInfoFromClientID(from_id);
+ ci_to = NetworkFindClientInfoFromClientID((ClientID)dest);
+ if (ci != NULL && ci_to != NULL) {
+ NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci->client_playas), true, ci_to->client_name, msg, data);
+ }
+ } else {
+ FOR_ALL_CLIENT_SOCKETS(cs) {
+ if (cs->client_id == from_id) {
+ cs->SendChat(action, (ClientID)dest, true, msg, data);
+ break;
+ }
+ }
+ }
+ }
+ break;
+ case DESTTYPE_TEAM: {
+ /* If this is false, the message is already displayed on the client who sent it. */
+ bool show_local = true;
+ /* Find all clients that belong to this company */
+ ci_to = NULL;
+ FOR_ALL_CLIENT_SOCKETS(cs) {
+ ci = cs->GetInfo();
+ if (ci->client_playas == (CompanyID)dest) {
+ cs->SendChat(action, from_id, false, msg, data);
+ if (cs->client_id == from_id) show_local = false;
+ ci_to = ci; // Remember a client that is in the company for company-name
+ }
}
- }
- /* if the server can read it, let the admin network read it, too. */
- if (_local_company == (CompanyID)dest && _settings_client.network.server_admin_chat) {
- NetworkAdminChat(action, desttype, from_id, msg, data, from_admin);
- }
+ /* if the server can read it, let the admin network read it, too. */
+ if (_local_company == (CompanyID)dest && _settings_client.network.server_admin_chat) {
+ NetworkAdminChat(action, desttype, from_id, msg, data, from_admin);
+ }
- ci = NetworkFindClientInfoFromClientID(from_id);
- ci_own = NetworkFindClientInfoFromClientID(CLIENT_ID_SERVER);
- if (ci != NULL && ci_own != NULL && ci_own->client_playas == dest) {
- NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci->client_playas), false, ci->client_name, msg, data);
- if (from_id == CLIENT_ID_SERVER) show_local = false;
- ci_to = ci_own;
- }
+ ci = NetworkFindClientInfoFromClientID(from_id);
+ ci_own = NetworkFindClientInfoFromClientID(CLIENT_ID_SERVER);
+ if (ci != NULL && ci_own != NULL && ci_own->client_playas == dest) {
+ NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci->client_playas), false, ci->client_name, msg, data);
+ if (from_id == CLIENT_ID_SERVER) show_local = false;
+ ci_to = ci_own;
+ }
- /* There is no such client */
- if (ci_to == NULL) break;
-
- /* Display the message locally (so you know you have sent it) */
- if (ci != NULL && show_local) {
- if (from_id == CLIENT_ID_SERVER) {
- char name[NETWORK_NAME_LENGTH];
- StringID str = Company::IsValidID(ci_to->client_playas) ? STR_COMPANY_NAME : STR_NETWORK_SPECTATORS;
- SetDParam(0, ci_to->client_playas);
- GetString(name, str, lastof(name));
- NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci_own->client_playas), true, name, msg, data);
- } else {
- FOR_ALL_CLIENT_SOCKETS(cs) {
- if (cs->client_id == from_id) {
- cs->SendChat(action, ci_to->client_id, true, msg, data);
+ /* There is no such client */
+ if (ci_to == NULL) break;
+
+ /* Display the message locally (so you know you have sent it) */
+ if (ci != NULL && show_local) {
+ if (from_id == CLIENT_ID_SERVER) {
+ char name[NETWORK_NAME_LENGTH];
+ StringID str = Company::IsValidID(ci_to->client_playas) ? STR_COMPANY_NAME : STR_NETWORK_SPECTATORS;
+ SetDParam(0, ci_to->client_playas);
+ GetString(name, str, lastof(name));
+ NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci_own->client_playas), true, name, msg, data);
+ } else {
+ FOR_ALL_CLIENT_SOCKETS(cs) {
+ if (cs->client_id == from_id) {
+ cs->SendChat(action, ci_to->client_id, true, msg, data);
+ }
}
}
}
+ break;
}
- break;
- }
- default:
- DEBUG(net, 0, "[server] received unknown chat destination type %d. Doing broadcast instead", desttype);
- /* FALL THROUGH */
- case DESTTYPE_BROADCAST:
- FOR_ALL_CLIENT_SOCKETS(cs) {
- cs->SendChat(action, from_id, false, msg, data);
- }
+ default:
+ DEBUG(net, 0, "[server] received unknown chat destination type %d. Doing broadcast instead", desttype);
+ /* FALL THROUGH */
+ case DESTTYPE_BROADCAST:
+ FOR_ALL_CLIENT_SOCKETS(cs) {
+ cs->SendChat(action, from_id, false, msg, data);
+ }
- NetworkAdminChat(action, desttype, from_id, msg, data, from_admin);
+ NetworkAdminChat(action, desttype, from_id, msg, data, from_admin);
- ci = NetworkFindClientInfoFromClientID(from_id);
- if (ci != NULL) {
- NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci->client_playas), false, ci->client_name, msg, data);
- }
- break;
+ ci = NetworkFindClientInfoFromClientID(from_id);
+ if (ci != NULL) {
+ NetworkTextMessage(action, (ConsoleColour)GetDrawStringCompanyColour(ci->client_playas), false, ci->client_name, msg, data);
+ }
+ break;
}
}