summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2007-12-04 21:39:03 +0000
committersmatz <smatz@openttd.org>2007-12-04 21:39:03 +0000
commitddc8f2d16faa652a76da1400471704e147589ca7 (patch)
tree4e0902b71bc2f6adf3ca3c3d4cc17901b41a1cd0 /src/station_cmd.cpp
parent5f576e12aa23c828f4a79726d43647905c98f104 (diff)
downloadopenttd-ddc8f2d16faa652a76da1400471704e147589ca7.tar.xz
(svn r11570) -Fix: do not flood rail station tiles when there is a vehicle on it (when non-uniform stations are ON)
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 21ecf3d0f..4960e5898 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1170,17 +1170,27 @@ CommandCost CmdRemoveFromRailroadStation(TileIndex tile, uint32 flags, uint32 p1
/* Do the action for every tile into the area */
BEGIN_TILE_LOOP(tile2, size_x, size_y, tile) {
- /* Make sure the specified tile belongs to the current player, and that it is a railroad station. */
- if (!IsTileType(tile2, MP_STATION) || !IsRailwayStation(tile2) || !_patches.nonuniform_stations) {
+ /* Make sure the specified tile is a railroad station */
+ if (!IsTileType(tile2, MP_STATION) || !IsRailwayStation(tile2)) {
+ continue;
+ }
+
+ /* If there is a vehicle on ground, do not allow to remove (flood) the tile */
+ if (!EnsureNoVehicleOnGround(tile2)) {
continue;
}
/* Check ownership of station */
Station *st = GetStationByTile(tile2);
- if (_current_player != OWNER_WATER && (!CheckOwnership(st->owner) || !EnsureNoVehicleOnGround(tile2))) {
+ if (_current_player != OWNER_WATER && !CheckOwnership(st->owner)) {
continue;
}
+ /* Do not allow removing from stations if non-uniform stations are not enabled
+ * The check must be here to give correct error message
+ */
+ if (!_patches.nonuniform_stations) return_cmd_error(STR_306D_NONUNIFORM_STATIONS_DISALLOWED);
+
/* If we reached here, the tile is valid so increase the quantity of tiles we will remove */
quantity++;