summaryrefslogtreecommitdiff
path: root/tunnelbridge_cmd.c
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2005-01-20 09:12:20 +0000
committercelestar <celestar@openttd.org>2005-01-20 09:12:20 +0000
commitf8345b3fe6f2b5a9ce2ae53106ef454b1dad8fe5 (patch)
treefb6ae5cc23f30a9c645121dd573e3caf4f30fc0d /tunnelbridge_cmd.c
parentf0e616ea2bb0f1a4f15feb8cb4d065de254dc905 (diff)
downloadopenttd-f8345b3fe6f2b5a9ce2ae53106ef454b1dad8fe5.tar.xz
(svn r1574) -Fix [ 1105281 ] upgrade rail fails when train under bridge
Diffstat (limited to 'tunnelbridge_cmd.c')
-rw-r--r--tunnelbridge_cmd.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c
index 307ab5aee..e6ae13b89 100644
--- a/tunnelbridge_cmd.c
+++ b/tunnelbridge_cmd.c
@@ -864,17 +864,25 @@ int32 DoConvertTunnelBridgeRail(uint tile, uint totype, bool exec)
} else if ((_map5[tile]&0xC6) == 0x80) {
uint starttile;
int32 cost;
+ uint z = TilePixelHeight(tile);
+
+ z += 8;
if (!CheckTileOwnership(tile)) return CMD_ERROR;
// railway bridge
starttile = tile = FindEdgesOfBridge(tile, &endtile);
// Make sure there's no vehicle on the bridge
- if ((v=FindVehicleBetween(tile, endtile, 0xff)) != NULL) {
+ if ((v=FindVehicleBetween(tile, endtile, z)) != NULL) {
VehicleInTheWayErrMsg(v);
return CMD_ERROR;
}
+ if (!EnsureNoVehicle(starttile) || !EnsureNoVehicle(endtile)) {
+ _error_message = STR_8803_TRAIN_IN_THE_WAY;
+ return CMD_ERROR;
+ }
+
if ( (uint)(_map3_lo[tile] & 0xF) == totype) return CMD_ERROR;
cost = 0;
do {