mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-24 21:13:20 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user