From 00e91ba4f3d4100ec770111556a19ed271da6eca Mon Sep 17 00:00:00 2001 From: Henry Wilson Date: Sat, 30 Dec 2017 23:57:35 +0000 Subject: [PATCH 13/31] Hotkey::keycodes ~> std::vector --- src/hotkeys.cpp | 8 ++++---- src/hotkeys.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hotkeys.cpp b/src/hotkeys.cpp index 91002dd0f..5c70b7729 100644 --- a/src/hotkeys.cpp +++ b/src/hotkeys.cpp @@ -202,7 +202,7 @@ const char *SaveKeycodes(const Hotkey *hotkey) { static char buf[128]; buf[0] = '\0'; - for (uint i = 0; i < hotkey->keycodes.Length(); i++) { + for (uint i = 0; i < hotkey->keycodes.size(); i++) { const char *str = KeycodeToString(hotkey->keycodes[i]); if (i > 0) strecat(buf, ",", lastof(buf)); strecat(buf, str, lastof(buf)); @@ -247,7 +247,7 @@ Hotkey::Hotkey(const uint16 *default_keycodes, const char *name, int num) : */ void Hotkey::AddKeycode(uint16 keycode) { - this->keycodes.Include(keycode); + Include(this->keycodes, keycode); } HotkeyList::HotkeyList(const char *ini_group, Hotkey *items, GlobalHotkeyHandlerFunc global_hotkey_handler) : @@ -272,7 +272,7 @@ void HotkeyList::Load(IniFile *ini) for (Hotkey *hotkey = this->items; hotkey->name != NULL; ++hotkey) { IniItem *item = group->GetItem(hotkey->name, false); if (item != NULL) { - hotkey->keycodes.Clear(); + hotkey->keycodes.clear(); if (item->value != NULL) ParseHotkeys(hotkey, item->value); } } @@ -300,7 +300,7 @@ void HotkeyList::Save(IniFile *ini) const int HotkeyList::CheckMatch(uint16 keycode, bool global_only) const { for (const Hotkey *list = this->items; list->name != NULL; ++list) { - if (list->keycodes.Contains(keycode | WKC_GLOBAL_HOTKEY) || (!global_only && list->keycodes.Contains(keycode))) { + if (Contains(list->keycodes, static_cast(keycode | WKC_GLOBAL_HOTKEY)) || (!global_only && Contains(list->keycodes, keycode))) { return list->num; } } diff --git a/src/hotkeys.h b/src/hotkeys.h index 25a489b3f..fd729a47a 100644 --- a/src/hotkeys.h +++ b/src/hotkeys.h @@ -29,7 +29,7 @@ struct Hotkey { const char *name; int num; - SmallVector keycodes; + std::vector keycodes; }; #define HOTKEY_LIST_END Hotkey((uint16)0, NULL, -1) -- 2.14.1