Codechange: Introduce the concepts of frame and position in the tunnel / bridge entering code. diff -r a8b268829f7d src/tunnelbridge_cmd.cpp --- a/src/tunnelbridge_cmd.cpp Fri Oct 22 15:58:38 2010 +0200 +++ b/src/tunnelbridge_cmd.cpp Fri Oct 22 16:09:10 2010 +0200 @@ -1502,6 +1502,10 @@ 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);