diff options
author | rubidium <rubidium@openttd.org> | 2008-12-22 15:17:14 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-12-22 15:17:14 +0000 |
commit | 887869c771f9f210afb75b1b8e4f875eea3b9954 (patch) | |
tree | ceb1e314979bacc29ada2167708a82df6ab4b177 /src/network/network_client.cpp | |
parent | 782b80eff755afcf7d4b3c5f9237bc65457b4e16 (diff) | |
download | openttd-887869c771f9f210afb75b1b8e4f875eea3b9954.tar.xz |
(svn r14710) -Change: simplify sending company information from the server to the client.
Diffstat (limited to 'src/network/network_client.cpp')
-rw-r--r-- | src/network/network_client.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index 3c6f4dff1..5098a8f64 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -352,21 +352,13 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_BANNED) DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_COMPANY_INFO) { - byte company_info_version; - int i; - - company_info_version = p->Recv_uint8(); + byte company_info_version = p->Recv_uint8(); if (!MY_CLIENT->has_quit && company_info_version == NETWORK_COMPANY_INFO_VERSION) { - byte total; - CompanyID current; - - total = p->Recv_uint8(); - - // There is no data at all.. - if (total == 0) return NETWORK_RECV_STATUS_CLOSE_QUERY; + /* We have received all data... (there are no more packets coming) */ + if (!p->Recv_bool()) return NETWORK_RECV_STATUS_CLOSE_QUERY; - current = (Owner)p->Recv_uint8(); + CompanyID current = (Owner)p->Recv_uint8(); if (current >= MAX_COMPANIES) return NETWORK_RECV_STATUS_CLOSE_QUERY; p->Recv_string(_network_company_info[current].company_name, sizeof(_network_company_info[current].company_name)); @@ -376,9 +368,9 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_COMPANY_INFO) _network_company_info[current].income = p->Recv_uint64(); _network_company_info[current].performance = p->Recv_uint16(); _network_company_info[current].use_password = p->Recv_bool(); - for (i = 0; i < NETWORK_VEHICLE_TYPES; i++) + for (int i = 0; i < NETWORK_VEHICLE_TYPES; i++) _network_company_info[current].num_vehicle[i] = p->Recv_uint16(); - for (i = 0; i < NETWORK_STATION_TYPES; i++) + for (int i = 0; i < NETWORK_STATION_TYPES; i++) _network_company_info[current].num_station[i] = p->Recv_uint16(); p->Recv_string(_network_company_info[current].clients, sizeof(_network_company_info[current].clients)); |