diff --git a/tests/unit/test_derailment_vehicle.cpp b/tests/unit/test_derailment_vehicle.cpp index d6c94b9b0..99b6c0417 100644 --- a/tests/unit/test_derailment_vehicle.cpp +++ b/tests/unit/test_derailment_vehicle.cpp @@ -314,9 +314,11 @@ TEST_CASE("derailment: the names of the models in eu07.ini") { CHECK(derailment_model_of("off") == model::off); CHECK(derailment_model_of("no") == model::off); CHECK(derailment_model_of("monitor") == model::monitor); - // a name it doesn't know is the default - CHECK(derailment_model_of("physical") == model::physical); - CHECK(global_settings{}.derailment == model::physical); + // a name it doesn't know is the default: monitor, the legacy draw decides and the criteria go to the log, until the + // speed limits of the bundled sceneries are checked against them + CHECK(derailment_model_of("physical") == model::monitor); + CHECK(derailment_model_of("") == model::monitor); + CHECK(global_settings{}.derailment == model::monitor); CHECK_FALSE(global_settings{}.track_check); // written back the way it's read for (auto const value : {model::off, model::old, model::physical, model::monitor}) { diff --git a/utilities/Globals.h b/utilities/Globals.h index bc206913c..efbd7c5ca 100644 --- a/utilities/Globals.h +++ b/utilities/Globals.h @@ -298,9 +298,11 @@ struct global_settings { // by the criteria of McZapkie/derailment.h held over 2 m, and slides on with the friction of the ballast; old, the // legacy draw of the lateral acceleration against the gauge to the height of the vehicle in every step, which stops // it; off, it stays on the rails at any speed; monitor, the legacy draw decides and the log tells where the criteria - // would derail a vehicle (derailment monitor:, once for a vehicle on a track), for the run of a scenery as it was + // would derail a vehicle (derailment monitor:, once for a vehicle on a track), for the run of a scenery as it was. + // monitor is the default until the speed limits of the bundled sceneries are checked against the criteria (some + // tracks allow more than the reference vehicle survives there): new is opt-in until then enum class derailment_model { off, old, physical, monitor }; - derailment_model derailment = derailment_model::physical; + derailment_model derailment = derailment_model::monitor; // the collisions of rail vehicles past their buffers (physics.collisions in eu07.ini): new, the ends crush, a vehicle // may ride up onto the other one or be pushed off the track (McZapkie/collision.h); old, the legacy rule of the safe // closing speed weighed by the masses; monitor, the legacy rule decides and the log tells what the crush would be @@ -473,13 +475,13 @@ inline std::string_view name_of( global_settings::collision_model const Model ) default: { return "new"; } } } -// the models of physics.derailment by their names in eu07.ini: new (the default, also for a name it doesn't know), old, off -// or no, monitor +// the models of physics.derailment by their names in eu07.ini: new, old, off or no, monitor (the default, also for a +// name it doesn't know) inline global_settings::derailment_model derailment_model_of(std::string_view const Name) { + if( Name == "new" ) { return global_settings::derailment_model::physical; } if( Name == "old" ) { return global_settings::derailment_model::old; } if( Name == "off" || Name == "no" ) { return global_settings::derailment_model::off; } - if( Name == "monitor" ) { return global_settings::derailment_model::monitor; } - return global_settings::derailment_model::physical; + return global_settings::derailment_model::monitor; } inline std::string_view name_of( global_settings::derailment_model const Model ) { switch( Model ) {