summaryrefslogtreecommitdiff
path: root/src/network/network_udp.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-12-22 18:40:57 +0000
committerrubidium <rubidium@openttd.org>2008-12-22 18:40:57 +0000
commitd146b48063d3c20c78703ef615979cf2a984b761 (patch)
tree68a45cb9d1b5a0a6ab29d8cdecc736cd6dbae7ea /src/network/network_udp.cpp
parentc3939135638ac957661a94300076923318192013 (diff)
downloadopenttd-d146b48063d3c20c78703ef615979cf2a984b761.tar.xz
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
Diffstat (limited to 'src/network/network_udp.cpp')
-rw-r--r--src/network/network_udp.cpp28
1 files changed, 4 insertions, 24 deletions
diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp
index 210a117ad..430eee925 100644
--- a/src/network/network_udp.cpp
+++ b/src/network/network_udp.cpp
@@ -118,35 +118,15 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_DETAIL_INFO)
packet.Send_uint8 (NETWORK_COMPANY_INFO_VERSION);
packet.Send_uint8 (ActiveCompanyCount());
- /* Fetch the latest version of everything */
- NetworkPopulateCompanyInfo();
+ /* Fetch the latest version of the stats */
+ NetworkCompanyStats company_stats[MAX_COMPANIES];
+ NetworkPopulateCompanyStats(company_stats);
Company *company;
- byte current = 0;
/* Go through all the companies */
FOR_ALL_COMPANIES(company) {
- current++;
-
/* Send the information */
- packet.Send_uint8 (current);
-
- packet.Send_string(_network_company_info[company->index].company_name);
- packet.Send_uint32(_network_company_info[company->index].inaugurated_year);
- packet.Send_uint64(_network_company_info[company->index].company_value);
- packet.Send_uint64(_network_company_info[company->index].money);
- packet.Send_uint64(_network_company_info[company->index].income);
- packet.Send_uint16(_network_company_info[company->index].performance);
-
- /* Send 1 if there is a passord for the company else send 0 */
- packet.Send_bool (!StrEmpty(_network_company_info[company->index].password));
-
- for (int i = 0; i < NETWORK_VEHICLE_TYPES; i++) {
- packet.Send_uint16(_network_company_info[company->index].num_vehicle[i]);
- }
-
- for (int i = 0; i < NETWORK_STATION_TYPES; i++) {
- packet.Send_uint16(_network_company_info[company->index].num_station[i]);
- }
+ this->Send_CompanyInformation(&packet, company, &company_stats[company->index]);
}
this->SendPacket(&packet, client_addr);