From efde2157eba2d14be487ae4d19f91a59ebea5c3c Mon Sep 17 00:00:00 2001 From: jerrrrycho Date: Sun, 29 Nov 2026 15:57:26 +0100 Subject: [PATCH] fix: the derailment notice builds on the layout of #531: physics/derailment.h, TDynamicObject::physics --- simulation/blackboxrecorder.cpp | 6 +++--- simulation/simulationtest.cpp | 4 ++-- vehicle/blackbox.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/simulation/blackboxrecorder.cpp b/simulation/blackboxrecorder.cpp index e6328d6ea..d81521caa 100644 --- a/simulation/blackboxrecorder.cpp +++ b/simulation/blackboxrecorder.cpp @@ -13,7 +13,7 @@ http://mozilla.org/MPL/2.0/. #include "simulation/simulation.h" #include "simulation/simulationtime.h" #include "input/command.h" -#include "McZapkie/derailment.h" +#include "physics/derailment.h" #include "vehicle/Driver.h" #include "vehicle/DynObj.h" #include "vehicle/Train.h" @@ -616,11 +616,11 @@ void blackbox_recorder::write_derailed(TDynamicObject const *Vehicle, derailment state.time = m_time; state.vehicle = vehicle_id(Vehicle); state.phase = blackbox::derailment_phases::derailed; - state.cause = cause_of(Notice.why, Vehicle->MoverParameters->Derailed); + state.cause = cause_of(Notice.why, Vehicle->physics->Derailed); state.position = Vehicle->GetPosition(); state.heading = static_cast(std::atan2(Vehicle->VectorFront().x, Vehicle->VectorFront().z)); // as it derailed, along its front as it moves now - state.speed_kmh = static_cast(std::copysign(Notice.velocity, Vehicle->MoverParameters->V)); + state.speed_kmh = static_cast(std::copysign(Notice.velocity, Vehicle->physics->V)); state.reason = static_cast(Notice.why); state.track = text_of(Notice.track); m_writer->derailment(state); diff --git a/simulation/simulationtest.cpp b/simulation/simulationtest.cpp index 4a29cfd6e..234223168 100644 --- a/simulation/simulationtest.cpp +++ b/simulation/simulationtest.cpp @@ -11,7 +11,7 @@ http://mozilla.org/MPL/2.0/. #include "simulation/simulationtest.h" #include "application/application.h" -#include "McZapkie/derailment.h" +#include "physics/derailment.h" #include "scene/scene.h" #include "simulation/simulation.h" #include "utilities/Globals.h" @@ -210,7 +210,7 @@ bool test_manager::tested(TDynamicObject const &Vehicle) const return true; return std::ranges::any_of(Global.test.vehicles, [&Vehicle](std::string const &Name) { auto *vehicle { simulation::Vehicles.find(Name) }; - return vehicle != nullptr && vehicle->find_vehicle(coupling::coupler, [&Vehicle](TDynamicObject const *Other) { return Other == &Vehicle; }) != nullptr; + return vehicle != nullptr && vehicle->find_vehicle(Coupling::coupler, [&Vehicle](TDynamicObject const *Other) { return Other == &Vehicle; }) != nullptr; }); } diff --git a/vehicle/blackbox.h b/vehicle/blackbox.h index 20b98bfa2..be8c7879c 100644 --- a/vehicle/blackbox.h +++ b/vehicle/blackbox.h @@ -353,7 +353,7 @@ struct derailment_state { float roll{0.0f}; // [rad] of its body against the level, to the left positive; 90 degrees on its side float travelled{0.0f}; // [m] on the ground since it left the rails bool lying{false}; // on its side - std::uint8_t reason{0}; // what derailed it, finer: the code of derailment::reason (McZapkie/derailment.h), 0 not known + std::uint8_t reason{0}; // what derailed it, finer: the code of derailment::reason (physics/derailment.h), 0 not known std::string track; // name of the track it derailed on, empty for a track without one };