diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 67a43da5d4..915fca9440 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -3847,6 +3847,10 @@ bool TrainController(Train *v, Vehicle *nomove, bool reverse) goto invalid_rail; } if (old_direction != v->direction) notify_direction_changed(old_direction, v->direction); + DiagDirection dir = GetTunnelBridgeDirection(gp.old_tile); + const byte *b = _initial_tile_subcoord[AxisToTrack(DiagDirToAxis(dir))][dir]; + gp.x = (gp.x & ~0xF) | b[0]; + gp.y = (gp.y & ~0xF) | b[1]; } if (!(v->track & TRACK_BIT_WORMHOLE)) { /* Not inside tunnel */ @@ -4209,6 +4213,7 @@ bool TrainController(Train *v, Vehicle *nomove, bool reverse) v->x_pos = gp.x; v->y_pos = gp.y; v->UpdatePosition(); + v->UpdateDeltaXY(); if (HasBit(v->gv_flags, GVF_CHUNNEL_BIT)) { /* update the Z position of the vehicle */ int old_z = v->UpdateInclination(false, false, true);