summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2012-02-11 22:43:39 +0000
committermichi_cc <michi_cc@openttd.org>2012-02-11 22:43:39 +0000
commit0542e26460cf5da6fb4a3486ed9b515721bdb0bd (patch)
tree901640a66314b34ff1bc6a72b67dc288683a79c9 /src/script
parent1cf2f521ab32279b6770a79e7fb50ef5bbcd4011 (diff)
downloadopenttd-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.cpp6
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;
}