mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 17:46:48 +01:00
refactor(physics): TMoverParameters becomes physics::Vehicle, the mover is gone
The physics of a vehicle loses the name it had from the Pascal of 2001. Done by
tools/rename/mover_to_physics.py, committed with it:
physics/mover.h physics/vehicle.h
TMoverParameters physics::Vehicle (in namespace physics)
TDynamicObject::MoverParameters physics
mvOccupied, mvControlled occupied, controlled (TTrain, TController)
mvSecond, mvThird secondUnit, thirdUnit
mvPantographUnit pantographUnit
mover, Mover, movers physics, Physics, vehicles (locals, params)
m_mover, othermover, currentMover, from_movers, renderMoverEventSounds
m_physics, otherPhysics, currentPhysics,
from_vehicles, renderPhysicsEventSounds
The code and the comments are renamed, the string literals are not: no text
the game shows, logs or looks up has changed (none had the names). The movers
of the editor, the tracks a slide moves, keep their name.
By hand: two member functions of TDynamicObject (gather_off_track_terrain,
begin_off_track) had a local mover aliasing their own MoverParameters, which
the rename made physics { *physics }; the alias is gone, they use physics->.
No other function has a renamed local meeting a renamed member (checked over
all the functions of the code before the rename).
For the branches made before it: run the script on the branch (python
tools/rename/mover_to_physics.py, from the root of the repository) before
merging it with this one, and the names don't conflict. It can be run again;
the second time it changes nothing.
The class is the same as it was; breaking it into its parts (braking,
electrics, controls, load) and making its data private are the next stages.
No change in behaviour: 1149/1149 tests, golden traces exact against staging
62f7a29b.
This commit is contained in:
@@ -191,7 +191,7 @@ TEST_CASE("crew: a locomotive under power left by its driver stops and stays bra
|
||||
consist train;
|
||||
train.add(definition::fiz("4e_v1/4e"), 1);
|
||||
get_under_way(train, 20, 30.0);
|
||||
auto &eu07{train[0].mover()};
|
||||
auto &eu07{train[0].physics()};
|
||||
REQUIRE(train[0].speed() > 20.0);
|
||||
REQUIRE(eu07.MainCtrlPos > 0);
|
||||
REQUIRE(eu07.Mains);
|
||||
@@ -227,7 +227,7 @@ TEST_CASE("crew: what the AI held is let go when the driver leaves") {
|
||||
REQUIRE(cab->DepartureSignal);
|
||||
REQUIRE(cab->SandDose);
|
||||
|
||||
crew::secure(cab.mover(), cab.mover());
|
||||
crew::secure(cab.physics(), cab.physics());
|
||||
|
||||
CHECK(cab->WarningSignal == 0);
|
||||
CHECK_FALSE(cab->DepartureSignal);
|
||||
@@ -241,8 +241,8 @@ TEST_CASE("crew: a train left by its driver is braked through the whole of it")
|
||||
train.add(definition::fiz("11xa_v2/93a"));
|
||||
train.add(definition::fiz("11xa_v2/93a"));
|
||||
get_under_way(train, 20, 40.0);
|
||||
auto &eu07{train[0].mover()};
|
||||
auto &last{train[2].mover()};
|
||||
auto &eu07{train[0].physics()};
|
||||
auto &last{train[2].physics()};
|
||||
REQUIRE(train[0].speed() > 15.0);
|
||||
REQUIRE(last.BrakePress < 0.1);
|
||||
|
||||
@@ -263,7 +263,7 @@ TEST_CASE("crew: a standing locomotive left by its driver is braked too") {
|
||||
auto driver{test::driving(train)};
|
||||
REQUIRE(test::start_up(driver, line));
|
||||
test::release_brakes(driver.cab);
|
||||
auto &eu07{train[0].mover()};
|
||||
auto &eu07{train[0].physics()};
|
||||
// the cylinders of a locomotive started up cold take their time to empty
|
||||
for (int i = 0; i < 180 && eu07.BrakePress >= 0.1; ++i) {
|
||||
test::drive(driver, line, 1.0);
|
||||
@@ -288,7 +288,7 @@ TEST_CASE("crew: the power an integrated handle asked for goes when the driver l
|
||||
impuls->eimic = 0.8;
|
||||
impuls->eimic_real = 0.8;
|
||||
|
||||
crew::secure(impuls.mover(), impuls.mover());
|
||||
crew::secure(impuls.physics(), impuls.physics());
|
||||
|
||||
CHECK(impuls->MainCtrlPos == impuls->MainCtrlNoPowerPos());
|
||||
CHECK(impuls->eimic == 0.0);
|
||||
@@ -304,7 +304,7 @@ TEST_CASE("crew: a road vehicle left by its driver gets the brake the driver sto
|
||||
REQUIRE(bus->LocalBrakePosA == 0.0);
|
||||
bus->CabActivisation();
|
||||
|
||||
crew::secure(bus.mover(), bus.mover());
|
||||
crew::secure(bus.physics(), bus.physics());
|
||||
|
||||
CHECK(bus->LocalBrakePosA == 1.0);
|
||||
CHECK(bus->MainCtrlPos == bus->MainCtrlNoPowerPos());
|
||||
|
||||
Reference in New Issue
Block a user