diff --git a/src/hotkeys.cpp b/src/hotkeys.cpp index 2e8e56a3f3..7e62cc5481 100644 --- a/src/hotkeys.cpp +++ b/src/hotkeys.cpp @@ -213,9 +213,9 @@ static std::string KeycodeToString(uint16 keycode) std::string SaveKeycodes(const Hotkey *hotkey) { std::string str; - for (uint i = 0; i < hotkey->keycodes.size(); i++) { - if (i > 0) str += ","; - str += KeycodeToString(hotkey->keycodes[i]); + for (auto keycode : hotkey->keycodes) { + if (!str.empty()) str += ","; + str += KeycodeToString(keycode); } return str; } @@ -257,7 +257,7 @@ Hotkey::Hotkey(const uint16 *default_keycodes, const char *name, int num) : */ void Hotkey::AddKeycode(uint16 keycode) { - include(this->keycodes, keycode); + this->keycodes.insert(keycode); } HotkeyList::HotkeyList(const char *ini_group, Hotkey *items, GlobalHotkeyHandlerFunc global_hotkey_handler) : diff --git a/src/hotkeys.h b/src/hotkeys.h index 59fec34570..781feb2185 100644 --- a/src/hotkeys.h +++ b/src/hotkeys.h @@ -10,7 +10,6 @@ #ifndef HOTKEYS_H #define HOTKEYS_H -#include "core/smallvec_type.hpp" #include "gfx_type.h" #include "window_type.h" #include "string_type.h" @@ -27,7 +26,7 @@ struct Hotkey { const char *name; int num; - std::vector keycodes; + std::set keycodes; }; #define HOTKEY_LIST_END Hotkey((uint16)0, nullptr, -1)