summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2008-01-13 22:27:06 +0000
committerglx <glx@openttd.org>2008-01-13 22:27:06 +0000
commit7d2d4314ec7c21cccff7c6a474b221d3d71e5ace (patch)
treef979f044d1412d6c2b3923da997e6d55eec479bd /src
parent311c14c9f5815b85785b335c4dccefc0ea97a045 (diff)
downloadopenttd-7d2d4314ec7c21cccff7c6a474b221d3d71e5ace.tar.xz
(svn r11844) -Fix: road vehicle count was incorrect in network lobby window
Diffstat (limited to 'src')
-rw-r--r--src/network/network_server.cpp33
1 files changed, 9 insertions, 24 deletions
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index 10d0c590b..24cc3aefe 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -8,8 +8,8 @@
#include "../strings_func.h"
#include "network_data.h"
#include "core/tcp.h"
-#include "../train.h"
-#include "../aircraft.h"
+#include "../vehicle_base.h"
+#include "../vehicle_func.h"
#include "../date_func.h"
#include "network_server.h"
#include "network_udp.h"
@@ -1302,30 +1302,15 @@ void NetworkPopulateCompanyInfo()
// Go through all vehicles and count the type of vehicles
FOR_ALL_VEHICLES(v) {
if (!IsValidPlayer(v->owner)) continue;
-
+ byte type = 0;
switch (v->type) {
- case VEH_TRAIN:
- if (IsFrontEngine(v)) _network_player_info[v->owner].num_vehicle[0]++;
- break;
-
- case VEH_ROAD:
- if (v->cargo_type != CT_PASSENGERS) {
- _network_player_info[v->owner].num_vehicle[1]++;
- } else {
- _network_player_info[v->owner].num_vehicle[2]++;
- }
- break;
-
- case VEH_AIRCRAFT:
- if (IsNormalAircraft(v)) _network_player_info[v->owner].num_vehicle[3]++;
- break;
-
- case VEH_SHIP:
- _network_player_info[v->owner].num_vehicle[4]++;
- break;
-
- default: break;
+ case VEH_TRAIN: type = 0; break;
+ case VEH_ROAD: type = (v->cargo_type != CT_PASSENGERS) ? 1 : 2; break;
+ case VEH_AIRCRAFT: type = 3; break;
+ case VEH_SHIP: type = 4; break;
+ default: continue;
}
+ if (IsEngineCountable(v)) _network_player_info[v->owner].num_vehicle[type]++;
}
// Go through all stations and count the types of stations