summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2007-12-05 00:16:20 +0000
committersmatz <smatz@openttd.org>2007-12-05 00:16:20 +0000
commitc65c14f06b9d24622c4894b7adc8b4623378bec6 (patch)
treeb13cdfa1fe519c5c80a30accf87b379c40f8613a /src
parent8c5c0e9367080e6d6d3cbfdb68c470084aaa3c68 (diff)
downloadopenttd-c65c14f06b9d24622c4894b7adc8b4623378bec6.tar.xz
(svn r11574) -Fix: flood train stations when there are no trains on border tiles too (when non-uniform stations are OFF)
Diffstat (limited to 'src')
-rw-r--r--src/water_cmd.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index 664e3f5d8..76b4ee4d2 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -664,6 +664,20 @@ static Vehicle *FindFloodableVehicleOnTile(TileIndex tile)
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);