Chunnel: Double cost of building and removing chunnels.

This commit is contained in:
Jonathan G Rennison
2017-03-05 14:38:23 +00:00
parent 89a0a9c182
commit 500ef49694

View File

@@ -804,6 +804,8 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, DoCommandFlag flags, uint32 p1,
default: NOT_REACHED(); default: NOT_REACHED();
} }
if (is_chunnel) cost.MultiplyCost(2);
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
Company *c = Company::GetIfValid(company); Company *c = Company::GetIfValid(company);
uint num_pieces = (tiles + 2) * TUNNELBRIDGE_TRACKBIT_FACTOR; uint num_pieces = (tiles + 2) * TUNNELBRIDGE_TRACKBIT_FACTOR;
@@ -919,6 +921,8 @@ static CommandCost DoClearTunnel(TileIndex tile, DoCommandFlag flags)
ChangeTownRating(t, RATING_TUNNEL_BRIDGE_DOWN_STEP, RATING_TUNNEL_BRIDGE_MINIMUM, flags); ChangeTownRating(t, RATING_TUNNEL_BRIDGE_DOWN_STEP, RATING_TUNNEL_BRIDGE_MINIMUM, flags);
} }
const bool is_chunnel = Tunnel::GetByTile(tile)->is_chunnel;
uint len = GetTunnelBridgeLength(tile, endtile) + 2; // Don't forget the end tiles. uint len = GetTunnelBridgeLength(tile, endtile) + 2; // Don't forget the end tiles.
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
@@ -974,7 +978,7 @@ static CommandCost DoClearTunnel(TileIndex tile, DoCommandFlag flags)
ViewportMapInvalidateTunnelCacheByTile(tile); ViewportMapInvalidateTunnelCacheByTile(tile);
ViewportMapInvalidateTunnelCacheByTile(endtile); ViewportMapInvalidateTunnelCacheByTile(endtile);
} }
return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_TUNNEL] * len); return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_TUNNEL] * len * (is_chunnel ? 2 : 1));
} }