mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r22699) -Fix [FS#4681]: Cost of adding an extra road type to a bridge or tunnel was undercalculated (adf88)
This commit is contained in:
parent
9c239bb988
commit
cfc2c5db42
|
@ -662,12 +662,14 @@ do_clear:;
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
cost.AddCost(CountBits(pieces) * _price[PR_BUILD_ROAD]);
|
|
||||||
|
|
||||||
if (!need_to_clear && IsTileType(tile, MP_TUNNELBRIDGE)) {
|
uint num_pieces = (!need_to_clear && IsTileType(tile, MP_TUNNELBRIDGE)) ?
|
||||||
/* Pay for *every* tile of the bridge or tunnel */
|
/* There are 2 pieces on *every* tile of the bridge or tunnel */
|
||||||
cost.MultiplyCost(GetTunnelBridgeLength(GetOtherTunnelBridgeEnd(tile), tile) + 2);
|
2 * (GetTunnelBridgeLength(GetOtherTunnelBridgeEnd(tile), tile) + 2) :
|
||||||
}
|
/* Count pieces */
|
||||||
|
CountBits(pieces);
|
||||||
|
|
||||||
|
cost.AddCost(num_pieces * _price[PR_BUILD_ROAD]);
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
|
|
Loading…
Reference in New Issue