mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 14:16:48 +01:00
refactor(physics): six more of what the rest only reads are private, under names of their own
The mass of the empty vehicle, the braking force, the outcome of a derailment,
the departure signal, the traction mode of a dual-mode vehicle and the moment
of the motors are private to physics::Vehicle like the 53 before them, read
through Mass(), Fb(), Derailed(), DepartureSignal(), TractionMode() and Mm().
Inside the class they are emptyMass, brakingForce, derailOutcome,
departureSignalOn, tractionModeSetting and motorMoment, as the plain camelCase
names were taken by locals there.
No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
This commit is contained in:
@@ -416,7 +416,7 @@ TEST_CASE("derail motion: the vehicle leaves the track with physics.derailment n
|
||||
for (int step = 0; step < 10; ++step) {
|
||||
eu07vehicle.step(curve);
|
||||
}
|
||||
REQUIRE(eu07vehicle->Derailed == dr::outcome::overturned);
|
||||
REQUIRE(eu07vehicle->Derailed() == dr::outcome::overturned);
|
||||
CHECK(eu07vehicle->DerailCause() == dm::cause::overturned);
|
||||
CHECK(eu07vehicle->DerailAcceleration() > eu07_tipping);
|
||||
CHECK(eu07vehicle->leaves_track());
|
||||
@@ -442,7 +442,7 @@ TEST_CASE("derail motion: the vehicle leaves the track with physics.derailment n
|
||||
eu07vehicle.damage_track(dtrack_norail);
|
||||
eu07vehicle.step();
|
||||
REQUIRE(eu07vehicle->DamageFlag.HasAll(VehicleDamage::derailed));
|
||||
CHECK(eu07vehicle->Derailed == dr::outcome::off_rails);
|
||||
CHECK(eu07vehicle->Derailed() == dr::outcome::off_rails);
|
||||
CHECK(eu07vehicle->DerailCause() == dm::cause::end_of_track);
|
||||
CHECK(eu07vehicle->leaves_track());
|
||||
}
|
||||
@@ -451,7 +451,7 @@ TEST_CASE("derail motion: the vehicle leaves the track with physics.derailment n
|
||||
vehicle pulled{definition::fiz("4e_v1/4e"), 40.0};
|
||||
pulled->pull_off(-1, 5.0, "test");
|
||||
CHECK(pulled->DamageFlag.HasAll(VehicleDamage::derailed));
|
||||
CHECK(pulled->Derailed == dr::outcome::off_rails);
|
||||
CHECK(pulled->Derailed() == dr::outcome::off_rails);
|
||||
CHECK(pulled->DerailCause() == dm::cause::pulled_off);
|
||||
CHECK(pulled->DerailSide() == -1);
|
||||
CHECK(pulled->leaves_track());
|
||||
@@ -474,7 +474,7 @@ TEST_CASE("derail motion: with physics.derailment monitor and old the vehicle st
|
||||
fast.step(curve);
|
||||
}
|
||||
REQUIRE(fast->DamageFlag.HasAll(VehicleDamage::derailed));
|
||||
CHECK(fast->Derailed == dr::outcome::none);
|
||||
CHECK(fast->Derailed() == dr::outcome::none);
|
||||
CHECK_FALSE(fast->leaves_track());
|
||||
CHECK_FALSE(fast->OffTrack.active());
|
||||
// stopped dead by the legacy model
|
||||
@@ -483,7 +483,7 @@ TEST_CASE("derail motion: with physics.derailment monitor and old the vehicle st
|
||||
ending.damage_track(dtrack_norail);
|
||||
ending.step();
|
||||
REQUIRE(ending->DamageFlag.HasAll(VehicleDamage::derailed));
|
||||
CHECK(ending->Derailed == dr::outcome::none);
|
||||
CHECK(ending->Derailed() == dr::outcome::none);
|
||||
CHECK_FALSE(ending->leaves_track());
|
||||
// nor is a vehicle pulled off it
|
||||
vehicle pulled{definition::fiz("4e_v1/4e"), 40.0};
|
||||
|
||||
Reference in New Issue
Block a user