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
commite8fad6334efe288fce5f04ffb180660ac1824373 (patch)
treef13180ca67399e77a530e8b7a7e505406c1f754b
parenta7c484f1ea3bbb61cc290ceeb34a595646d510cc (diff)
downloadopenttd-e8fad6334efe288fce5f04ffb180660ac1824373.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 */