summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-04-17 23:16:01 +0000
committerfrosch <frosch@openttd.org>2009-04-17 23:16:01 +0000
commit3086a89ee3fb923a2d791162e135e4bd7c21da5e (patch)
treed6b6823fe6b886f2b086ff41a62344fdc4253b2d
parent974dcbd339a72715c1952264df4d223664dc5d2b (diff)
downloadopenttd-3086a89ee3fb923a2d791162e135e4bd7c21da5e.tar.xz
(svn r16075) -Fix (r15792)[FS#2844]: Mixed up TRACK_BIT_X/Y.
-rw-r--r--src/train_cmd.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 87d716627..d32c2ec25 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -3768,12 +3768,18 @@ static void TrainController(Vehicle *v, Vehicle *nomove)
chosen_track = prev->u.rail.track;
}
} else {
- /* Choose the track that leads to the tile where prev is. */
+ /* Choose the track that leads to the tile where prev is.
+ * This case is active if 'prev' is already on the second next tile, when 'v' just enters the next tile.
+ * I.e. when the tile between them has only space for a single vehicle like
+ * 1) horizontal/vertical track tiles and
+ * 2) some orientations of tunnelentries, where the vehicle is already inside the wormhole at 8/16 from the tileedge.
+ * Is also the train just reversing, the wagon inside the tunnel is 'on' the tile of the opposite tunnelentry.
+ */
static const TrackBits _connecting_track[DIAGDIR_END][DIAGDIR_END] = {
- {TRACK_BIT_Y, TRACK_BIT_LOWER, TRACK_BIT_NONE, TRACK_BIT_LEFT },
- {TRACK_BIT_UPPER, TRACK_BIT_X, TRACK_BIT_LEFT, TRACK_BIT_NONE },
- {TRACK_BIT_NONE, TRACK_BIT_RIGHT, TRACK_BIT_Y, TRACK_BIT_UPPER},
- {TRACK_BIT_RIGHT, TRACK_BIT_NONE, TRACK_BIT_LOWER, TRACK_BIT_X }
+ {TRACK_BIT_X, TRACK_BIT_LOWER, TRACK_BIT_NONE, TRACK_BIT_LEFT },
+ {TRACK_BIT_UPPER, TRACK_BIT_Y, TRACK_BIT_LEFT, TRACK_BIT_NONE },
+ {TRACK_BIT_NONE, TRACK_BIT_RIGHT, TRACK_BIT_X, TRACK_BIT_UPPER},
+ {TRACK_BIT_RIGHT, TRACK_BIT_NONE, TRACK_BIT_LOWER, TRACK_BIT_Y }
};
DiagDirection exitdir = DiagdirBetweenTiles(gp.new_tile, prev->tile);
assert(IsValidDiagDirection(exitdir));