Fix usage of remove_if in CHotkeyPicker

I was not aware of the erase-remove idiom and failed to notice that
remove_if simply reorders the elements.
Noted by Stan thanks to VS17 warnings.

Fixes a4852c4c01 / D2814

This was SVN commit r24371.
This commit is contained in:
wraitii
2020-12-11 10:02:05 +00:00
parent 14cc771b6d
commit c013ee3778
+2 -2
View File
@@ -135,8 +135,8 @@ InReaction CHotkeyPicker::PreemptEvent(const SDL_Event_* ev)
return IN_HANDLED;
}
// Don't handle keys and mouse together except for modifiers.
std::remove_if(m_KeysPressed.begin(), m_KeysPressed.end(), [](const Key& k) {
return static_cast<int>(k.code) < UNIFIED_SHIFT || static_cast<int>(k.code) >= UNIFIED_LAST; } );
m_KeysPressed.erase(std::remove_if(m_KeysPressed.begin(), m_KeysPressed.end(), [](const Key& k) {
return static_cast<int>(k.code) < UNIFIED_SHIFT || static_cast<int>(k.code) >= UNIFIED_LAST; } ), m_KeysPressed.end());
m_KeysPressed.emplace_back(Key{scancode, FindScancodeName(scancode)});
// For mouse events, assume we immediately want to return.
FireEvent(EventNameCombination);