summaryrefslogtreecommitdiff
path: root/src/train_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 17e298c33..1112e9237 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -1577,6 +1577,7 @@ static void UpdateStatusAfterSwap(Train *v)
}
v->UpdatePosition();
+ if (v->track == TRACK_BIT_WORMHOLE) v->UpdateInclination(false, false, true);
v->UpdateViewport(true, true);
}
@@ -3340,6 +3341,15 @@ bool TrainController(Train *v, Vehicle *nomove, bool reverse)
v->x_pos = gp.x;
v->y_pos = gp.y;
v->UpdatePosition();
+ if (v->track == TRACK_BIT_WORMHOLE) {
+ /* update the Z position of the vehicle */
+ int old_z = v->UpdateInclination(false, false, true);
+
+ if (prev == nullptr) {
+ /* This is the first vehicle in the train */
+ AffectSpeedByZChange(v, old_z);
+ }
+ }
if ((v->vehstatus & VS_HIDDEN) == 0) v->Vehicle::UpdateViewport(true);
continue;
}
@@ -3353,7 +3363,7 @@ bool TrainController(Train *v, Vehicle *nomove, bool reverse)
v->UpdatePosition();
/* update the Z position of the vehicle */
- int old_z = v->UpdateInclination(gp.new_tile != gp.old_tile, false);
+ int old_z = v->UpdateInclination(gp.new_tile != gp.old_tile, false, v->track == TRACK_BIT_WORMHOLE);
if (prev == nullptr) {
/* This is the first vehicle in the train */
@@ -3866,7 +3876,7 @@ static bool TrainLocoHandler(Train *v, bool mode)
}
for (Train *u = v; u != nullptr; u = u->Next()) {
- if ((u->vehstatus & VS_HIDDEN) != 0) continue;
+ if (!u->IsDrawn()) continue;
u->UpdateViewport(false, false);
}