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/company_gui.cpp | |
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/company_gui.cpp')
-rw-r--r-- | src/company_gui.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 6e24afa98..6804e98d1 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -1588,8 +1588,9 @@ struct CompanyInfrastructureWindow : Window const Company *c = Company::Get((CompanyID)this->window_number); Money total; + uint32 rail_total = c->infrastructure.GetRailTotal(); for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) { - if (HasBit(this->railtypes, rt)) total += RailMaintenanceCost(rt, c->infrastructure.rail[rt]); + if (HasBit(this->railtypes, rt)) total += RailMaintenanceCost(rt, c->infrastructure.rail[rt], rail_total); } total += SignalMaintenanceCost(c->infrastructure.signal); @@ -1675,9 +1676,10 @@ struct CompanyInfrastructureWindow : Window /* Find the maximum count that is displayed. */ uint32 max_val = 1000; // Some random number to reserve enough space. Money max_cost = 10000; // Some random number to reserve enough space. + uint32 rail_total = c->infrastructure.GetRailTotal(); for (RailType rt = RAILTYPE_BEGIN; rt < RAILTYPE_END; rt++) { max_val = max(max_val, c->infrastructure.rail[rt]); - max_cost = max(max_cost, RailMaintenanceCost(rt, c->infrastructure.rail[rt])); + max_cost = max(max_cost, RailMaintenanceCost(rt, c->infrastructure.rail[rt], rail_total)); } max_val = max(max_val, c->infrastructure.signal); max_cost = max(max_cost, SignalMaintenanceCost(c->infrastructure.signal)); @@ -1739,12 +1741,13 @@ struct CompanyInfrastructureWindow : Window break; - case WID_CI_RAIL_COUNT: + case WID_CI_RAIL_COUNT: { /* Draw infrastructure count for each valid railtype. */ + uint32 rail_total = c->infrastructure.GetRailTotal(); for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) { if (HasBit(this->railtypes, rt)) { SetDParam(0, c->infrastructure.rail[rt]); - SetDParam(1, RailMaintenanceCost(rt, c->infrastructure.rail[rt]) * 12); // Convert to per year + SetDParam(1, RailMaintenanceCost(rt, c->infrastructure.rail[rt], rail_total) * 12); // Convert to per year DrawString(r.left, r.right, y += FONT_HEIGHT_NORMAL, _settings_game.economy.infrastructure_maintenance ? STR_COMPANY_INFRASTRUCTURE_VIEW_COST : STR_WHITE_COMMA); } } @@ -1754,6 +1757,7 @@ struct CompanyInfrastructureWindow : Window DrawString(r.left, r.right, y += FONT_HEIGHT_NORMAL, _settings_game.economy.infrastructure_maintenance ? STR_COMPANY_INFRASTRUCTURE_VIEW_COST : STR_WHITE_COMMA); } break; + } case WID_CI_ROAD_DESC: DrawString(r.left, r.right, y, STR_COMPANY_INFRASTRUCTURE_VIEW_ROAD_SECT); |