summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2011-12-03 23:40:30 +0000
committermichi_cc <michi_cc@openttd.org>2011-12-03 23:40:30 +0000
commitf98312eb77e12cfa45de40a1b4e8359160b0d9ff (patch)
tree53fea08ea695e8fa2474ace5095d03deb8b84fd4 /src/saveload
parentc06bbb48634ce7b34c53fed37cfebf47248dcdc5 (diff)
downloadopenttd-f98312eb77e12cfa45de40a1b4e8359160b0d9ff.tar.xz
(svn r23414) -Add: Company infrastructure counts for stations/airports.
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/company_sl.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/saveload/company_sl.cpp b/src/saveload/company_sl.cpp
index a51c32d7e..5b0e62377 100644
--- a/src/saveload/company_sl.cpp
+++ b/src/saveload/company_sl.cpp
@@ -18,6 +18,7 @@
#include "../station_map.h"
#include "../tunnelbridge_map.h"
#include "../tunnelbridge.h"
+#include "../station_base.h"
#include "saveload.h"
@@ -98,6 +99,14 @@ void AfterLoadCompanyStats()
Company *c;
FOR_ALL_COMPANIES(c) MemSetT(&c->infrastructure, 0);
+ /* Collect airport count. */
+ Station *st;
+ FOR_ALL_STATIONS(st) {
+ if ((st->facilities & FACIL_AIRPORT) && Company::IsValidID(st->owner)) {
+ Company::Get(st->owner)->infrastructure.airport++;
+ }
+ }
+
for (TileIndex tile = 0; tile < MapSize(); tile++) {
switch (GetTileType(tile)) {
case MP_RAILWAY:
@@ -133,6 +142,7 @@ void AfterLoadCompanyStats()
case MP_STATION:
c = Company::GetIfValid(GetTileOwner(tile));
+ if (c != NULL && GetStationType(tile) != STATION_AIRPORT) c->infrastructure.station++;
switch (GetStationType(tile)) {
case STATION_RAIL: