Skip to content

Commit

Permalink
activate "roll" if both forward+backward actions are used
Browse files Browse the repository at this point in the history
closes CD-466
  • Loading branch information
stohrendorf committed Jun 11, 2022
1 parent 8350cc7 commit b562576
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/hid/inputhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,18 @@ void InputHandler::update()

for(const auto& [action, state] : states)
{
auto it = states.find(action);
m_inputState.actions[action] = it->second;
const auto it = states.find(action);
if(it != states.end())
m_inputState.actions[action] = it->second;
}
m_inputState.setXAxisMovement(m_inputState.actions[Action::Left], m_inputState.actions[Action::Right]);
m_inputState.setZAxisMovement(m_inputState.actions[Action::Backward], m_inputState.actions[Action::Forward]);
m_inputState.setStepMovement(m_inputState.actions[Action::StepLeft], m_inputState.actions[Action::StepRight]);

if(m_inputState.actions[Action::Backward] && m_inputState.actions[Action::Forward])
{
m_inputState.actions[Action::Roll] = true;
}
}

void InputHandler::setMappings(const std::vector<engine::NamedInputMappingConfig>& inputMappings)
Expand Down

0 comments on commit b562576

Please sign in to comment.