static */
| 83 | } |
| 84 | |
| 85 | /* static */ Money ScriptInfrastructure::GetMonthlyInfrastructureCosts(ScriptCompany::CompanyID company, Infrastructure infra_type) |
| 86 | { |
| 87 | company = ScriptCompany::ResolveCompanyID(company); |
| 88 | if (company == ScriptCompany::COMPANY_INVALID || !_settings_game.economy.infrastructure_maintenance) return 0; |
| 89 | |
| 90 | const ::Company *c = ::Company::Get(ScriptCompany::FromScriptCompanyID(company)); |
| 91 | switch (infra_type) { |
| 92 | case INFRASTRUCTURE_RAIL: { |
| 93 | Money cost; |
| 94 | uint32_t rail_total = c->infrastructure.GetRailTotal(); |
| 95 | for (::RailType rt = ::RAILTYPE_BEGIN; rt != ::RAILTYPE_END; rt++) { |
| 96 | cost += RailMaintenanceCost(rt, c->infrastructure.rail[rt], rail_total); |
| 97 | } |
| 98 | return cost; |
| 99 | } |
| 100 | |
| 101 | case INFRASTRUCTURE_SIGNALS: |
| 102 | return SignalMaintenanceCost(c->infrastructure.signal); |
| 103 | |
| 104 | case INFRASTRUCTURE_ROAD: { |
| 105 | Money cost; |
| 106 | uint32_t road_total = c->infrastructure.GetRoadTotal(); |
| 107 | uint32_t tram_total = c->infrastructure.GetTramTotal(); |
| 108 | for (::RoadType rt = ::ROADTYPE_BEGIN; rt != ::ROADTYPE_END; rt++) { |
| 109 | cost += RoadMaintenanceCost(rt, c->infrastructure.road[rt], RoadTypeIsRoad(rt) ? road_total : tram_total); |
| 110 | } |
| 111 | return cost; |
| 112 | } |
| 113 | |
| 114 | case INFRASTRUCTURE_CANAL: |
| 115 | return CanalMaintenanceCost(c->infrastructure.water); |
| 116 | |
| 117 | case INFRASTRUCTURE_STATION: |
| 118 | return StationMaintenanceCost(c->infrastructure.station); |
| 119 | |
| 120 | case INFRASTRUCTURE_AIRPORT: |
| 121 | return AirportMaintenanceCost(c->index); |
| 122 | |
| 123 | default: |
| 124 | return 0; |
| 125 | } |
| 126 | } |
nothing calls this directly
no test coverage detected