16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 12:49:18 +02:00

input changes

This commit is contained in:
milek7
2017-12-29 16:39:40 +01:00
parent 19d4c51915
commit f55c22cd1b
2 changed files with 8 additions and 10 deletions

View File

@@ -719,7 +719,7 @@ void TTrain::OnCommand_independentbrakebailoff( TTrain *Train, command_data cons
} }
void TTrain::OnCommand_trainbrakeincrease( TTrain *Train, command_data const &Command ) { 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 ) { if( Train->mvOccupied->BrakeHandle == FV4a ) {
Train->mvOccupied->BrakeLevelAdd( Global::fBrakeStep * Command.time_delta ); 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 ) { void TTrain::OnCommand_trainbrakedecrease( TTrain *Train, command_data const &Command ) {
if( Command.action != GLFW_RELEASE ) { if( Command.action == GLFW_REPEAT ) {
// press or hold // press or hold
if( Train->mvOccupied->BrakeHandle == FV4a ) { if( Train->mvOccupied->BrakeHandle == FV4a ) {
Train->mvOccupied->BrakeLevelAdd( -Global::fBrakeStep * Command.time_delta ); 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 // koniec wersji dostarczonej przez ZiomalCl
} }
} }
else { else if (Command.action == GLFW_RELEASE) {
// release // release
if( ( Train->mvOccupied->BrakeCtrlPos == -1 ) if( ( Train->mvOccupied->BrakeCtrlPos == -1 )
&& ( Train->mvOccupied->BrakeHandle == FVel6 ) && ( Train->mvOccupied->BrakeHandle == FVel6 )
@@ -3393,7 +3393,7 @@ bool TTrain::Update( double const Deltatime )
auto lookup = m_commandhandlers.find( commanddata.command ); auto lookup = m_commandhandlers.find( commanddata.command );
if( lookup != m_commandhandlers.end() ) { if( lookup != m_commandhandlers.end() ) {
// debug data // debug data
if( commanddata.action != GLFW_RELEASE ) { if( commanddata.action == GLFW_PRESS ) {
WriteLog( mvOccupied->Name + " received command: [" + simulation::Commands_descriptions[ static_cast<std::size_t>( commanddata.command ) ].name + "]" ); WriteLog( mvOccupied->Name + " received command: [" + simulation::Commands_descriptions[ static_cast<std::size_t>( commanddata.command ) ].name + "]" );
} }
// pass the command to the assigned handler // pass the command to the assigned handler

View File

@@ -168,12 +168,10 @@ command_queue::push( command_data const &Command, std::size_t const Recipient )
else if (Command.action == GLFW_RELEASE) else if (Command.action == GLFW_RELEASE)
m_active_continuous.erase(Command.command); m_active_continuous.erase(Command.command);
} }
else
{ auto lookup = m_commands.emplace( Recipient, commanddata_sequence() );
auto lookup = m_commands.emplace( Recipient, commanddata_sequence() ); // recipient stack was either located or created, so we can add to it quite safely
// recipient stack was either located or created, so we can add to it quite safely lookup.first->second.emplace( Command );
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 // retrieves oldest posted command for specified recipient, if any. returns: true on retrieval, false if there's nothing to retrieve