summaryrefslogtreecommitdiff
path: root/src/network/network_udp.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-02-02 23:16:58 +0000
committerrubidium <rubidium@openttd.org>2007-02-02 23:16:58 +0000
commit500f9a971ac2d1a723fceaf499117de85396ff65 (patch)
treeece046363ec9db44c4f305a66b7863bd5113cfb2 /src/network/network_udp.cpp
parent9ddd227eb3757473bce23b4cafec894a4e4eaa36 (diff)
downloadopenttd-500f9a971ac2d1a723fceaf499117de85396ff65.tar.xz
(svn r8546) -Codechange: add a seperate (wrapper) functions to send/receive booleans.
Diffstat (limited to 'src/network/network_udp.cpp')
-rw-r--r--src/network/network_udp.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp
index 3517b4918..81f93d32d 100644
--- a/src/network/network_udp.cpp
+++ b/src/network/network_udp.cpp
@@ -124,7 +124,7 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_DETAIL_INFO)
packet.Send_uint16(_network_player_info[player->index].performance);
/* Send 1 if there is a passord for the company else send 0 */
- packet.Send_uint8 (StrEmpty(_network_player_info[player->index].password) ? 0 : 1);
+ packet.Send_bool (StrEmpty(_network_player_info[player->index].password));
for (i = 0; i < NETWORK_VEHICLE_TYPES; i++)
packet.Send_uint16(_network_player_info[player->index].num_vehicle[i]);
@@ -136,8 +136,7 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_DETAIL_INFO)
FOR_ALL_CLIENTS(cs) {
ci = DEREF_CLIENT_INFO(cs);
if (ci->client_playas == player->index) {
- /* The uint8 == 1 indicates that a client is following */
- packet.Send_uint8 (1);
+ packet.Send_bool (true);
packet.Send_string(ci->client_name);
packet.Send_string(ci->unique_id);
packet.Send_uint32(ci->join_date);
@@ -146,23 +145,21 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_DETAIL_INFO)
/* Also check for the server itself */
ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX);
if (ci->client_playas == player->index) {
- /* The uint8 == 1 indicates that a client is following */
- packet.Send_uint8 (1);
+ packet.Send_bool (true);
packet.Send_string(ci->client_name);
packet.Send_string(ci->unique_id);
packet.Send_uint32(ci->join_date);
}
/* Indicates end of client list */
- packet.Send_uint8(0);
+ packet.Send_bool(false);
}
/* And check if we have any spectators */
FOR_ALL_CLIENTS(cs) {
ci = DEREF_CLIENT_INFO(cs);
if (!IsValidPlayer(ci->client_playas)) {
- /* The uint8 == 1 indicates that a client is following */
- packet.Send_uint8 (1);
+ packet.Send_bool (true);
packet.Send_string(ci->client_name);
packet.Send_string(ci->unique_id);
packet.Send_uint32(ci->join_date);
@@ -172,15 +169,14 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_DETAIL_INFO)
/* Also check for the server itself */
ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX);
if (!IsValidPlayer(ci->client_playas)) {
- /* The uint8 == 1 indicates that a client is following */
- packet.Send_uint8 (1);
+ packet.Send_bool (true);
packet.Send_string(ci->client_name);
packet.Send_string(ci->unique_id);
packet.Send_uint32(ci->join_date);
}
/* Indicates end of client list */
- packet.Send_uint8(0);
+ packet.Send_bool(false);
this->SendPacket(&packet, client_addr);
}