station_cmd.c
changeset 149 5f7d4b21df01
parent 123 d550772c61e6
child 159 139cf78bfb28
--- a/station_cmd.c	Fri Sep 03 16:03:17 2004 +0000
+++ b/station_cmd.c	Fri Sep 03 17:57:27 2004 +0000
@@ -905,7 +905,7 @@
 	// make sure the specified tile belongs to the current player, and that it is a railroad station.
 	if (!IS_TILETYPE(tile, MP_STATION) || _map5[tile] >= 8 || !_patches.nonuniform_stations) return CMD_ERROR;
 	st = DEREF_STATION(_map2[tile]);
-	if (!CheckOwnership(st->owner) || !EnsureNoVehicle(tile)) return CMD_ERROR;
+	if (_current_player != OWNER_WATER && (!CheckOwnership(st->owner) || !EnsureNoVehicle(tile))) return CMD_ERROR;
 
 	// if we reached here, it means we can actually delete it. do that.
 	if (flags & DC_EXEC) {
@@ -948,12 +948,15 @@
 }
 
 
-static int32 RemoveRailroadStation(Station *st, uint32 flags)
+static int32 RemoveRailroadStation(Station *st, TileIndex tile, uint32 flags)
 {
-	uint tile;
 	int w,h;
 	int32 cost;
 
+	/* if there is flooding and non-uniform stations are enabled, remove platforms tile by tile */
+	if (_current_player == OWNER_WATER && _patches.nonuniform_stations)
+		return DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_REMOVE_FROM_RAILROAD_STATION);
+
 	/* Current player owns the station? */
 	if (_current_player != OWNER_WATER && !CheckOwnership(st->owner))
 		return CMD_ERROR;
@@ -2434,7 +2437,7 @@
 	st = DEREF_STATION(_map2[tile]);
 
 	if (m5 < 8)
-		return RemoveRailroadStation(st, flags);
+		return RemoveRailroadStation(st, tile, flags);
 
 	// original airports < 67, new airports between 83 - 114
 	if (m5 < 0x43 || ( m5 >= 83 && m5 <= 114) )