(svn r11574) -Fix: flood train stations when there are no trains on border tiles too (when non-uniform stations are OFF)
authorsmatz
Wed, 05 Dec 2007 00:16:20 +0000
changeset 8014 4a732fc3aade
parent 8013 82001acdb8d0
child 8015 1144c1044b27
(svn r11574) -Fix: flood train stations when there are no trains on border tiles too (when non-uniform stations are OFF)
src/water_cmd.cpp
--- a/src/water_cmd.cpp	Tue Dec 04 22:50:07 2007 +0000
+++ b/src/water_cmd.cpp	Wed Dec 05 00:16:20 2007 +0000
@@ -664,6 +664,20 @@
 		return NULL;
 	}
 
+	/* if non-uniform stations are disabled, flood some train in this train station (if there is any) */
+	if (!_patches.nonuniform_stations && IsTileType(tile, MP_STATION) && GetStationType(tile) == STATION_RAIL) {
+		const Station *st = GetStationByTile(tile);
+
+		BEGIN_TILE_LOOP(t, st->trainst_w, st->trainst_h, st->train_tile)
+			if (st->TileBelongsToRailStation(t)) {
+				Vehicle *v = FindVehicleOnTileZ(t, 0);
+				if (v != NULL && (v->vehstatus & VS_CRASHED) == 0) return v;
+			}
+		END_TILE_LOOP(t, st->trainst_w, st->trainst_h, st->train_tile)
+
+		return NULL;
+	}
+
 	if (!IsBridgeTile(tile)) return FindVehicleOnTileZ(tile, 0);
 
 	TileIndex end = GetOtherBridgeEnd(tile);