mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 16:49:18 +02:00
ai brake release logic tweak, auto sandbox cab control fix, sound source fixes
This commit is contained in:
10
Driver.cpp
10
Driver.cpp
@@ -6072,7 +6072,10 @@ TController::UpdateSituation(double dt) {
|
|||||||
// jeśli opóźnienie większe od wymaganego (z histerezą) luzowanie, gdy za dużo
|
// jeśli opóźnienie większe od wymaganego (z histerezą) luzowanie, gdy za dużo
|
||||||
// TBD: check if the condition isn't redundant with the DecBrake() code
|
// TBD: check if the condition isn't redundant with the DecBrake() code
|
||||||
if( /*GBH mvOccupied->BrakeCtrlPos*/BrakeCtrlPosition >= 0 ) {
|
if( /*GBH mvOccupied->BrakeCtrlPos*/BrakeCtrlPosition >= 0 ) {
|
||||||
DecBrake(); // tutaj zmniejszało o 1 przy odczepianiu
|
if( VelDesired > 0.0 ) {
|
||||||
|
// sanity check to prevent unintended brake release on sharp slopes
|
||||||
|
DecBrake(); // tutaj zmniejszało o 1 przy odczepianiu
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( mvOccupied->Handle->TimeEP ) {
|
else if( mvOccupied->Handle->TimeEP ) {
|
||||||
@@ -6115,7 +6118,10 @@ TController::UpdateSituation(double dt) {
|
|||||||
// yB: luzuje hamulec dopiero przy różnicy opóźnień rzędu 0.2
|
// yB: luzuje hamulec dopiero przy różnicy opóźnień rzędu 0.2
|
||||||
if( OrderCurrentGet() != Disconnect ) {
|
if( OrderCurrentGet() != Disconnect ) {
|
||||||
// przy odłączaniu nie zwalniamy tu hamulca
|
// przy odłączaniu nie zwalniamy tu hamulca
|
||||||
DecBrake(); // tutaj zmniejszało o 1 przy odczepianiu
|
if( VelDesired > 0.0 ) {
|
||||||
|
// sanity check to prevent unintended brake release on sharp slopes
|
||||||
|
DecBrake(); // tutaj zmniejszało o 1 przy odczepianiu
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fBrakeTime = (
|
fBrakeTime = (
|
||||||
mvOccupied->BrakeDelayFlag > bdelay_G ?
|
mvOccupied->BrakeDelayFlag > bdelay_G ?
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ auto python_taskqueue::init() -> bool {
|
|||||||
// release the lock, save the state for future use
|
// release the lock, save the state for future use
|
||||||
m_mainthread = PyEval_SaveThread();
|
m_mainthread = PyEval_SaveThread();
|
||||||
|
|
||||||
WriteLog( "Python Interpreter setup complete" );
|
WriteLog( "Python Interpreter: setup complete" );
|
||||||
|
|
||||||
// init workers
|
// init workers
|
||||||
for( auto &worker : m_workers ) {
|
for( auto &worker : m_workers ) {
|
||||||
@@ -319,6 +319,7 @@ void python_taskqueue::run( GLFWwindow *Context, rendertask_sequence &Tasks, thr
|
|||||||
void
|
void
|
||||||
python_taskqueue::error() {
|
python_taskqueue::error() {
|
||||||
|
|
||||||
|
ErrorLog( "Python Interpreter: encountered error" );
|
||||||
if( m_stderr != nullptr ) {
|
if( m_stderr != nullptr ) {
|
||||||
// std err pythona jest buforowane
|
// std err pythona jest buforowane
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
|
|||||||
18
Train.cpp
18
Train.cpp
@@ -202,6 +202,9 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
|
|||||||
{ user_command::alarmchaintoggle, &TTrain::OnCommand_alarmchaintoggle },
|
{ user_command::alarmchaintoggle, &TTrain::OnCommand_alarmchaintoggle },
|
||||||
{ user_command::wheelspinbrakeactivate, &TTrain::OnCommand_wheelspinbrakeactivate },
|
{ user_command::wheelspinbrakeactivate, &TTrain::OnCommand_wheelspinbrakeactivate },
|
||||||
{ user_command::sandboxactivate, &TTrain::OnCommand_sandboxactivate },
|
{ user_command::sandboxactivate, &TTrain::OnCommand_sandboxactivate },
|
||||||
|
{ user_command::autosandboxtoggle, &TTrain::OnCommand_autosandboxtoggle },
|
||||||
|
{ user_command::autosandboxactivate, &TTrain::OnCommand_autosandboxactivate },
|
||||||
|
{ user_command::autosandboxdeactivate, &TTrain::OnCommand_autosandboxdeactivate },
|
||||||
{ user_command::epbrakecontroltoggle, &TTrain::OnCommand_epbrakecontroltoggle },
|
{ user_command::epbrakecontroltoggle, &TTrain::OnCommand_epbrakecontroltoggle },
|
||||||
{ user_command::trainbrakeoperationmodeincrease, &TTrain::OnCommand_trainbrakeoperationmodeincrease },
|
{ user_command::trainbrakeoperationmodeincrease, &TTrain::OnCommand_trainbrakeoperationmodeincrease },
|
||||||
{ user_command::trainbrakeoperationmodedecrease, &TTrain::OnCommand_trainbrakeoperationmodedecrease },
|
{ user_command::trainbrakeoperationmodedecrease, &TTrain::OnCommand_trainbrakeoperationmodedecrease },
|
||||||
@@ -1549,7 +1552,7 @@ void TTrain::OnCommand_autosandboxactivate(TTrain *Train, command_data const &Co
|
|||||||
if (Command.action == GLFW_PRESS) {
|
if (Command.action == GLFW_PRESS) {
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
Train->mvOccupied->SandboxAutoAllow(true);
|
Train->mvOccupied->SandboxAutoAllow(true);
|
||||||
Train->ggAutoSandAllow.UpdateValue(1.0, Train->dsbSwitch);
|
Train->ggAutoSandButton.UpdateValue(1.0, Train->dsbSwitch);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1557,7 +1560,7 @@ void TTrain::OnCommand_autosandboxdeactivate(TTrain *Train, command_data const &
|
|||||||
if (Command.action == GLFW_PRESS) {
|
if (Command.action == GLFW_PRESS) {
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
Train->mvOccupied->SandboxAutoAllow(false);
|
Train->mvOccupied->SandboxAutoAllow(false);
|
||||||
Train->ggAutoSandAllow.UpdateValue(0.0, Train->dsbSwitch);
|
Train->ggAutoSandButton.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -6439,6 +6442,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
ggUniveralBrakeButton3.Update();
|
ggUniveralBrakeButton3.Update();
|
||||||
ggAntiSlipButton.Update();
|
ggAntiSlipButton.Update();
|
||||||
ggSandButton.Update();
|
ggSandButton.Update();
|
||||||
|
ggAutoSandButton.Update();
|
||||||
ggFuseButton.Update();
|
ggFuseButton.Update();
|
||||||
ggConverterFuseButton.Update();
|
ggConverterFuseButton.Update();
|
||||||
ggStLinOffButton.Update();
|
ggStLinOffButton.Update();
|
||||||
@@ -7679,6 +7683,7 @@ void TTrain::clear_cab_controls()
|
|||||||
ggUniveralBrakeButton2.Clear();
|
ggUniveralBrakeButton2.Clear();
|
||||||
ggUniveralBrakeButton3.Clear();
|
ggUniveralBrakeButton3.Clear();
|
||||||
ggSandButton.Clear();
|
ggSandButton.Clear();
|
||||||
|
ggAutoSandButton.Clear();
|
||||||
ggAntiSlipButton.Clear();
|
ggAntiSlipButton.Clear();
|
||||||
ggHornButton.Clear();
|
ggHornButton.Clear();
|
||||||
ggHornLowButton.Clear();
|
ggHornLowButton.Clear();
|
||||||
@@ -8153,6 +8158,13 @@ void TTrain::set_cab_controls( int const Cab ) {
|
|||||||
1.f :
|
1.f :
|
||||||
0.f );
|
0.f );
|
||||||
}
|
}
|
||||||
|
// sandbox
|
||||||
|
if( ggAutoSandButton.type() != TGaugeType::push ) {
|
||||||
|
ggAutoSandButton.PutValue(
|
||||||
|
mvControlled->SandDoseAutoAllow ?
|
||||||
|
1.f :
|
||||||
|
0.f );
|
||||||
|
}
|
||||||
|
|
||||||
// we reset all indicators, as they're set during the update pass
|
// we reset all indicators, as they're set during the update pass
|
||||||
// TODO: when cleaning up break setting indicator state into a separate function, so we can reuse it
|
// TODO: when cleaning up break setting indicator state into a separate function, so we can reuse it
|
||||||
@@ -8346,7 +8358,7 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
|
|||||||
{ "universalbrake2_bt:", ggUniveralBrakeButton2 },
|
{ "universalbrake2_bt:", ggUniveralBrakeButton2 },
|
||||||
{ "universalbrake3_bt:", ggUniveralBrakeButton3 },
|
{ "universalbrake3_bt:", ggUniveralBrakeButton3 },
|
||||||
{ "sand_bt:", ggSandButton },
|
{ "sand_bt:", ggSandButton },
|
||||||
{ "autosandallow_sw:", ggAutoSandAllow },
|
{ "autosandallow_sw:", ggAutoSandButton },
|
||||||
{ "antislip_bt:", ggAntiSlipButton },
|
{ "antislip_bt:", ggAntiSlipButton },
|
||||||
{ "horn_bt:", ggHornButton },
|
{ "horn_bt:", ggHornButton },
|
||||||
{ "hornlow_bt:", ggHornLowButton },
|
{ "hornlow_bt:", ggHornLowButton },
|
||||||
|
|||||||
2
Train.h
2
Train.h
@@ -436,7 +436,7 @@ public: // reszta może by?publiczna
|
|||||||
TGauge ggUniveralBrakeButton2;
|
TGauge ggUniveralBrakeButton2;
|
||||||
TGauge ggUniveralBrakeButton3;
|
TGauge ggUniveralBrakeButton3;
|
||||||
TGauge ggSandButton; // guzik piasecznicy
|
TGauge ggSandButton; // guzik piasecznicy
|
||||||
TGauge ggAutoSandAllow; // przełącznik piasecznicy
|
TGauge ggAutoSandButton; // przełącznik piasecznicy
|
||||||
TGauge ggAntiSlipButton;
|
TGauge ggAntiSlipButton;
|
||||||
TGauge ggFuseButton;
|
TGauge ggFuseButton;
|
||||||
TGauge ggConverterFuseButton; // hunter-261211: przycisk odblokowania nadmiarowego przetwornic i ogrzewania
|
TGauge ggConverterFuseButton; // hunter-261211: przycisk odblokowania nadmiarowego przetwornic i ogrzewania
|
||||||
|
|||||||
@@ -509,7 +509,9 @@ sound_source::update_basic( audio::openal_source &Source ) {
|
|||||||
// when it happens update active sample counters, and potentially activate the looping
|
// when it happens update active sample counters, and potentially activate the looping
|
||||||
update_counter( sound_id::begin, -1 );
|
update_counter( sound_id::begin, -1 );
|
||||||
update_counter( soundhandle, 1 );
|
update_counter( soundhandle, 1 );
|
||||||
Source.loop( TestFlag( m_flags, sound_flags::looping ) );
|
if( soundhandle == sound_id::main ) {
|
||||||
|
Source.loop( TestFlag( m_flags, sound_flags::looping ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -574,7 +576,12 @@ sound_source::update_basic( audio::openal_source &Source ) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// the emitter is either all done or was terminated early
|
// the emitter is either all done or was terminated early
|
||||||
|
/*
|
||||||
update_counter( Source.sounds[ Source.sound_index - 1 ], -1 );
|
update_counter( Source.sounds[ Source.sound_index - 1 ], -1 );
|
||||||
|
*/
|
||||||
|
for( auto &soundchunk : m_soundchunks ) {
|
||||||
|
soundchunk.first.playing = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user