mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
General logic fixes
This commit is contained in:
1219
McZapkie/MOVER.h
1219
McZapkie/MOVER.h
File diff suppressed because it is too large
Load Diff
@@ -9944,6 +9944,13 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
||||
else
|
||||
result = false;
|
||||
|
||||
if (!modernContainOffPos)
|
||||
modernDimmerState = 1;
|
||||
if (!enableModernDimmer)
|
||||
{
|
||||
modernDimmerState = 2;
|
||||
}
|
||||
|
||||
WriteLog("CERROR: " + to_string(ConversionError) + ", SUCCES: " + to_string(result));
|
||||
return result;
|
||||
}
|
||||
@@ -11139,10 +11146,6 @@ void TMoverParameters::LoadFIZ_Switches( std::string const &Input ) {
|
||||
extract_value( UniversalResetButtonFlag[ 2 ], "RelayResetButton3", Input, "" );
|
||||
extract_value(enableModernDimmer, "ModernDimmer", Input, "");
|
||||
extract_value(modernContainOffPos, "ModernDimmerOffPosition", Input, "");
|
||||
if (!modernContainOffPos)
|
||||
modernDimmerState = 1;
|
||||
if (!enableModernDimmer)
|
||||
modernDimmerState = 2;
|
||||
// pantograph presets
|
||||
{
|
||||
auto &presets { PantsPreset.first };
|
||||
|
||||
26
Train.cpp
26
Train.cpp
@@ -4918,10 +4918,12 @@ void TTrain::OnCommand_endsignalstoggle( TTrain *Train, command_data const &Comm
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_headlightsdimtoggle( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if (Train->DynamicObject->MoverParameters->enableModernDimmer)
|
||||
return;
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
if( false == Train->DynamicObject->DimHeadlights ) {
|
||||
if (Train->DynamicObject->MoverParameters->modernDimmerState == 2)
|
||||
{
|
||||
// turn on
|
||||
OnCommand_headlightsdimenable( Train, Command );
|
||||
}
|
||||
@@ -4934,6 +4936,8 @@ void TTrain::OnCommand_headlightsdimtoggle( TTrain *Train, command_data const &C
|
||||
|
||||
void TTrain::OnCommand_headlightsdimenable( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if (Train->DynamicObject->MoverParameters->enableModernDimmer)
|
||||
return;
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
if( Train->ggDimHeadlightsButton.SubModel != nullptr ) {
|
||||
@@ -4950,13 +4954,18 @@ void TTrain::OnCommand_headlightsdimenable( TTrain *Train, command_data const &C
|
||||
|
||||
Train->DynamicObject->DimHeadlights = true;
|
||||
*/
|
||||
|
||||
Train->mvOccupied->modernDimmerState = 1; // ustawiamy modern dimmer na flage przyciemnienia
|
||||
WriteLog("Switch do 1");
|
||||
Train->DynamicObject->MoverParameters->modernDimmerState = 1; // ustawiamy modern dimmer na flage przyciemnienia
|
||||
Train->DynamicObject->RaLightsSet(Train->DynamicObject->MoverParameters->iLights[0],
|
||||
Train->DynamicObject->MoverParameters->iLights[1]
|
||||
); // aktualizacja swiatelek
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_headlightsdimdisable( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if (Train->DynamicObject->MoverParameters->enableModernDimmer) // nie wiem dlaczego to tak dziala ze jest odwrocona logika
|
||||
return;
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
if( Train->ggDimHeadlightsButton.SubModel != nullptr ) {
|
||||
@@ -4972,7 +4981,12 @@ void TTrain::OnCommand_headlightsdimdisable( TTrain *Train, command_data const &
|
||||
Train->DynamicObject->DimHeadlights = false;
|
||||
|
||||
*/
|
||||
Train->mvOccupied->modernDimmerState = 2; // ustawiamy modern dimmer na flage rozjasnienia
|
||||
WriteLog("Switch do 2");
|
||||
Train->DynamicObject->MoverParameters->modernDimmerState = 2; // ustawiamy modern dimmer na flage rozjasnienia
|
||||
Train->DynamicObject->RaLightsSet(
|
||||
Train->DynamicObject->MoverParameters->iLights[0],
|
||||
Train->DynamicObject->MoverParameters->iLights[1]
|
||||
); // aktualizacja swiatelek
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9816,7 +9830,7 @@ void TTrain::set_cab_controls( int const Cab ) {
|
||||
ggRightLightButton.PutValue( -1.f );
|
||||
}
|
||||
}
|
||||
if( true == DynamicObject->DimHeadlights ) {
|
||||
if( 1 == DynamicObject->MoverParameters->modernDimmerState ) {
|
||||
ggDimHeadlightsButton.PutValue( 1.f );
|
||||
}
|
||||
// cab lights
|
||||
|
||||
Reference in New Issue
Block a user