summaryrefslogtreecommitdiff
path: root/src/train_cmd.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-02-04 15:56:39 +0000
committersmatz <smatz@openttd.org>2008-02-04 15:56:39 +0000
commitebba0d7c7118f950ebd09449821ec121105b3436 (patch)
tree0adfa262156282acbe95d71f8e39ab54c7a65439 /src/train_cmd.cpp
parent99817bd5f0e7de5a395be05ace31cb7fe246c8bc (diff)
downloadopenttd-ebba0d7c7118f950ebd09449821ec121105b3436.tar.xz
(svn r12057) -Fix: slowdown train when approaching 90deg turn when 90deg turns are forbidden
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 612f383b1..def649ccd 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -3462,9 +3462,15 @@ static bool TrainCheckIfLineEnds(Vehicle *v)
/* We are sure the train is not entering a depot, it is detected above */
+ /* mask unreachable track bits if we are forbidden to do 90deg turns */
+ TrackBits bits = (TrackBits)((ts | (ts >> 8)) & TRACK_BIT_MASK);
+ if ((_patches.new_pathfinding_all || _patches.yapf.rail_use_yapf) && _patches.forbid_90_deg) {
+ bits &= ~TrackCrossesTracks(FindFirstTrack(v->u.rail.track));
+ }
+
/* no suitable trackbits at all || wrong railtype || not our track ||
* tunnel/bridge from opposite side || depot from opposite side */
- if (GB(ts, 0, 16) == 0 || !CheckCompatibleRail(v, tile) || GetTileOwner(tile) != v->owner ||
+ if (bits == TRACK_BIT_NONE || !CheckCompatibleRail(v, tile) || GetTileOwner(tile) != v->owner ||
(IsTileType(tile, MP_TUNNELBRIDGE) && GetTunnelBridgeDirection(tile) != dir) ||
(IsTileDepotType(tile, TRANSPORT_RAIL) && GetRailDepotDirection(tile) == dir) ) {
return TrainApproachingLineEnd(v, false);