mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
remove unnecessary loop over the possible modifier combinations
This commit is contained in:
parent
e3eeec762d
commit
1a162c08be
|
@ -17,15 +17,11 @@ bool CBinds::CBindsSpecial::OnInput(IInput::CEvent Event)
|
|||
|
||||
// Look for a composed bind
|
||||
bool ret = false;
|
||||
for(int Mod = 1; Mod < MODIFIER_COMBINATION_COUNT; Mod++)
|
||||
if(m_pBinds->m_aapKeyBindings[Mask][Event.m_Key])
|
||||
{
|
||||
if(Mask == Mod && m_pBinds->m_aapKeyBindings[Mod][Event.m_Key])
|
||||
{
|
||||
m_pBinds->GetConsole()->ExecuteLineStroked(Event.m_Flags & IInput::FLAG_PRESS, m_pBinds->m_aapKeyBindings[Mod][Event.m_Key]);
|
||||
m_pBinds->GetConsole()->ExecuteLineStroked(Event.m_Flags & IInput::FLAG_PRESS, m_pBinds->m_aapKeyBindings[Mask][Event.m_Key]);
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Look for a non composed bind
|
||||
if(!ret && m_pBinds->m_aapKeyBindings[0][Event.m_Key])
|
||||
{
|
||||
|
@ -138,17 +134,14 @@ bool CBinds::OnInput(IInput::CEvent e)
|
|||
Mask &= ~KeyModifierMask;
|
||||
|
||||
bool ret = false;
|
||||
for(int Mod = 1; Mod < MODIFIER_COMBINATION_COUNT; Mod++)
|
||||
{
|
||||
if(m_aapKeyBindings[Mod][e.m_Key] && (Mask == Mod))
|
||||
if(m_aapKeyBindings[Mask][e.m_Key])
|
||||
{
|
||||
if(e.m_Flags & IInput::FLAG_PRESS)
|
||||
Console()->ExecuteLineStroked(1, m_aapKeyBindings[Mod][e.m_Key]);
|
||||
Console()->ExecuteLineStroked(1, m_aapKeyBindings[Mask][e.m_Key]);
|
||||
if(e.m_Flags & IInput::FLAG_RELEASE)
|
||||
Console()->ExecuteLineStroked(0, m_aapKeyBindings[Mod][e.m_Key]);
|
||||
Console()->ExecuteLineStroked(0, m_aapKeyBindings[Mask][e.m_Key]);
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(m_aapKeyBindings[0][e.m_Key] && !ret)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue