mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-01 05:57:08 +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:
@@ -10,7 +10,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
// setting the vehicle up after reading its definition: the checks, the brake valves, the handles and the pipes
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "physics/mover.h"
|
||||
#include "physics/vehicle.h"
|
||||
#include "vehicle/DynObj.h"
|
||||
#include "physics/oerlikonest.h"
|
||||
#include "utilities/Globals.h"
|
||||
@@ -34,7 +34,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
// Q: 20160717
|
||||
// *************************************************************************************************
|
||||
|
||||
bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int /*Dir*/)
|
||||
bool physics::Vehicle::CheckLocomotiveParameters(bool ReadyFlag, int /*Dir*/)
|
||||
{
|
||||
WriteLog("check locomotive parameters...");
|
||||
bool OK = true;
|
||||
@@ -152,13 +152,13 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int /*Dir*/)
|
||||
{
|
||||
IncBrakeMult();
|
||||
IncBrakeMult();
|
||||
DecBrakeMult(); // TODO: przeinesiono do mover.cpp
|
||||
DecBrakeMult(); // TODO: przeinesiono do physics.cpp
|
||||
if (LoadAmount < MaxLoad * 0.35)
|
||||
DecBrakeMult();
|
||||
}
|
||||
else
|
||||
{
|
||||
IncBrakeMult(); // TODO: przeinesiono do mover.cpp
|
||||
IncBrakeMult(); // TODO: przeinesiono do physics.cpp
|
||||
if (LoadAmount >= MaxLoad * 0.55)
|
||||
IncBrakeMult();
|
||||
}
|
||||
@@ -219,7 +219,7 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int /*Dir*/)
|
||||
}
|
||||
|
||||
// the distributor valve of the vehicle's kind
|
||||
void TMoverParameters::CreateBrakeValve()
|
||||
void physics::Vehicle::CreateBrakeValve()
|
||||
{
|
||||
switch (BrakeValve)
|
||||
{
|
||||
@@ -318,7 +318,7 @@ void TMoverParameters::CreateBrakeValve()
|
||||
}
|
||||
|
||||
// the driver's handle and the local brake handle of the vehicle's kinds
|
||||
void TMoverParameters::CreateBrakeHandles()
|
||||
void physics::Vehicle::CreateBrakeHandles()
|
||||
{
|
||||
switch (BrakeHandle)
|
||||
{
|
||||
@@ -384,7 +384,7 @@ void TMoverParameters::CreateBrakeHandles()
|
||||
}
|
||||
|
||||
// the brake pipe, the main pipe and the spring brake's cylinder
|
||||
void TMoverParameters::CreateBrakePipes()
|
||||
void physics::Vehicle::CreateBrakePipes()
|
||||
{
|
||||
if (true == TestFlag(BrakeDelays, bdelay_G) && (false == TestFlag(BrakeDelays, bdelay_R) || Power > 1.0)) // ustalanie srednicy przewodu glownego (lokomotywa lub napędowy
|
||||
Spg = 0.792;
|
||||
@@ -404,7 +404,7 @@ void TMoverParameters::CreateBrakePipes()
|
||||
}
|
||||
|
||||
// the pressure of the main pipe at the start: the main reservoir's, or HosePressure fed through a main hose, or none
|
||||
double TMoverParameters::InitialScndPipePress(double const HosePressure) const
|
||||
double physics::Vehicle::InitialScndPipePress(double const HosePressure) const
|
||||
{
|
||||
if (VeselVolume > 0.0)
|
||||
{
|
||||
@@ -418,7 +418,7 @@ double TMoverParameters::InitialScndPipePress(double const HosePressure) const
|
||||
}
|
||||
|
||||
// the air and the controls of a vehicle ready to depart
|
||||
void TMoverParameters::SetReadyToDepart()
|
||||
void physics::Vehicle::SetReadyToDepart()
|
||||
{
|
||||
WriteLog("Ready to depart");
|
||||
CompressedVolume = VeselVolume * MinCompressor * 9.8 / 10.0;
|
||||
@@ -445,7 +445,7 @@ void TMoverParameters::SetReadyToDepart()
|
||||
}
|
||||
|
||||
// the air and the brakes of a vehicle standing braked
|
||||
void TMoverParameters::SetBraked()
|
||||
void physics::Vehicle::SetBraked()
|
||||
{
|
||||
WriteLog("Braked");
|
||||
Volume = BrakeVVolume * MaxBrakePress[3];
|
||||
|
||||
Reference in New Issue
Block a user