summaryrefslogtreecommitdiff
path: root/src/bridge_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-05-22 14:12:48 +0000
committerrubidium <rubidium@openttd.org>2010-05-22 14:12:48 +0000
commit6328429aac8dede8e42226fb5938c5011dc1f052 (patch)
treeface314ccb3079a152bdb96e0b23843778a87396 /src/bridge_gui.cpp
parent03cacb797aa50a952cab1f38210b267d0db935db (diff)
downloadopenttd-6328429aac8dede8e42226fb5938c5011dc1f052.tar.xz
(svn r19881) -Fix [FS#3827]: pay for the rail/road when constructing tunnels and bridges
Diffstat (limited to 'src/bridge_gui.cpp')
-rw-r--r--src/bridge_gui.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp
index acdb95b5a..c11d7554f 100644
--- a/src/bridge_gui.cpp
+++ b/src/bridge_gui.cpp
@@ -14,6 +14,7 @@
#include "command_func.h"
#include "economy_func.h"
#include "bridge.h"
+#include "rail.h"
#include "strings_func.h"
#include "window_func.h"
#include "sound_func.h"
@@ -394,6 +395,13 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo
bl = new GUIBridgeList();
+ Money infra_cost = 0;
+ switch (transport_type) {
+ case TRANSPORT_ROAD: infra_cost = (bridge_len + 2) * _price[PR_BUILD_ROAD] * 2; break;
+ case TRANSPORT_RAIL: infra_cost = (bridge_len + 2) * RailBuildCost((RailType)road_rail_type); break;
+ default: break;
+ }
+
/* loop for all bridgetypes */
for (BridgeType brd_type = 0; brd_type != MAX_BRIDGES; brd_type++) {
if (CheckBridgeAvailability(brd_type, bridge_len).Succeeded()) {
@@ -403,7 +411,7 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo
item->spec = GetBridgeSpec(brd_type);
/* Add to terraforming & bulldozing costs the cost of the
* bridge itself (not computed with DC_QUERY_COST) */
- item->cost = ret.GetCost() + (((int64)tot_bridgedata_len * _price[PR_BUILD_BRIDGE] * item->spec->price) >> 8);
+ item->cost = ret.GetCost() + (((int64)tot_bridgedata_len * _price[PR_BUILD_BRIDGE] * item->spec->price) >> 8) + infra_cost;
}
}
}