summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-06-12 11:15:43 +0000
committerrubidium <rubidium@openttd.org>2008-06-12 11:15:43 +0000
commite2bcbd5c505d92f7667a4f787c5716db456fda4e (patch)
treed8f2bfe92d1e30707544bce0677a72f7d9567d75
parent1c79b92989d9381f52e8a4de95b18ed4f4ff1f4e (diff)
downloadopenttd-e2bcbd5c505d92f7667a4f787c5716db456fda4e.tar.xz
(svn r13485) -Fix: let ships also navigate on half-tile sloped watery rail tiles.
-rw-r--r--src/rail_cmd.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index 5359aafb3..d1ad5853b 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -1383,6 +1383,8 @@ static CommandCost ClearTile_Track(TileIndex tile, byte flags)
}
if (water_ground) {
+ if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
+
/* The track was removed, and left a coast tile. Now also clear the water. */
if (flags & DC_EXEC) DoClearSquare(tile);
cost.AddCost(_price.clear_water);
@@ -2112,6 +2114,19 @@ set_ground:
static TrackStatus GetTileTrackStatus_Track(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
{
+ /* Case of half tile slope with water. */
+ if (mode == TRANSPORT_WATER && IsPlainRailTile(tile) && GetRailGroundType(tile) == RAIL_GROUND_WATER) {
+ TrackBits tb = GetTrackBits(tile);
+ switch (tb) {
+ default: NOT_REACHED();
+ case TRACK_BIT_UPPER: tb = TRACK_BIT_LOWER; break;
+ case TRACK_BIT_LOWER: tb = TRACK_BIT_UPPER; break;
+ case TRACK_BIT_LEFT: tb = TRACK_BIT_RIGHT; break;
+ case TRACK_BIT_RIGHT: tb = TRACK_BIT_LEFT; break;
+ }
+ return CombineTrackStatus(TrackBitsToTrackdirBits(tb), TRACKDIR_BIT_NONE);
+ }
+
if (mode != TRANSPORT_RAIL) return 0;
TrackBits trackbits = TRACK_BIT_NONE;