16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 12:49:18 +02:00

reformat: remove redundant 'inline' specifier

This commit is contained in:
jerrrrycho
2026-07-04 05:58:21 +02:00
parent b4b6686320
commit 6e4d000ddb
85 changed files with 877 additions and 988 deletions

View File

@@ -29,19 +29,19 @@ public:
///Loads info about coupler.
void Load(cParser *Parser, TModel3d *Model);
int GetStatus();
inline void TurnOn() ///Turns on straight coupler.
void TurnOn() ///Turns on straight coupler.
{
On = true;
xOn = false;
Update();
};
inline void TurnOff() ///Turns on disconnected coupler.
void TurnOff() ///Turns on disconnected coupler.
{
On = false;
xOn = false;
Update();
};
inline void TurnxOn() ///Turns on slanted coupler.
void TurnxOn() ///Turns on slanted coupler.
{
On = false;
xOn = true;
@@ -49,7 +49,7 @@ public:
};
// if the xOn model is missing, activate plain On instead
inline void TurnxOnWithOnAsFallback()
void TurnxOnWithOnAsFallback()
{
if (ModelxOn != nullptr) {
On = false;
@@ -61,7 +61,7 @@ public:
}
};
// if the xOn model is missing, activate plain Off instead
inline void TurnxOnWithOffAsFallback()
void TurnxOnWithOffAsFallback()
{
if (ModelxOn != nullptr) {
On = false;
@@ -72,7 +72,7 @@ public:
TurnOff();
}
};
inline bool Active() const
bool Active() const
{
return ModelOn != nullptr || ModelxOn != nullptr;
};

View File

@@ -18,25 +18,22 @@ class TButton {
public:
// methods
TButton() = default;
void Clear(int const i = -1);
inline
void FeedbackBitSet( int const i ) {
void Clear(int i = -1);
void FeedbackBitSet( int const i ) {
iFeedbackBit = 1 << i; };
void Turn( bool const State );
inline
bool GetValue() const {
void Turn( bool State );
bool GetValue() const {
return m_state; }
inline
bool Active() {
bool Active() {
return pModelOn != nullptr || pModelOff != nullptr; }
void Update( bool const Power = true );
void Update( bool Power = true );
bool Init( std::string const &asName, TModel3d const *pModel, bool bNewOn = false );
void Load( cParser &Parser, TDynamicObject const *Owner );
void AssignBool(bool const *bValue);
// returns offset of submodel associated with the button from the model centre
glm::vec3 model_offset() const;
void gain(float new_volume);
inline uint8_t b() { return m_state ? 1 : 0; };
uint8_t b() { return m_state ? 1 : 0; };
private:
// methods

View File

@@ -19,7 +19,7 @@ class TCamera {
public: // McZapkie: potrzebuje do kiwania na boki
void Init(glm::dvec3 const &Location, glm::dvec3 const &Angle, TDynamicObject *Owner);
void Reset();
void OnCursorMove(double const x, double const y);
void OnCursorMove(double x, double y);
bool OnCommand( command_data const &Command );
void Update();
bool SetMatrix(glm::dmat4 &Matrix);

View File

@@ -172,8 +172,7 @@ class TSpeedPos
void Clear();
bool Update();
// aktualizuje odległość we wpisie
inline
void
void
UpdateDistance( double dist ) {
fDist -= dist; }
bool Set(basic_event *e, double d, double length, TOrders order = Wait_for_orders);
@@ -221,48 +220,35 @@ public:
public:
void Update( double dt ); // uruchamiac przynajmniej raz na sekundę
void MoveTo( TDynamicObject *to );
void TakeControl( bool const Aidriver, bool const Forcevehiclecheck = false );
inline
bool primary( bool const Primary ) {
void TakeControl( bool Aidriver, bool Forcevehiclecheck = false );
bool primary( bool const Primary ) {
SetFlag( iDrivigFlags, Primary ? movePrimary : -movePrimary );
return primary(); }
inline
bool primary() const {
bool primary() const {
return (iDrivigFlags & movePrimary) != 0; };
inline
TMoverParameters const *Controlling() const {
TMoverParameters const *Controlling() const {
return mvControlling; }
inline
TMoverParameters const *Occupied() const {
TMoverParameters const *Occupied() const {
return mvOccupied; }
void DirectionInitial();
void DirectionChange();
inline
int Direction() const {
int Direction() const {
return iDirection; }
inline
TAction & action() {
TAction & action() {
return eAction; }
inline
TAction const & action() const {
TAction const & action() const {
return eAction; }
inline
bool is_active() const {
bool is_active() const {
return TestFlag( iDrivigFlags, moveActive ); }
inline
bool is_train() const {
bool is_train() const {
return TestFlag( mvOccupied->CategoryFlag, 1 ); }
inline
bool is_car() const {
bool is_car() const {
return TestFlag( mvOccupied->CategoryFlag, 2 ); }
inline
bool is_emu() const {
bool is_emu() const {
return mvControlling->TrainType == dt_EZT; }
inline
bool is_dmu() const {
bool is_dmu() const {
return mvControlling->TrainType == dt_DMU; }
inline
bool has_diesel_engine() const {
bool has_diesel_engine() const {
return mvControlling->EngineType == TEngineType::DieselElectric || mvControlling->EngineType == TEngineType::DieselEngine;
}
TBrakeSystem consist_brake_system() const;
@@ -276,11 +262,11 @@ private:
void ZeroLocalBrake();
bool IncSpeed();
bool DecSpeed( bool force = false );
void ZeroSpeed( bool const Enforce = false );
void ZeroSpeed( bool Enforce = false );
bool IncBrakeEIM();
bool DecBrakeEIM();
bool IncSpeedEIM();
bool DecSpeedEIM( int const Amount = 1 );
bool DecSpeedEIM( int Amount = 1 );
void BrakeLevelSet( double b );
bool BrakeLevelAdd( double b );
void SpeedSet();
@@ -303,25 +289,23 @@ private:
double BrakeAccFactor() const;
// modifies brake distance for low target speeds, to ease braking rate in such situations
float
braking_distance_multiplier( float const Targetvelocity ) const;
inline
int DrivigFlags() const {
braking_distance_multiplier( float Targetvelocity ) const;
int DrivigFlags() const {
return iDrivigFlags; };
inline
double DirectionalVel() const {
double DirectionalVel() const {
return mvOccupied->Vel * sign( iDirection * mvOccupied->V ); }
void update_timers( double const dt );
void update_logs( double const dt );
void update_timers( double dt );
void update_logs( double dt );
void determine_consist_state();
void determine_braking_distance();
void determine_proximity_ranges();
void scan_route( double const Range );
void scan_obstacles( double const Range );
void scan_route( double Range );
void scan_obstacles( double Range );
void control_wheelslip();
void control_pantographs();
void control_horns( double const Timedelta );
void control_security_system( double const Timedelta );
void control_horns( double Timedelta );
void control_security_system( double Timedelta );
void control_handles();
void control_lights();
void control_compartment_lights();
@@ -334,15 +318,15 @@ private:
void check_departure();
void UpdateConnect();
void UpdateDisconnect();
int unit_count( int const Threshold ) const;
int unit_count( int Threshold ) const;
void UpdateChangeDirection();
void UpdateLooseShunt();
void UpdateObeyTrain();
void GuardOpenDoor();
void pick_optimal_speed( double const Range );
void pick_optimal_speed( double Range );
void adjust_desired_speed_for_obstacles();
void adjust_desired_speed_for_limits();
void adjust_desired_speed_for_target_speed( double const Range );
void adjust_desired_speed_for_target_speed( double Range );
void adjust_desired_speed_for_current_speed();
void adjust_desired_speed_for_braking_test();
void control_tractive_and_braking_force();
@@ -354,16 +338,16 @@ private:
void increase_tractive_force();
void control_braking_force();
void apply_independent_brake_only();
void check_route_ahead( double const Range );
void check_route_behind( double const Range );
void check_route_ahead( double Range );
void check_route_behind( double Range );
void UpdateBrakingHelper();
void hint( driver_hint const Value, hintpredicate const Predicate, float const Predicateparameter = 0.f );
void hint( driver_hint Value, hintpredicate Predicate, float Predicateparameter = 0.f );
void update_hints();
void remove_hint( driver_hint const Value );
void remove_hint( driver_hint Value );
void remove_train_brake_hints();
void remove_master_controller_hints();
void remove_reverser_hints();
void cue_action( driver_hint const Action, float const Actionparameter = 0.f );
void cue_action( driver_hint Action, float Actionparameter = 0.f );
// members
public:
bool AIControllFlag = false; // rzeczywisty/wirtualny maszynista
@@ -472,12 +456,12 @@ public:
void PutCommand( std::string NewCommand, double NewValue1, double NewValue2, const TLocation &NewLocation, TStopReason reason = stopComm );
bool PutCommand( std::string NewCommand, double NewValue1, double NewValue2, glm::dvec3 const *NewLocation, TStopReason reason = stopComm );
// defines assignment data
inline auto assignment() -> std::string & { return m_assignment; }
inline auto assignment() const -> std::string const & { return m_assignment; }
auto assignment() -> std::string & { return m_assignment; }
auto assignment() const -> std::string const & { return m_assignment; }
std::string OrderCurrent() const;
private:
void RecognizeCommand(); // odczytuje komende przekazana lokomotywie
void JumpToNextOrder( bool const Skipmergedchangedirection = false );
void JumpToNextOrder( bool Skipmergedchangedirection = false );
void JumpToFirstOrder();
void OrderPush( TOrders NewOrder );
void OrderNext( TOrders NewOrder );
@@ -486,7 +470,7 @@ private:
void OrderCheck();
void OrdersInit( double fVel );
void OrdersClear();
void OrdersDump( std::string const Neworder, bool const Verbose = true );
void OrdersDump( std::string Neworder, bool Verbose = true );
std::string Order2Str( TOrders Order ) const;
// members
std::string m_assignment;
@@ -499,39 +483,39 @@ private:
// methods
public:
int CrossRoute( TTrack *tr );
inline void MoveDistanceAdd( double distance ) {
void MoveDistanceAdd( double distance ) {
dMoveLen += distance * iDirection;
} //jak jedzie do tyłu to trzeba uwzględniać, że distance jest ujemna
private:
// Ra: metody obsługujące skanowanie toru
std::vector<basic_event *> CheckTrackEvent( TTrack *Track, double const fDirection ) const;
std::vector<basic_event *> CheckTrackEvent( TTrack *Track, double fDirection ) const;
bool TableAddNew();
bool TableNotFound( basic_event const *Event, double const Distance ) const;
bool TableNotFound( basic_event const *Event, double Distance ) const;
void TableTraceRoute( double fDistance, TDynamicObject *pVehicle );
void TableCheck( double fDistance );
TCommandType TableUpdate( double &fVelDes, double &fDist, double &fNext, double &fAcc );
bool TableUpdateStopPoint( TCommandType &Command, TSpeedPos &Point, double const Signaldistance );
bool TableUpdateEvent( double &Velocity, TCommandType &Command, TSpeedPos &Point, double &Signaldistance, int const Pointindex );
bool TableUpdateStopPoint( TCommandType &Command, TSpeedPos &Point, double Signaldistance );
bool TableUpdateEvent( double &Velocity, TCommandType &Command, TSpeedPos &Point, double &Signaldistance, int Pointindex );
// returns most recently calculated distance to potential obstacle ahead
double TrackObstacle() const;
void TablePurger();
void TableSort();
inline double MoveDistanceGet() const {
double MoveDistanceGet() const {
return dMoveLen;
}
inline void MoveDistanceReset() {
void MoveDistanceReset() {
dMoveLen = 0.0;
}
std::size_t TableSize() const { return sSpeedTable.size(); }
void TableClear();
int TableDirection() { return iTableDirection; }
// Ra: stare funkcje skanujące, używane do szukania sygnalizatora z tyłu
bool IsOccupiedByAnotherConsist( TTrack *Track, double const Distance );
basic_event *CheckTrackEventBackward( double fDirection, TTrack *Track, TDynamicObject *Vehicle, int const Eventdirection = 1, end const End = rear );
TTrack *BackwardTraceRoute( double &fDistance, double &fDirection, TDynamicObject *Vehicle, basic_event *&Event, int const Eventdirection = 1, end const End = rear, bool const Untiloccupied = true );
bool IsOccupiedByAnotherConsist( TTrack *Track, double Distance );
basic_event *CheckTrackEventBackward( double fDirection, TTrack *Track, TDynamicObject *Vehicle, int Eventdirection = 1, end End = rear );
TTrack *BackwardTraceRoute( double &fDistance, double &fDirection, TDynamicObject *Vehicle, basic_event *&Event, int Eventdirection = 1, end End = rear, bool Untiloccupied = true );
void SetProximityVelocity( double dist, double vel, glm::dvec3 const *pos );
TCommandType BackwardScan( double const Range );
std::string TableText( std::size_t const Index ) const;
TCommandType BackwardScan( double Range );
std::string TableText( std::size_t Index ) const;
/*
void RouteSwitch(int d);
*/
@@ -582,12 +566,12 @@ public:
private:
bool PrepareEngine();
bool ReleaseEngine();
void Doors( bool const Open, int const Side = 0 );
void Doors( bool Open, int Side = 0 );
// returns true if any vehicle in the consist has an open door
bool doors_open() const;
bool doors_permit_active() const;
void AutoRewident(); // ustawia hamulce w składzie
void announce( announcement_t const Announcement );
void announce( announcement_t Announcement );
// members
double fLength = 0.0; // długość składu (do wyciągania z ograniczeń)
double fMass = 0.0; // całkowita masa do liczenia stycznej składowej grawitacji

View File

@@ -217,12 +217,12 @@ public:
std::string asDestination; // dokąd pojazd ma być kierowany "(stacja):(tor)"
glm::dmat4 mMatrix; // macierz przekształcenia do renderowania modeli
TMoverParameters *MoverParameters; // parametry fizyki ruchu oraz przeliczanie
inline TDynamicObject *NextConnected() { return MoverParameters->Neighbours[ rear ].vehicle; }; // pojazd podłączony od strony sprzęgu 1 (kabina -1)
inline TDynamicObject *PrevConnected() { return MoverParameters->Neighbours[ front ].vehicle; }; // pojazd podłączony od strony sprzęgu 0 (kabina 1)
inline TDynamicObject *NextConnected() const { return MoverParameters->Neighbours[ rear ].vehicle; }; // pojazd podłączony od strony sprzęgu 1 (kabina -1)
inline TDynamicObject *PrevConnected() const { return MoverParameters->Neighbours[ front ].vehicle; }; // pojazd podłączony od strony sprzęgu 0 (kabina 1)
inline int NextConnectedNo() const { return MoverParameters->Neighbours[ rear ].vehicle_end; }
inline int PrevConnectedNo() const { return MoverParameters->Neighbours[ front ].vehicle_end; }
TDynamicObject *NextConnected() { return MoverParameters->Neighbours[ rear ].vehicle; }; // pojazd podłączony od strony sprzęgu 1 (kabina -1)
TDynamicObject *PrevConnected() { return MoverParameters->Neighbours[ front ].vehicle; }; // pojazd podłączony od strony sprzęgu 0 (kabina 1)
TDynamicObject *NextConnected() const { return MoverParameters->Neighbours[ rear ].vehicle; }; // pojazd podłączony od strony sprzęgu 1 (kabina -1)
TDynamicObject *PrevConnected() const { return MoverParameters->Neighbours[ front ].vehicle; }; // pojazd podłączony od strony sprzęgu 0 (kabina 1)
int NextConnectedNo() const { return MoverParameters->Neighbours[ rear ].vehicle_end; }
int PrevConnectedNo() const { return MoverParameters->Neighbours[ front ].vehicle_end; }
// Dev tools
void Reload();
@@ -272,8 +272,7 @@ private:
material_data m_materialdata;
public:
inline
material_data const
material_data const
*Material() const {
return &m_materialdata; }
// tymczasowo udostępnione do wyszukiwania drutu
@@ -436,8 +435,8 @@ private:
sound_source rsEngageSlippery { sound_placement::engine }; // moved from cab
sound_source retarder { sound_placement::engine };
void position( glm::vec3 const Location );
void render( TMoverParameters const &Vehicle, double const Deltatime );
void position( glm::vec3 Location );
void render( TMoverParameters const &Vehicle, double Deltatime );
};
// single source per door (pair) on the centreline
struct doorspeaker_sounds {
@@ -464,7 +463,7 @@ private:
void ABuModelRoll();
void TurnOff();
// update state of load exchange operation
void update_exchange( double const Deltatime );
void update_exchange( double Deltatime );
// members
AirCoupler btCoupler1; // sprzegi
@@ -606,7 +605,7 @@ private:
std::string asModel;
private:
TDynamicObject *ABuFindObject( int &Foundcoupler, double &Distance, TTrack const *Track, int const Direction, int const Mycoupler ) const;
TDynamicObject *ABuFindObject( int &Foundcoupler, double &Distance, TTrack const *Track, int Direction, int Mycoupler ) const;
void ABuCheckMyTrack();
std::string rTypeName; // nazwa typu pojazdu
@@ -618,7 +617,7 @@ private:
bool HeadlightsAoff{false}; // wygaszone swiatelki A
bool HeadlightsBoff{false}; // wygaszone swiatelki B
// checks whether there's unbroken connection of specified type to specified vehicle
bool is_connected( TDynamicObject const *Vehicle, coupling const Coupling = coupler ) const;
bool is_connected( TDynamicObject const *Vehicle, coupling Coupling = coupler ) const;
TDynamicObject * PrevAny() const;
TDynamicObject * Prev(int C = -1) const;
TDynamicObject * Next(int C = -1) const;
@@ -670,15 +669,15 @@ private:
std::string Name, std::string BaseDir, std::string asReplacableSkin, std::string Type_Name,
TTrack *Track, double fDist, std::string DriverType, double fVel, std::string TrainName,
float Load, std::string LoadType, bool Reversed, std::string);
int init_sections( TModel3d const *Model, std::string const &Nameprefix, bool const Overrideselfillum );
int init_sections( TModel3d const *Model, std::string const &Nameprefix, bool Overrideselfillum );
bool init_destination( TModel3d *Model );
void create_controller( std::string const Type, bool const Trainset );
void create_controller( std::string Type, bool Trainset );
void AttachNext(TDynamicObject *Object, int iType = 1);
bool UpdateForce(double dt);
// initiates load change by specified amounts, with a platform on specified side
void LoadExchange( int const Disembark, int const Embark, int const Platforms );
void LoadExchange( int Disembark, int Embark, int Platforms );
// calculates time needed to complete current load change, using specified platforms
float LoadExchangeTime( int const Platforms );
float LoadExchangeTime( int Platforms );
// calculates time needed to complete current load change, using previously specified platforms
float LoadExchangeTime() const;
// calculates current load exchange factor, where 1 = nominal rate, higher = faster
@@ -694,83 +693,83 @@ private:
void Move(double fDistance);
void FastMove(double fDistance);
void RenderSounds();
inline glm::dvec3 GetPosition() const {
glm::dvec3 GetPosition() const {
return vPosition; };
// converts location from vehicle coordinates frame to world frame
inline glm::dvec3 GetWorldPosition( glm::dvec3 const &Location ) const {
glm::dvec3 GetWorldPosition( glm::dvec3 const &Location ) const {
return vPosition + glm::dvec3(mMatrix * glm::dvec4(Location, 1.0)); }
// pobranie współrzędnych czoła
inline glm::dvec3 HeadPosition() const {
glm::dvec3 HeadPosition() const {
return vCoulpler[iDirection ^ 1]; };
// pobranie współrzędnych tyłu
inline glm::dvec3 RearPosition() const {
glm::dvec3 RearPosition() const {
return vCoulpler[iDirection]; };
inline glm::dvec3 CouplerPosition( end const End ) const {
glm::dvec3 CouplerPosition( end const End ) const {
return vCoulpler[ End ]; }
inline glm::dvec3 AxlePositionGet() {
glm::dvec3 AxlePositionGet() {
return iAxleFirst ?
Axle1.pPosition :
Axle0.pPosition; };
inline double Roll() {
double Roll() {
return Axle1.GetRoll() + Axle0.GetRoll(); }
/*
// TODO: check if scanning takes into account direction when selecting axle
// if it does, replace the version above
// if it doesn't, fix it so it does
inline glm::dvec3 AxlePositionGet() {
return (
iDirection ?
( iAxleFirst ? Axle1.pPosition : Axle0.pPosition ) :
( iAxleFirst ? Axle0.pPosition : Axle1.pPosition ) ); }
*/
inline glm::dvec3 VectorFront() const {
// TODO: check if scanning takes into account direction when selecting axle
// if it does, replace the version above
// if it doesn't, fix it so it does
inline glm::dvec3 AxlePositionGet() {
return (
iDirection ?
( iAxleFirst ? Axle1.pPosition : Axle0.pPosition ) :
( iAxleFirst ? Axle0.pPosition : Axle1.pPosition ) ); }
*/
glm::dvec3 VectorFront() const {
return vFront; };
inline glm::dvec3 VectorUp() const {
glm::dvec3 VectorUp() const {
return vUp; };
inline glm::dvec3 VectorLeft() const {
glm::dvec3 VectorLeft() const {
return vLeft; };
inline double const * Matrix() const {
double const * Matrix() const {
return glm::value_ptr(mMatrix); };
inline double * Matrix() {
double * Matrix() {
return glm::value_ptr(mMatrix); };
inline double GetVelocity() const {
double GetVelocity() const {
return MoverParameters->Vel; };
inline double GetLength() const {
double GetLength() const {
return MoverParameters->Dim.L; };
inline double GetWidth() const {
double GetWidth() const {
return MoverParameters->Dim.W; };
double radius() const;
// calculates distance between event-starting axle and front of the vehicle
double tracing_offset() const;
inline TTrack * GetTrack() {
TTrack * GetTrack() {
return iAxleFirst ? Axle1.GetTrack() : Axle0.GetTrack(); };
// McZapkie-260202
void LoadMMediaFile(std::string const &TypeName, std::string const &ReplacableSkin);
TModel3d *LoadMMediaFile_mdload( std::string const &Name ) const;
inline double ABuGetDirection() const { // ABu.
double ABuGetDirection() const { // ABu.
return Axle1.GetTrack() == MyTrack ? Axle1.GetDirection() : Axle0.GetDirection(); };
// zwraca kierunek pojazdu na torze z aktywną osą
inline double RaDirectionGet() const {
double RaDirectionGet() const {
return iAxleFirst ?
Axle1.GetDirection() :
Axle0.GetDirection(); };
// zwraca przesunięcie wózka względem Point1 toru z aktywną osią
inline double RaTranslationGet() const {
double RaTranslationGet() const {
return iAxleFirst ?
Axle1.GetTranslation() :
Axle0.GetTranslation(); };
// zwraca tor z aktywną osią
inline TTrack const * RaTrackGet() const {
TTrack const * RaTrackGet() const {
return iAxleFirst ?
Axle1.GetTrack() :
Axle0.GetTrack(); };
void couple( int const Side );
int uncouple( int const Side );
bool attach_coupler_adapter( int const Side, bool const Enforce = false );
bool remove_coupler_adapter( int const Side );
void couple( int Side );
int uncouple( int Side );
bool attach_coupler_adapter( int Side, bool Enforce = false );
bool remove_coupler_adapter( int Side );
void RadioStop();
void Damage(char flag);
void pants_up();
@@ -781,8 +780,8 @@ private:
bool has_signal_pc1_on() const;
bool has_signal_pc2_on() const;
bool has_signal_pc5_on() const;
bool has_signal_on( int const Side, int const Pattern ) const;
void set_cab_lights( int const Cab, float const Level );
bool has_signal_on( int Side, int Pattern ) const;
void set_cab_lights( int Cab, float Level );
TDynamicObject * FirstFind(int &coupler_nr, int cf = 1);
float GetEPP(); // wyliczanie sredniego cisnienia w PG
int DirectionSet(int d); // ustawienie kierunku w składzie
@@ -795,14 +794,14 @@ private:
// updates potential collision sources
void update_neighbours();
// locates potential collision source within specified range, scanning its route in specified direction
auto find_vehicle( int const Direction, double const Range ) const -> std::tuple<TDynamicObject *, int, double, bool>;
auto find_vehicle( int Direction, double Range ) const -> std::tuple<TDynamicObject *, int, double, bool>;
// locates potential vehicle connected with specific coupling type and satisfying supplied predicate
template <typename Predicate_>
auto find_vehicle( coupling const Coupling, Predicate_ const Predicate ) -> TDynamicObject *;
auto find_vehicle( coupling Coupling, Predicate_ Predicate ) -> TDynamicObject *;
TDynamicObject * FindPowered();
TDynamicObject * FindPantographCarrier();
template <typename UnaryFunction_>
void for_each( coupling const Coupling, UnaryFunction_ const Function );
void for_each( coupling Coupling, UnaryFunction_ Function );
void ParamSet(int what, int into);
// zapytanie do AI, po którym segmencie skrzyżowania jechać
int RouteWish(TTrack *tr);
@@ -812,7 +811,7 @@ private:
glm::dvec3 get_future_movement() const;
void move_set(double distance);
// playes specified announcement, potentially preceding it with a chime
void announce( announcement_t const Announcement, bool const Chime = true );
void announce( announcement_t Announcement, bool Chime = true );
// returns soundproofing for specified sound type and listener location
float soundproofing( int const Placement, int const Listener ) const {
return m_soundproofing[ Placement - 1 ][ Listener + 1 ]; }
@@ -829,7 +828,7 @@ private:
// TBD, TODO: make an object out of it
public:
// methods
void update_shake( double const Timedelta );
void update_shake( double Timedelta );
std::pair<double, double> shake_angles() const;
// members
struct baseshake_config {
@@ -874,7 +873,7 @@ public:
update_traction( TDynamicObject *Vehicle );
// legacy method, sends list of vehicles over network
void
DynamicList( bool const Onlycontrolled = false ) const;
DynamicList( bool Onlycontrolled = false ) const;
private:
// maintenance; removes from tracks consists with vehicles marked as disabled

View File

@@ -38,17 +38,16 @@ public:
TGauge() = default;
explicit TGauge( sound_source const &Soundtemplate );
inline
void Clear() {
void Clear() {
*this = TGauge(); }
void Init(TSubModel *Submodel, TSubModel *Submodelon, TGaugeAnimation Type, float Scale = 1, float Offset = 0, float Friction = 0, float Value = 0, float const Endvalue = -1.0, float const Endscale = -1.0, bool const Interpolate = false );
void Load(cParser &Parser, TDynamicObject const *Owner, double const mul = 1.0);
void Init(TSubModel *Submodel, TSubModel *Submodelon, TGaugeAnimation Type, float Scale = 1, float Offset = 0, float Friction = 0, float Value = 0, float Endvalue = -1.0, float Endscale = -1.0, bool Interpolate = false );
void Load(cParser &Parser, TDynamicObject const *Owner, double mul = 1.0);
bool UpdateValue( float fNewDesired );
bool UpdateValue( float fNewDesired, std::optional<sound_source> &Fallbacksound );
void PutValue(float fNewDesired);
float GetValue() const;
float GetDesiredValue() const;
void Update( bool const Power = true );
void Update( bool Power = true );
void AssignFloat(float *fValue);
void AssignDouble(double *dValue);
void AssignInt(int *iValue);
@@ -58,11 +57,9 @@ public:
// returns offset of submodel associated with the button from the model centre
glm::vec3 model_offset() const;
TGaugeType type() const;
inline
bool is_push() const {
bool is_push() const {
return ( static_cast<int>( type() ) & static_cast<int>( TGaugeType::push ) ) != 0; }
inline
bool is_toggle() const {
bool is_toggle() const {
return ( static_cast<int>( type() ) & static_cast<int>( TGaugeType::toggle ) ) != 0; }
bool is_delayed() const {
return ( static_cast<int>( type() ) & static_cast<int>( TGaugeType::delayed ) ) != 0; }

View File

@@ -35,7 +35,7 @@ class TCab {
public:
// methods
void Load(cParser &Parser);
void Update( bool const Power );
void Update( bool Power );
TGauge &Gauge( int n = -1 ); // pobranie adresu obiektu
TButton &Button( int n = -1 ); // pobranie adresu obiektu
// members
@@ -71,7 +71,7 @@ public:
std::string
find( TSubModel const *Control ) const;
bool
contains( std::string const Control ) const;
contains( std::string Control ) const;
};
class TTrain {
@@ -153,30 +153,28 @@ class TTrain {
// McZapkie-010302
bool Init(TDynamicObject *NewDynamicObject, bool e3d = false);
inline glm::dvec3 GetDirection() const
glm::dvec3 GetDirection() const
{
return DynamicObject->VectorFront(); };
inline glm::dvec3 GetUp() const
glm::dvec3 GetUp() const
{
return DynamicObject->VectorUp(); };
inline
std::string GetLabel( TSubModel const *Control ) const {
std::string GetLabel( TSubModel const *Control ) const {
return m_controlmapper.find( Control ); }
void UpdateCab();
bool Update( double const Deltatime );
bool Update( double Deltatime );
void UpdateDirectionRelays();
void SetupDirectionRelays();
bool prevBatState = false;
int prevDirection = 0;
void add_distance( double const Distance );
void add_distance( double Distance );
// McZapkie-310302: ladowanie parametrow z pliku
bool LoadMMediaFile(std::string const &asFileName);
std::shared_ptr<dictionary_source> GetTrainState( dictionary_source const &Extraparameters );
state_t get_state() const;
inline float get_radiovolume() const { return m_radiovolume; }
float get_radiovolume() const { return m_radiovolume; }
// basic_table interface
inline
std::string name() const {
std::string name() const {
return Dynamic()->name(); }
private:
@@ -188,39 +186,37 @@ class TTrain {
void clear_cab_controls();
// sets cabin controls based on current state of the vehicle
// NOTE: we can get rid of this function once we have per-cab persistent state
void set_cab_controls( int const Cab );
void set_cab_controls( int Cab );
// initializes a gauge matching provided label. returns: true if the label was found, false otherwise
bool initialize_gauge(cParser &Parser, std::string const &Label, int const Cabindex);
bool initialize_gauge(cParser &Parser, std::string const &Label, int Cabindex);
// initializes a button matching provided label. returns: true if the label was found, false otherwise
bool initialize_button(cParser &Parser, std::string const &Label, int const Cabindex);
bool initialize_button(cParser &Parser, std::string const &Label, int Cabindex);
// helper, returns true for EMU with oerlikon brake
bool is_eztoer() const;
// locates nearest vehicle belonging to the consist
TDynamicObject *find_nearest_consist_vehicle(bool freefly, glm::vec3 pos) const;
// mover master controller to specified position
void set_master_controller( double const Position );
void set_master_controller( double Position );
// moves train brake lever to specified position, potentially emits switch sound if conditions are met
void set_train_brake( double const Position );
void set_train_brake( double Position );
// potentially moves train brake lever to neutral position
void zero_charging_train_brake();
// sets specified brake acting speed for specified vehicle, potentially updating state of cab controls to match
void set_train_brake_speed( TDynamicObject *Vehicle, int const Speed );
void set_train_brake_speed( TDynamicObject *Vehicle, int Speed );
// sets the motor connector button in paired unit to specified state
void set_paired_open_motor_connectors_button( bool const State );
void set_paired_open_motor_connectors_button( bool State );
// helper, common part of pantograph selection methods
void change_pantograph_selection( int const Change );
void change_pantograph_selection( int Change );
// helper, common part of pantograh valves state update methods
void update_pantograph_valves();
// update function subroutines
void update_sounds( double const Deltatime );
void update_sounds( double Deltatime );
void update_sounds_runningnoise( sound_source &Sound );
void update_sounds_resonancenoise( sound_source &Sound );
void update_sounds_radio();
inline
end cab_to_end( int const End ) const {
end cab_to_end( int const End ) const {
return End == 2 ? rear : front; }
inline
end cab_to_end() const {
end cab_to_end() const {
return cab_to_end( iCabn ); }
void update_screens(double dt);
@@ -922,19 +918,19 @@ private:
float fDieselParams[9][10]; // parametry dla silnikow asynchronicznych
// plays provided sound from position of the radio
bool radio_message_played;
void radio_message( sound_source *Message, int const Channel );
inline auto const RadioChannel() const { return Dynamic()->Mechanik ? Dynamic()->Mechanik->iRadioChannel : 1; }
inline auto &RadioChannel() { return Dynamic()->Mechanik->iRadioChannel; }
inline TDynamicObject *Dynamic() { return DynamicObject; };
inline TDynamicObject const *Dynamic() const { return DynamicObject; };
inline TMoverParameters *Controlled() { return mvControlled; };
inline TMoverParameters const *Controlled() const { return mvControlled; };
inline TMoverParameters *Occupied() { return mvOccupied; };
inline TMoverParameters const *Occupied() const { return mvOccupied; };
void radio_message( sound_source *Message, int Channel );
auto const RadioChannel() const { return Dynamic()->Mechanik ? Dynamic()->Mechanik->iRadioChannel : 1; }
auto &RadioChannel() { return Dynamic()->Mechanik->iRadioChannel; }
TDynamicObject *Dynamic() { return DynamicObject; };
TDynamicObject const *Dynamic() const { return DynamicObject; };
TMoverParameters *Controlled() { return mvControlled; };
TMoverParameters const *Controlled() const { return mvControlled; };
TMoverParameters *Occupied() { return mvOccupied; };
TMoverParameters const *Occupied() const { return mvOccupied; };
void DynamicSet(TDynamicObject *d);
void MoveToVehicle( TDynamicObject *target );
// checks whether specified point is within boundaries of the active cab
bool point_inside(glm::dvec3 const Point) const;
bool point_inside(glm::dvec3 Point) const;
glm::dvec3 clamp_inside(glm::dvec3 const &Point) const;
const screenentry_sequence & get_screens();
@@ -946,7 +942,7 @@ class train_table : public basic_table<TTrain> {
public:
void update( double dt );
void updateAsync( double dt );
TTrain *find_id( std::uint16_t const Id ) const;
TTrain *find_id( std::uint16_t Id ) const;
};
//---------------------------------------------------------------------------