summaryrefslogtreecommitdiff
path: root/network_client.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2004-12-12 16:04:32 +0000
committertruelight <truelight@openttd.org>2004-12-12 16:04:32 +0000
commit0e79314353e7cf50677125c362835aabc475631c (patch)
treefca8d0b096bbb58854b3d8bb840a8213aa9f8395 /network_client.c
parent5221f35182beb396615dc8bcd2e902828a83aa65 (diff)
downloadopenttd-0e79314353e7cf50677125c362835aabc475631c.tar.xz
(svn r1026) -Add: [Network] Added unique id, so in network, each client has an
unique id (generated via md5)
Diffstat (limited to 'network_client.c')
-rw-r--r--network_client.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/network_client.c b/network_client.c
index 439942369..a40b7d708 100644
--- a/network_client.c
+++ b/network_client.c
@@ -53,6 +53,7 @@ DEF_CLIENT_SEND_COMMAND(PACKET_CLIENT_JOIN)
// String: Player Name (max NETWORK_NAME_LENGTH)
// uint8: Play as Player id (1..MAX_PLAYERS)
// uint8: Language ID
+ // String: Unique id to find the player back in server-listing
//
#if defined(WITH_REV)
@@ -69,6 +70,7 @@ DEF_CLIENT_SEND_COMMAND(PACKET_CLIENT_JOIN)
NetworkSend_string(p, _network_player_name); // Player name
NetworkSend_uint8(p, _network_playas); // Password
NetworkSend_uint8(p, NETLANG_ANY); // Language
+ NetworkSend_string(p, _network_unique_id);
NetworkSend_Packet(p, MY_CLIENT);
}
@@ -346,6 +348,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CLIENT_INFO)
ci->client_index = index;
ci->client_playas = NetworkRecv_uint8(p);
NetworkRecv_string(p, ci->client_name, sizeof(ci->client_name));
+ NetworkRecv_string(p, ci->unique_id, sizeof(ci->unique_id));
return NETWORK_RECV_STATUS_OKAY;
}
@@ -603,13 +606,13 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CHAT)
if (ci_to == NULL) return NETWORK_RECV_STATUS_OKAY;
if (action == NETWORK_ACTION_CHAT_TO_CLIENT) {
- snprintf(name, 80, "%s", ci_to->client_name);
+ snprintf(name, sizeof(name), "%s", ci_to->client_name);
ci = NetworkFindClientInfoFromIndex(_network_own_client_index);
} else if (action == NETWORK_ACTION_CHAT_TO_PLAYER) {
GetString(name, DEREF_PLAYER(ci_to->client_playas-1)->name_1);
ci = NetworkFindClientInfoFromIndex(_network_own_client_index);
} else {
- snprintf(name, 80, "%s", ci_to->client_name);
+ snprintf(name, sizeof(name), "%s", ci_to->client_name);
ci = ci_to;
}