summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-11-10 23:13:37 +0000
committerrubidium <rubidium@openttd.org>2010-11-10 23:13:37 +0000
commit8b8b4e083cde5161b32b9a04644393541765454d (patch)
treeac76e98dda3b05bdc20da54eb3ae73d2fa842ba1 /src
parent72a6eeef266185aa596d7c4be35a8dbc9809f141 (diff)
downloadopenttd-8b8b4e083cde5161b32b9a04644393541765454d.tar.xz
(svn r21138) -Codechange: Introduce the concepts of frame and position in the tunnel / bridge entering code (Hirundo)
Diffstat (limited to 'src')
-rw-r--r--src/tunnelbridge_cmd.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index 22973d62d..ba7eb04ec 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -1502,6 +1502,10 @@ static VehicleEnterTileStatus VehicleEnter_TunnelBridge(Vehicle *v, TileIndex ti
const DiagDirection dir = GetTunnelBridgeDirection(tile);
/* Direction of the vehicle */
const DiagDirection vdir = DirToDiagDir(v->direction);
+ /* New position of the vehicle on the tile */
+ byte pos = (DiagDirToAxis(vdir) == AXIS_X ? x : y) & TILE_UNIT_MASK;
+ /* Number of units moved by the vehicle since entering the tile */
+ byte frame = (vdir == DIAGDIR_NE || vdir == DIAGDIR_NW) ? TILE_SIZE - 1 - pos : pos;
if (IsTunnel(tile)) {
byte fc = (x & 0xF) + (y << 4);