From f98312eb77e12cfa45de40a1b4e8359160b0d9ff Mon Sep 17 00:00:00 2001 From: michi_cc Date: Sat, 3 Dec 2011 23:40:30 +0000 Subject: (svn r23414) -Add: Company infrastructure counts for stations/airports. --- src/saveload/company_sl.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/saveload') 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: -- cgit v1.2.3-54-g00ecf