diff --git a/Train.cpp b/Train.cpp index c4f79cd7..7bf765f1 100644 --- a/Train.cpp +++ b/Train.cpp @@ -719,7 +719,7 @@ void TTrain::OnCommand_independentbrakebailoff( TTrain *Train, command_data cons } void TTrain::OnCommand_trainbrakeincrease( TTrain *Train, command_data const &Command ) { - if( Command.action != GLFW_RELEASE ) { + if( Command.action == GLFW_REPEAT ) { if( Train->mvOccupied->BrakeHandle == FV4a ) { Train->mvOccupied->BrakeLevelAdd( Global::fBrakeStep * Command.time_delta ); @@ -739,7 +739,7 @@ void TTrain::OnCommand_trainbrakeincrease( TTrain *Train, command_data const &Co void TTrain::OnCommand_trainbrakedecrease( TTrain *Train, command_data const &Command ) { - if( Command.action != GLFW_RELEASE ) { + if( Command.action == GLFW_REPEAT ) { // press or hold if( Train->mvOccupied->BrakeHandle == FV4a ) { Train->mvOccupied->BrakeLevelAdd( -Global::fBrakeStep * Command.time_delta ); @@ -762,7 +762,7 @@ void TTrain::OnCommand_trainbrakedecrease( TTrain *Train, command_data const &Co // koniec wersji dostarczonej przez ZiomalCl } } - else { + else if (Command.action == GLFW_RELEASE) { // release if( ( Train->mvOccupied->BrakeCtrlPos == -1 ) && ( Train->mvOccupied->BrakeHandle == FVel6 ) @@ -3393,7 +3393,7 @@ bool TTrain::Update( double const Deltatime ) auto lookup = m_commandhandlers.find( commanddata.command ); if( lookup != m_commandhandlers.end() ) { // debug data - if( commanddata.action != GLFW_RELEASE ) { + if( commanddata.action == GLFW_PRESS ) { WriteLog( mvOccupied->Name + " received command: [" + simulation::Commands_descriptions[ static_cast( commanddata.command ) ].name + "]" ); } // pass the command to the assigned handler diff --git a/command.cpp b/command.cpp index 8ecfbdf9..e4261940 100644 --- a/command.cpp +++ b/command.cpp @@ -168,12 +168,10 @@ command_queue::push( command_data const &Command, std::size_t const Recipient ) else if (Command.action == GLFW_RELEASE) m_active_continuous.erase(Command.command); } - else - { - auto lookup = m_commands.emplace( Recipient, commanddata_sequence() ); - // recipient stack was either located or created, so we can add to it quite safely - lookup.first->second.emplace( Command ); - } + + auto lookup = m_commands.emplace( Recipient, commanddata_sequence() ); + // recipient stack was either located or created, so we can add to it quite safely + lookup.first->second.emplace( Command ); } // retrieves oldest posted command for specified recipient, if any. returns: true on retrieval, false if there's nothing to retrieve