From ddc8f2d16faa652a76da1400471704e147589ca7 Mon Sep 17 00:00:00 2001 From: smatz Date: Tue, 4 Dec 2007 21:39:03 +0000 Subject: (svn r11570) -Fix: do not flood rail station tiles when there is a vehicle on it (when non-uniform stations are ON) --- src/station_cmd.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/station_cmd.cpp') 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++; -- cgit v1.2.3-54-g00ecf