18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-28 12:36:20 +01:00

fix(physics): a repaired vehicle is back on the rails, the state of the criteria of derailment cleared

resetconsist (Stop and repair consist of the debug panel and of the vehicle window) cleared the damage flags, but kept
Derailed, the stretches of the criteria, the distance gathered for them and the report of the monitor. A vehicle once
derailed by the criteria and repaired then slid on with their friction after a derailment of the legacy kind, instead
of stopping dead, and the friction of the ballast kept holding it whenever it stood.

TMoverParameters::rerail() puts a vehicle back on the rails: dtrain_out off, Derailed none, the criteria from scratch,
the monitor free to report the track again, a rail vehicle back on the axis of the track. repair_damage() does what
resetconsist did to the damage (the flags, the engine damage, the wheel flats, the alarm chain) and rerails it;
resetconsist and the road vehicles coming back from the pool of a road point use it. SetDamage taking dtrain_out off
rerails the vehicle as well. A vehicle put on a track anew (consistteleport) starts the stretches of the criteria
over, they were gathered on the track it left.
This commit is contained in:
jerrrrycho
2026-11-16 07:44:31 +01:00
parent 5ba9876aec
commit 0e41d27032
6 changed files with 139 additions and 6 deletions

View File

@@ -398,12 +398,10 @@ void state_manager::process_commands() {
}
while (vehicle) {
vehicle->MoverParameters->DamageFlag = 0;
vehicle->MoverParameters->EngDmgFlag = 0;
// no damage, back on the rails with the state of the derailment cleared
vehicle->MoverParameters->repair_damage();
vehicle->MoverParameters->V = 0.000001; // HACK: force vehicle position re-calculation
vehicle->MoverParameters->DistCounter = 0.0;
vehicle->MoverParameters->WheelFlat = 0.0;
vehicle->MoverParameters->AlarmChainFlag = false;
vehicle->MoverParameters->OffsetTrackH = 0.0;
vehicle->MoverParameters->OffsetTrackV = 0.0;