mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 16:19:19 +02:00
Simplify derailing logic, derail reason enum
- The `TMoverParameters::derail()` function has been renamed to `::Derail()`, with a capital D. - All derail events now use that function. - Simplified and unified the logic behind different derail types. - The `dtrack_freerail` track type is now slightly increasing the chance of derailing on a tight curve, as it was the intention. - A new `DerailReason` enum has been created which holds all derail types. - The `DerailReason` field in the `TMoverParameters` class has been removed. - This was a transient field which is not necessary anymore. - The logging functionality as such has been moved from `DynObj.cpp` to `Mover.cpp`.
This commit is contained in:
@@ -122,7 +122,18 @@ static int const dtrain_loaddestroyed = 32;/*dla wagonow*/
|
||||
static int const dtrain_axle = 64;
|
||||
static int const dtrain_out = 128; /*wykolejenie*/
|
||||
static int const dtrain_pantograph = 256; /*polamanie pantografu*/
|
||||
/*wagi prawdopodobienstwa dla funkcji FuzzyLogic*/
|
||||
|
||||
/*przyczyny wykolejenia*/
|
||||
enum DerailReason {
|
||||
NONE = 0,
|
||||
END_OF_TRACK = 1, // Ra: powód wykolejenia: brak szyn
|
||||
TOO_HIGH_SPEED = 2, // Ra: powód wykolejenia: przewrócony na łuku
|
||||
GAUGE_MISMATCH = 3, // Ra: powód wykolejenia: za szeroki tor
|
||||
WRONG_TRACK_TYPE = 4, // Ra: powód wykolejenia: nieodpowiednia trajektoria
|
||||
COLLISION = 5, // powód wykolejenia: zderzenie z innym pojazdem
|
||||
};
|
||||
|
||||
/*wagi prawdopodobienstwa dla funkcji FuzzyLogic*/
|
||||
#define p_elengproblem (1e-02)
|
||||
#define p_elengdamage (1e-01)
|
||||
#define p_coupldmg (2e-03)
|
||||
@@ -1590,7 +1601,6 @@ class TMoverParameters
|
||||
|
||||
int DamageFlag = 0; // kombinacja bitowa stalych dtrain_* }
|
||||
int EngDmgFlag = 0; // kombinacja bitowa stalych usterek}
|
||||
int DerailReason = 0; // przyczyna wykolejenia
|
||||
|
||||
// EndSignalsFlag: byte; {ABu 060205: zmiany - koncowki: 1/16 - swiatla prz/tyl, 2/31 - blachy prz/tyl}
|
||||
// HeadSignalsFlag: byte; {ABu 060205: zmiany - swiatla: 1/2/4 - przod, 16/32/63 - tyl}
|
||||
@@ -1832,7 +1842,7 @@ public:
|
||||
int DettachStatus(int ConnectNo);
|
||||
bool Dettach(int ConnectNo);
|
||||
void damage_coupler( int const End );
|
||||
void derail( int const Reason );
|
||||
void Derail(DerailReason Reason);
|
||||
bool DirectionForward();
|
||||
bool DirectionBackward( void );/*! kierunek ruchu*/
|
||||
bool EIMDirectionChangeAllow( void ) const;
|
||||
|
||||
Reference in New Issue
Block a user