summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-10-24 22:27:10 +0000
committerDarkvater <darkvater@openttd.org>2006-10-24 22:27:10 +0000
commit55cdf3f6ab8a36e7cc87db59739ef214182f5e40 (patch)
treef13180ca67399e77a530e8b7a7e505406c1f754b
parent2b8530507d4b930ecb734ea3c0db8beb5192d6b1 (diff)
downloadopenttd-55cdf3f6ab8a36e7cc87db59739ef214182f5e40.tar.xz
(svn r6934) -Cleanup: Some minor cleanup for network_client and removing 'stupid' comment
-rw-r--r--network_client.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/network_client.c b/network_client.c
index b5e9b34c7..d8265771c 100644
--- a/network_client.c
+++ b/network_client.c
@@ -601,25 +601,22 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_COMMAND)
DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CHAT)
{
- NetworkAction action = NetworkRecv_uint8(MY_CLIENT, p);
- char msg[MAX_TEXT_MSG_LEN];
+ char name[NETWORK_NAME_LENGTH], msg[MAX_TEXT_MSG_LEN];
const NetworkClientInfo *ci = NULL, *ci_to;
- uint16 index;
- char name[NETWORK_NAME_LENGTH];
- bool self_send;
- index = NetworkRecv_uint16(MY_CLIENT, p);
- self_send = NetworkRecv_uint8(MY_CLIENT, p);
+ NetworkAction action = NetworkRecv_uint8(MY_CLIENT, p);
+ uint16 index = NetworkRecv_uint16(MY_CLIENT, p);
+ bool self_send = NetworkRecv_uint8(MY_CLIENT, p);
NetworkRecv_string(MY_CLIENT, p, msg, MAX_TEXT_MSG_LEN);
ci_to = NetworkFindClientInfoFromIndex(index);
if (ci_to == NULL) return NETWORK_RECV_STATUS_OKAY;
- /* Do we display the action locally? */
+ /* Did we initiate the action locally? */
if (self_send) {
switch (action) {
case NETWORK_ACTION_CHAT_CLIENT:
- /* For speak to client we need the client-name */
+ /* For speaking to client we need the client-name */
snprintf(name, sizeof(name), "%s", ci_to->client_name);
ci = NetworkFindClientInfoFromIndex(_network_own_client_index);
break;
@@ -634,10 +631,8 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CHAT)
GetString(name, str, lastof(name));
ci = NetworkFindClientInfoFromIndex(_network_own_client_index);
} break;
- default:
- /* This should never happen */
- NOT_REACHED();
- break;
+
+ default: NOT_REACHED(); break;
}
} else {
/* Display message from somebody else */