mirror of https://github.com/OpenTTD/OpenTTD
(svn r2134) Return the correct error message if rail is already under a bridge, fix for r2131
parent
edd301d364
commit
0f830b79e1
14
rail_cmd.c
14
rail_cmd.c
|
@ -299,12 +299,13 @@ int32 CmdBuildSingleRail(int x, int y, uint32 flags,
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_TUNNELBRIDGE:
|
case MP_TUNNELBRIDGE:
|
||||||
if ((m5 & 0xC0) != 0xC0 || // not bridge middle part?
|
if ((m5 & 0xC0) != 0xC0 || // not bridge middle part?
|
||||||
(m5 & 0x01 ? 1 : 2) != rail_bit || // wrong direction?
|
(m5 & 0x01 ? 1 : 2) != rail_bit) { // wrong direction?
|
||||||
(m5 & 0x38) != 0x00) { // no clear land underneath?
|
|
||||||
// Get detailed error message
|
// Get detailed error message
|
||||||
return DoCommandByTile(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
return DoCommandByTile(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (m5 & 0x38) { // what's under the bridge?
|
||||||
|
case 0x00: // clear land
|
||||||
ret = CheckRailSlope(tileh, rail_bit, 0, tile);
|
ret = CheckRailSlope(tileh, rail_bit, 0, tile);
|
||||||
if (ret & CMD_ERROR) return ret;
|
if (ret & CMD_ERROR) return ret;
|
||||||
cost += ret;
|
cost += ret;
|
||||||
|
@ -317,6 +318,15 @@ int32 CmdBuildSingleRail(int x, int y, uint32 flags,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 0x20: // rail already there
|
||||||
|
return_cmd_error(STR_1007_ALREADY_BUILT);
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Get detailed error message
|
||||||
|
return DoCommandByTile(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case MP_RAILWAY:
|
case MP_RAILWAY:
|
||||||
if (!CheckTrackCombination(m5, rail_bit, flags) ||
|
if (!CheckTrackCombination(m5, rail_bit, flags) ||
|
||||||
!EnsureNoVehicle(tile)) {
|
!EnsureNoVehicle(tile)) {
|
||||||
|
|
Loading…
Reference in New Issue