(svn r23414) -Add: Company infrastructure counts for stations/airports.

This commit is contained in:
michi_cc
2011-12-03 23:40:30 +00:00
parent 796fe54a2f
commit bf5ef7537e
3 changed files with 35 additions and 3 deletions

View File

@@ -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: