mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-01 22:07:55 +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:
+11
-11
@@ -10,7 +10,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
// the cab: activation, the direction, the horns, the pullee mode
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "physics/mover.h"
|
||||
#include "physics/vehicle.h"
|
||||
#include "vehicle/DynObj.h"
|
||||
#include "physics/oerlikonest.h"
|
||||
#include "utilities/Globals.h"
|
||||
@@ -30,7 +30,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "physics/components/internal.h"
|
||||
|
||||
|
||||
bool TMoverParameters::DirectionForward()
|
||||
bool physics::Vehicle::DirectionForward()
|
||||
{
|
||||
if (false == EIMDirectionChangeAllow())
|
||||
{
|
||||
@@ -49,7 +49,7 @@ bool TMoverParameters::DirectionForward()
|
||||
return false;
|
||||
};
|
||||
|
||||
bool TMoverParameters::ChangeCab(int direction)
|
||||
bool physics::Vehicle::ChangeCab(int direction)
|
||||
{ // zmiana kabiny i resetowanie ustawien
|
||||
if (std::abs(CabOccupied + direction) < 2)
|
||||
{
|
||||
@@ -69,7 +69,7 @@ bool TMoverParameters::ChangeCab(int direction)
|
||||
return false;
|
||||
};
|
||||
|
||||
int TMoverParameters::SoundingHorns(int const Signal) const
|
||||
int physics::Vehicle::SoundingHorns(int const Signal) const
|
||||
{
|
||||
auto const supplied{[this](horn_supply const Supply) {
|
||||
if (Supply == horn_supply::electric)
|
||||
@@ -101,7 +101,7 @@ int TMoverParameters::SoundingHorns(int const Signal) const
|
||||
// Q: 20160710
|
||||
// załączenie rozrządu
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::CabActivisation(bool const Enforce)
|
||||
bool physics::Vehicle::CabActivisation(bool const Enforce)
|
||||
{
|
||||
bool OK = false;
|
||||
|
||||
@@ -127,7 +127,7 @@ bool TMoverParameters::CabActivisation(bool const Enforce)
|
||||
return OK;
|
||||
}
|
||||
|
||||
bool TMoverParameters::CabActivisationAuto(bool const Enforce)
|
||||
bool physics::Vehicle::CabActivisationAuto(bool const Enforce)
|
||||
{
|
||||
bool OK = AutomaticCabActivation ? CabActivisation(Enforce) : false;
|
||||
return OK;
|
||||
@@ -137,7 +137,7 @@ bool TMoverParameters::CabActivisationAuto(bool const Enforce)
|
||||
// Q: 20160710
|
||||
// wyłączenie rozrządu
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::CabDeactivisation(bool const Enforce)
|
||||
bool physics::Vehicle::CabDeactivisation(bool const Enforce)
|
||||
{
|
||||
bool OK = false;
|
||||
|
||||
@@ -174,7 +174,7 @@ bool TMoverParameters::CabDeactivisation(bool const Enforce)
|
||||
return OK;
|
||||
}
|
||||
|
||||
bool TMoverParameters::CabDeactivisationAuto(bool const Enforce)
|
||||
bool physics::Vehicle::CabDeactivisationAuto(bool const Enforce)
|
||||
{
|
||||
bool OK = AutomaticCabActivation ? CabDeactivisation(Enforce) : false;
|
||||
return OK;
|
||||
@@ -192,7 +192,7 @@ bool TMoverParameters::CabDeactivisationAuto(bool const Enforce)
|
||||
// entering it also lets go of the hand brake and of the spring brake switch.
|
||||
// returns whether the mode changed; a vehicle driven from can't enter it
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::PulleeModeSwitch(bool const State)
|
||||
bool physics::Vehicle::PulleeModeSwitch(bool const State)
|
||||
{
|
||||
if (PulleeMode == State || (State && CabActive != 0))
|
||||
{
|
||||
@@ -213,7 +213,7 @@ bool TMoverParameters::PulleeModeSwitch(bool const State)
|
||||
// Q: 20160710
|
||||
// kierunek do tyłu
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::DirectionBackward(void)
|
||||
bool physics::Vehicle::DirectionBackward(void)
|
||||
{
|
||||
if (false == EIMDirectionChangeAllow())
|
||||
{
|
||||
@@ -238,7 +238,7 @@ bool TMoverParameters::DirectionBackward(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TMoverParameters::EIMDirectionChangeAllow(void) const
|
||||
bool physics::Vehicle::EIMDirectionChangeAllow(void) const
|
||||
{
|
||||
bool OK = false;
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user