diff options
author | michi_cc <michi_cc@openttd.org> | 2012-02-11 22:43:39 +0000 |
---|---|---|
committer | michi_cc <michi_cc@openttd.org> | 2012-02-11 22:43:39 +0000 |
commit | 0542e26460cf5da6fb4a3486ed9b515721bdb0bd (patch) | |
tree | 901640a66314b34ff1bc6a72b67dc288683a79c9 /src/script | |
parent | 1cf2f521ab32279b6770a79e7fb50ef5bbcd4011 (diff) | |
download | openttd-0542e26460cf5da6fb4a3486ed9b515721bdb0bd.tar.xz |
(svn r23931) -Change: Scale infrastructure cost of rail tracks by the total number of all tracks and not independently for each rail type.
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/api/script_infrastructure.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/script/api/script_infrastructure.cpp b/src/script/api/script_infrastructure.cpp index 2b1e203c8..1ce051bba 100644 --- a/src/script/api/script_infrastructure.cpp +++ b/src/script/api/script_infrastructure.cpp @@ -79,7 +79,8 @@ company = ScriptCompany::ResolveCompanyID(company); if (company == ScriptCompany::COMPANY_INVALID || (::RailType)railtype >= RAILTYPE_END || !_settings_game.economy.infrastructure_maintenance) return 0; - return ::RailMaintenanceCost((::RailType)railtype, ::Company::Get((::CompanyID)company)->infrastructure.rail[railtype]); + const ::Company *c = ::Company::Get((::CompanyID)company); + return ::RailMaintenanceCost((::RailType)railtype, c->infrastructure.rail[railtype], c->infrastructure.GetRailTotal()); } /* static */ Money ScriptInfrastructure::GetMonthlyRoadCosts(ScriptCompany::CompanyID company, ScriptRoad::RoadType roadtype) @@ -99,8 +100,9 @@ switch (infra_type) { case INFRASTRUCTURE_RAIL: { Money cost; + uint32 rail_total = c->infrastructure.GetRailTotal(); for (::RailType rt = ::RAILTYPE_BEGIN; rt != ::RAILTYPE_END; rt++) { - cost += RailMaintenanceCost(rt, c->infrastructure.rail[rt]); + cost += RailMaintenanceCost(rt, c->infrastructure.rail[rt], rail_total); } return cost; } |