diff options
author | rubidium <rubidium@openttd.org> | 2008-12-22 18:40:57 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-12-22 18:40:57 +0000 |
commit | abc903d62539333ea5039ed152de07f174617a84 (patch) | |
tree | 68a45cb9d1b5a0a6ab29d8cdecc736cd6dbae7ea /src/network/network_udp.cpp | |
parent | e6e32bad4d160c67f1c589edd25af423529845c2 (diff) | |
download | openttd-abc903d62539333ea5039ed152de07f174617a84.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.cpp | 28 |
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); |