mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-03 11:15:23 +01:00
feat(physics): a switch run through from its frog end is damaged; physics.derailment new keeps it out of use and splits a vehicle running onto it from its points
A rail vehicle running onto a switch from its frog end by the way the switch is not set to pushes its blades over. Before, the switch was just thrown to that way and nothing remembered it. Now the switch is marked as run through, the log tells it once per run-through, and the scenery can react through the memory cell and event __simulation.runthrough. With physics.derailment new the damaged switch stays out of use for the run: switch events no longer throw it, a vehicle running onto it from its points pushes the loose blades over under its first axle and runs forked (the #496 limits derail it, cause split_switch), and a run-through above 60 km/h derails the vehicle at the switch (cause run_through). In monitor mode the run does not change; the log tells what new would do. Every switch is still taken as trailable, as before.
This commit is contained in:
@@ -153,6 +153,22 @@ state_manager::report_derailment( TDynamicObject const &Vehicle, derailment::not
|
||||
test().vehicle_derailed( Vehicle, Notice );
|
||||
}
|
||||
|
||||
void
|
||||
state_manager::report_run_through( TTrack const &Switch, TDynamicObject const &Vehicle, double const Speed ) {
|
||||
|
||||
auto const name { std::string( run_through_name ) };
|
||||
if( auto *cell { Memory.find( name ) } ) {
|
||||
cell->UpdateValues(
|
||||
( Switch.name().empty() ? std::string( "none" ) : Switch.name() ) + " " + Vehicle.name(),
|
||||
Speed,
|
||||
static_cast<double>( Switch.SwitchExtension != nullptr ? Switch.SwitchExtension->CurrentIndex : 0 ),
|
||||
basic_event::flags::text | basic_event::flags::value1 | basic_event::flags::value2 );
|
||||
}
|
||||
if( auto *launched { Events.FindEvent( name ) } ) {
|
||||
Events.AddToQuery( launched, &Vehicle );
|
||||
}
|
||||
}
|
||||
|
||||
// legacy method, calculates changes in simulation state over specified time
|
||||
void
|
||||
state_manager::update( double const Deltatime, int Iterationcount ) {
|
||||
|
||||
Reference in New Issue
Block a user