16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 15:09:19 +02:00

fixes after merge

This commit is contained in:
milek7
2022-01-06 15:49:46 +01:00
parent 3c7ad80252
commit 97af1e7d74
5 changed files with 18 additions and 20 deletions

View File

@@ -881,7 +881,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
eSignNext = nullptr; eSignNext = nullptr;
IsAtPassengerStop = false; IsAtPassengerStop = false;
IsScheduledPassengerStopVisible = false; IsScheduledPassengerStopVisible = false;
mvOccupied->SecuritySystem.SHPLock = false; mvOccupied->SecuritySystem.set_cabsignal_lock(false);
// te flagi są ustawiane tutaj, w razie potrzeby // te flagi są ustawiane tutaj, w razie potrzeby
iDrivigFlags &= ~(moveTrackEnd | moveSwitchFound | moveSignalFound | /*moveSpeedLimitFound*/ moveStopPointFound ); iDrivigFlags &= ~(moveTrackEnd | moveSwitchFound | moveSignalFound | /*moveSpeedLimitFound*/ moveStopPointFound );
@@ -1424,7 +1424,7 @@ TController::TableUpdateEvent( double &Velocity, TCommandType &Command, TSpeedPo
// thus we're doing a more precise check in such situation (we presume direction change takes place only if the vehicle is standing still) // thus we're doing a more precise check in such situation (we presume direction change takes place only if the vehicle is standing still)
if( ( mvOccupied->Vel > EU07_AI_NOMOVEMENT ) if( ( mvOccupied->Vel > EU07_AI_NOMOVEMENT )
|| ( false == ismagnetpassed ) ) { || ( false == ismagnetpassed ) ) {
mvOccupied->SecuritySystem.SHPLock |= ( !AIControllFlag ); // don't make life difficult for the ai, but a human driver is a fair game mvOccupied->SecuritySystem.set_cabsignal_lock(!AIControllFlag); // don't make life difficult for the ai, but a human driver is a fair game
PutCommand( PutCommand(
Point.evEvent->input_text(), Point.evEvent->input_text(),
Point.evEvent->input_value( 1 ), Point.evEvent->input_value( 1 ),
@@ -1434,7 +1434,7 @@ TController::TableUpdateEvent( double &Velocity, TCommandType &Command, TSpeedPo
} }
if( ismagnetpassed ) { if( ismagnetpassed ) {
Point.Clear(); Point.Clear();
mvOccupied->SecuritySystem.SHPLock = false; mvOccupied->SecuritySystem.set_cabsignal_lock(false);
} }
return true; return true;
} }

View File

@@ -648,6 +648,7 @@ class TSecuritySystem
bool enabled = false; bool enabled = false;
bool is_sifa = false; // Sifa-like pedal device, with inverted input for convenient keyboard usage bool is_sifa = false; // Sifa-like pedal device, with inverted input for convenient keyboard usage
bool separate_acknowledge = false; // cabsignal reset button is separate from vigilance bool separate_acknowledge = false; // cabsignal reset button is separate from vigilance
bool cabsignal_lock = false;
double vigilance_timer = 0.0; double vigilance_timer = 0.0;
double alert_timer = 0.0; double alert_timer = 0.0;
@@ -669,6 +670,7 @@ public:
void cabsignal_reset(); void cabsignal_reset();
void update(double dt, double Vel, bool pwr); void update(double dt, double Vel, bool pwr);
void set_cabsignal(); void set_cabsignal();
void set_cabsignal_lock(bool);
bool is_blinking() const; bool is_blinking() const;
bool is_vigilance_blinking() const; bool is_vigilance_blinking() const;
bool is_cabsignal_blinking() const; bool is_cabsignal_blinking() const;
@@ -677,11 +679,9 @@ public:
bool is_braking() const; bool is_braking() const;
bool is_engine_blocked() const; bool is_engine_blocked() const;
bool radiostop_available() const; bool radiostop_available() const;
bool system_available() const;
void load(std::string const &line, double Vmax); void load(std::string const &line, double Vmax);
bool SHPLock = false; double MagnetLocation = 0.0;
double MagnetLocation;
}; };
struct TTransmision struct TTransmision

View File

@@ -95,7 +95,7 @@ void TSecuritySystem::acknowledge_press() {
} }
vigilance_timer = 0.0; vigilance_timer = 0.0;
if (!separate_acknowledge && cabsignal_active) { if (!separate_acknowledge && cabsignal_active && !cabsignal_lock) {
cabsignal_active = false; cabsignal_active = false;
alert_timer = 0.0; alert_timer = 0.0;
} }
@@ -110,7 +110,7 @@ void TSecuritySystem::acknowledge_release() {
} }
void TSecuritySystem::cabsignal_reset() { void TSecuritySystem::cabsignal_reset() {
if (cabsignal_active) { if (cabsignal_active && !cabsignal_lock) {
cabsignal_active = false; cabsignal_active = false;
alert_timer = 0.0; alert_timer = 0.0;
} }
@@ -192,12 +192,12 @@ bool TSecuritySystem::is_cabsignal_beeping() const {
} }
bool TSecuritySystem::is_braking() const { bool TSecuritySystem::is_braking() const {
if (!power && (vigilance_enabled || cabsignal_enabled || radiostop_enabled))
return true;
if (!enabled) if (!enabled)
return false; return false;
if (!power && (vigilance_enabled || cabsignal_enabled))
return true;
return alert_timer > SoundSignalDelay + EmergencyBrakeDelay; return alert_timer > SoundSignalDelay + EmergencyBrakeDelay;
} }
@@ -205,8 +205,8 @@ bool TSecuritySystem::radiostop_available() const {
return radiostop_enabled; return radiostop_enabled;
} }
bool TSecuritySystem::system_available() const { void TSecuritySystem::set_cabsignal_lock(bool v) {
return vigilance_enabled || cabsignal_enabled; cabsignal_lock = v;
} }
bool TSecuritySystem::is_engine_blocked() const { bool TSecuritySystem::is_engine_blocked() const {
@@ -234,6 +234,7 @@ void TSecuritySystem::load(std::string const &line, double Vmax) {
extract_value( EmergencyBrakeDelay, "EmergencyBrakeDelay", line, "" ); extract_value( EmergencyBrakeDelay, "EmergencyBrakeDelay", line, "" );
extract_value( MaxHoldTime, "MaxHoldTime", line, "" ); extract_value( MaxHoldTime, "MaxHoldTime", line, "" );
extract_value( radiostop_enabled, "RadioStop", line, "" ); extract_value( radiostop_enabled, "RadioStop", line, "" );
extract_value( MagnetLocation, "MagnetLocation", line, "" );
} }
double TableInterpolation(std::map<double, double> &Map, double Parameter) double TableInterpolation(std::map<double, double> &Map, double Parameter)
@@ -4450,7 +4451,6 @@ void TMoverParameters::UpdatePipePressure(double dt)
// ulepszony hamulec bezp. // ulepszony hamulec bezp.
EmergencyValveFlow = 0.0; EmergencyValveFlow = 0.0;
auto const securitysystempresent { SecuritySystem.radiostop_available() || SecuritySystem.system_available() };
auto const lowvoltagepower { Power24vIsAvailable || Power110vIsAvailable }; auto const lowvoltagepower { Power24vIsAvailable || Power110vIsAvailable };
if( (( true == RadioStopFlag ) if( (( true == RadioStopFlag )
@@ -4468,9 +4468,7 @@ void TMoverParameters::UpdatePipePressure(double dt)
*/ */
|| ( ( SpringBrakeDriveEmergencyVel >= 0 ) || ( ( SpringBrakeDriveEmergencyVel >= 0 )
&& ( Vel > SpringBrakeDriveEmergencyVel ) && ( Vel > SpringBrakeDriveEmergencyVel )
&& ( SpringBrake.IsActive ) ) && ( SpringBrake.IsActive ) ) ) {
|| ( ( true == securitysystempresent )
&& ( false == lowvoltagepower ) ) ) {
EmergencyValveFlow = PF( 0, PipePress, 0.15 ) * dt; EmergencyValveFlow = PF( 0, PipePress, 0.15 ) * dt;
} }
dpMainValve += EmergencyValveFlow; dpMainValve += EmergencyValveFlow;

View File

@@ -7873,7 +7873,7 @@ void TTrain::update_sounds_radio() {
} }
void TTrain::update_screens() { void TTrain::update_screens() {
if (fScreenTimer > Global.PythonScreenUpdateRate * 0.001f) { if (fScreenTimer > std::max(Global.PythonScreenUpdateRate, ScreenUpdateRate) * 0.001f) {
fScreenTimer = 0.f; fScreenTimer = 0.f;
for (auto const &screen : m_screens) { for (auto const &screen : m_screens) {
auto state_dict = GetTrainState(screen.parameters); auto state_dict = GetTrainState(screen.parameters);
@@ -8282,7 +8282,7 @@ bool TTrain::InitializeCab(int NewCabNo, std::string const &asFileName)
} }
else if (token == "pyscreenupdatetime:") { else if (token == "pyscreenupdatetime:") {
parser.getTokens(); parser.getTokens();
parser >> fScreenUpdateRate; parser >> ScreenUpdateRate;
} }
// btLampkaUnknown.Init("unknown",mdKabina,false); // btLampkaUnknown.Init("unknown",mdKabina,false);
} while ( ( token != "" ) } while ( ( token != "" )

View File

@@ -789,7 +789,7 @@ private:
float fConverterTimer; // hunter-261211: dla przekaznika float fConverterTimer; // hunter-261211: dla przekaznika
float fMainRelayTimer; // hunter-141211: zalaczanie WSa z opoznieniem float fMainRelayTimer; // hunter-141211: zalaczanie WSa z opoznieniem
float fScreenTimer { 0.f }; float fScreenTimer { 0.f };
int fScreenUpdateRate { 0 }; // vehicle specific python screen update rate override int ScreenUpdateRate { 0 }; // vehicle specific python screen update rate override
// McZapkie-240302 - przyda sie do tachometru // McZapkie-240302 - przyda sie do tachometru
float fTachoVelocity{ 0.0f }; float fTachoVelocity{ 0.0f };