summaryrefslogtreecommitdiff
path: root/src/network/network_server.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-12-22 15:17:14 +0000
committerrubidium <rubidium@openttd.org>2008-12-22 15:17:14 +0000
commit887869c771f9f210afb75b1b8e4f875eea3b9954 (patch)
treeceb1e314979bacc29ada2167708a82df6ab4b177 /src/network/network_server.cpp
parent782b80eff755afcf7d4b3c5f9237bc65457b4e16 (diff)
downloadopenttd-887869c771f9f210afb75b1b8e4f875eea3b9954.tar.xz
(svn r14710) -Change: simplify sending company information from the server to the client.
Diffstat (limited to 'src/network/network_server.cpp')
-rw-r--r--src/network/network_server.cpp24
1 files changed, 5 insertions, 19 deletions
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index 0a4f35b4a..b4c8ef9d5 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -63,36 +63,22 @@ DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_CLIENT_INFO)(NetworkTCPSocketHandler
DEF_SERVER_SEND_COMMAND(PACKET_SERVER_COMPANY_INFO)
{
-//
+ //
// Packet: SERVER_COMPANY_INFO
// Function: Sends info about the companies
// Data:
//
- int i;
-
Company *company;
Packet *p;
- byte active = ActiveCompanyCount();
-
- if (active == 0) {
- p = NetworkSend_Init(PACKET_SERVER_COMPANY_INFO);
-
- p->Send_uint8 (NETWORK_COMPANY_INFO_VERSION);
- p->Send_uint8 (active);
-
- cs->Send_Packet(p);
- return;
- }
-
NetworkPopulateCompanyInfo();
FOR_ALL_COMPANIES(company) {
p = NetworkSend_Init(PACKET_SERVER_COMPANY_INFO);
p->Send_uint8 (NETWORK_COMPANY_INFO_VERSION);
- p->Send_uint8 (active);
+ p->Send_bool (true);
p->Send_uint8 (company->index);
p->Send_string(_network_company_info[company->index].company_name);
@@ -105,11 +91,11 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_COMPANY_INFO)
/* Send 1 if there is a passord for the company else send 0 */
p->Send_bool(!StrEmpty(_network_company_info[company->index].password));
- for (i = 0; i < NETWORK_VEHICLE_TYPES; i++) {
+ for (int i = 0; i < NETWORK_VEHICLE_TYPES; i++) {
p->Send_uint16(_network_company_info[company->index].num_vehicle[i]);
}
- for (i = 0; i < NETWORK_STATION_TYPES; i++) {
+ for (int i = 0; i < NETWORK_STATION_TYPES; i++) {
p->Send_uint16(_network_company_info[company->index].num_station[i]);
}
@@ -125,7 +111,7 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_COMPANY_INFO)
p = NetworkSend_Init(PACKET_SERVER_COMPANY_INFO);
p->Send_uint8 (NETWORK_COMPANY_INFO_VERSION);
- p->Send_uint8 (0);
+ p->Send_bool (false);
cs->Send_Packet(p);
}