18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-27 21:45:16 +01:00

fix(camera): the trackside view sets the train's way again when the vehicle picked changes

pick() kept m_lastposition of the vehicle before, so the next motion_of() took the step between
the two vehicles for a move: the direction could point back along the train, the ends swapped and
the railfan went to a spot 80+ m behind the tail. Now a change of the vehicle sets m_moved to
false, and the way is set again from the way the user drives.
This commit is contained in:
jerrrrycho
2026-11-17 09:17:19 +01:00
parent 795883335d
commit ebe0a42be7

View File

@@ -132,6 +132,11 @@ TDynamicObject *consist_views::pick(std::vector<TDynamicObject *> const &Train,
index = cameraviews::step_index(index, static_cast<int>(Train.size()), m_step);
m_step = 0;
}
if (Train[index] != m_vehicle) {
// m_lastposition is of the vehicle before: the way the train goes is set again from the way the user drives,
// or the step between the two vehicles would be taken for a move
m_moved = false;
}
m_vehicle = Train[index];
return m_vehicle;
}