Changeset - r17891:a3152c92ad49
[Not reviewed]
master
0 2 0
rubidium - 13 years ago 2011-07-30 14:10:12
rubidium@openttd.org
(svn r22700) -Fix [FS#4680]: cost of changing bridge type is undercalculated when adding road types as well (based on patch by adf88)
2 files changed with 6 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/bridge_gui.cpp
Show inline comments
 
@@ -420,7 +420,11 @@ void ShowBuildBridgeWindow(TileIndex sta
 

	
 
		Money infra_cost = 0;
 
		switch (transport_type) {
 
			case TRANSPORT_ROAD: infra_cost = (bridge_len + 2) * _price[PR_BUILD_ROAD] * 2; break;
 
			case TRANSPORT_ROAD:
 
				infra_cost = (bridge_len + 2) * _price[PR_BUILD_ROAD] * 2;
 
				/* In case we add a new road type as well, we must be aware of those costs. */
 
				if (IsBridgeTile(start)) infra_cost *= CountBits(GetRoadTypes(start) | (RoadTypes)road_rail_type);
 
				break;
 
			case TRANSPORT_RAIL: infra_cost = (bridge_len + 2) * RailBuildCost((RailType)road_rail_type); break;
 
			default: break;
 
		}
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -474,7 +474,7 @@ CommandCost CmdBuildBridge(TileIndex end
 
		bridge_len += 2; // begin and end tiles/ramps
 

	
 
		switch (transport_type) {
 
			case TRANSPORT_ROAD: cost.AddCost(bridge_len * _price[PR_BUILD_ROAD] * 2); break;
 
			case TRANSPORT_ROAD: cost.AddCost(bridge_len * _price[PR_BUILD_ROAD] * 2 * CountBits(roadtypes)); break;
 
			case TRANSPORT_RAIL: cost.AddCost(bridge_len * RailBuildCost(railtype)); break;
 
			default: break;
 
		}
0 comments (0 inline, 0 general)