summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-01-12 22:10:00 +0000
committerrubidium <rubidium@openttd.org>2008-01-12 22:10:00 +0000
commit853ca6386e72b667e049ef3ef43770938b4cb700 (patch)
tree60e23fc0ebb9432545c4c0a003ccc8b743d8e8ea
parentc7debf79086300d6ec7ded3973f4d506b5ed2aef (diff)
downloadopenttd-853ca6386e72b667e049ef3ef43770938b4cb700.tar.xz
(svn r11825) -Fix (FS#1627): an articulated road vehicle could split up when it turned around at a corner and then would enter a drive through station at the next tile.
-rw-r--r--src/roadveh_cmd.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 17bf2a754..87b0cfd53 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -1414,9 +1414,7 @@ static Trackdir FollowPreviousRoadVehicle(const Vehicle *v, const Vehicle *prev,
if (diag_dir == INVALID_DIAGDIR) return INVALID_TRACKDIR;
dir = DiagdirToDiagTrackdir(diag_dir);
- } else if (HasBit(prev_state, RVS_IN_DT_ROAD_STOP)) {
- dir = (Trackdir)(prev_state & RVSB_ROAD_STOP_TRACKDIR_MASK);
- } else if (prev_state < TRACKDIR_END) {
+ } else {
if (already_reversed && prev->tile != tile) {
/*
* The vehicle has reversed, but did not go straight back.
@@ -1437,11 +1435,13 @@ static Trackdir FollowPreviousRoadVehicle(const Vehicle *v, const Vehicle *prev,
{ TRACKDIR_UPPER_W, TRACKDIR_RIGHT_N, TRACKDIR_LEFT_N, TRACKDIR_UPPER_E },
{ TRACKDIR_RIGHT_S, TRACKDIR_LOWER_W, TRACKDIR_LOWER_E, TRACKDIR_LEFT_S }};
dir = reversed_turn_lookup[prev->tile < tile ? 0 : 1][ReverseDiagDir(entry_dir)];
- } else {
+ } else if (HasBit(prev_state, RVS_IN_DT_ROAD_STOP)) {
+ dir = (Trackdir)(prev_state & RVSB_ROAD_STOP_TRACKDIR_MASK);
+ } else if (prev_state < TRACKDIR_END) {
dir = (Trackdir)prev_state;
+ } else {
+ return INVALID_TRACKDIR;
}
- } else {
- return INVALID_TRACKDIR;
}
/* Do some sanity checking. */