summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-05-31 07:34:40 +0000
committerrubidium <rubidium@openttd.org>2007-05-31 07:34:40 +0000
commit52f612d71186c6ae8153f5e2264c39baddb610bd (patch)
tree2c8796c52027576701b53071c97f64c486da7c05 /src
parenta672a8f77d855a2879bf7b3b7a99b9f9eef1fdb8 (diff)
downloadopenttd-52f612d71186c6ae8153f5e2264c39baddb610bd.tar.xz
(svn r9996) -Fix: be more strict when building/upgrading roads and/or road stops.
Diffstat (limited to 'src')
-rw-r--r--src/road_cmd.cpp4
-rw-r--r--src/station_cmd.cpp3
2 files changed, 7 insertions, 0 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 7586a9f49..5f4e6e538 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -427,12 +427,16 @@ int32 CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
case MP_STATION:
if (!IsDriveThroughStopTile(tile)) return CMD_ERROR;
if (HASBIT(GetRoadTypes(tile), rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
+ /* Don't allow "upgrading" the roadstop when vehicles are already driving on it */
+ if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
break;
case MP_TUNNELBRIDGE:
if ((IsTunnel(tile) && GetTunnelTransportType(tile) != TRANSPORT_ROAD) ||
(IsBridge(tile) && GetBridgeTransportType(tile) != TRANSPORT_ROAD)) return CMD_ERROR;
if (HASBIT(GetRoadTypes(tile), rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
+ /* Don't allow "upgrading" the bridge/tunnel when vehicles are already driving on it */
+ if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
break;
default:
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index b863481b8..abee202b0 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1273,6 +1273,9 @@ int32 CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (IsTileOwner(tile, OWNER_TOWN) && !_patches.road_stop_on_town_road) return_cmd_error(STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD);
if (GetRoadTileType(tile) != ROAD_TILE_NORMAL) return CMD_ERROR;
+ /* Don't allow building the roadstop when vehicles are already driving on it */
+ if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
+
RoadTypes cur_rts = GetRoadTypes(tile);
if (GetRoadOwner(tile, ROADTYPE_ROAD) != OWNER_TOWN && HASBIT(cur_rts, ROADTYPE_ROAD) && !CheckOwnership(GetRoadOwner(tile, ROADTYPE_ROAD))) return CMD_ERROR;
if (HASBIT(cur_rts, ROADTYPE_TRAM) && !CheckOwnership(GetRoadOwner(tile, ROADTYPE_TRAM))) return CMD_ERROR;