diff --git a/src/editor/editor_main.cpp b/src/editor/editor_main.cpp index a8229055b4c..b054c81071f 100644 --- a/src/editor/editor_main.cpp +++ b/src/editor/editor_main.cpp @@ -32,7 +32,7 @@ EXIT_STATUS start(const std::string& filename /* = "" */, { EXIT_STATUS e = EXIT_ERROR; try { - const hotkey::scope_changer h{hotkey::SCOPE_EDITOR}; + const hotkey::scope_changer h{hotkey::scope_editor}; editor_controller editor; if (!filename.empty() && filesystem::file_exists (filename)) { if (filesystem::is_directory(filename)) { diff --git a/src/game_config_manager.cpp b/src/game_config_manager.cpp index 55d85d4f8cd..e677c504605 100644 --- a/src/game_config_manager.cpp +++ b/src/game_config_manager.cpp @@ -115,7 +115,7 @@ bool game_config_manager::init_game_config(FORCE_RELOAD_CONFIG force_reload) // It's necessary to block the event thread while load_hotkeys() runs, otherwise keyboard input // can cause a crash by accessing the list of hotkeys while it's being modified. events::call_in_main_thread([this]() { - const hotkey::scope_changer hk_scope{hotkey::SCOPE_MAIN_MENU, false}; + const hotkey::scope_changer hk_scope{hotkey::scope_main, false}; // Load the standard hotkeys, then apply any player customizations. hotkey::load_default_hotkeys(game_config()); diff --git a/src/hotkey/hotkey_command.cpp b/src/hotkey/hotkey_command.cpp index 87c982bc7ad..94796ef1a6d 100644 --- a/src/hotkey/hotkey_command.cpp +++ b/src/hotkey/hotkey_command.cpp @@ -63,11 +63,6 @@ const std::map category_names { { HKCAT_CUSTOM, N_("Custom WML Commands") }, }; -// For some reason std::bitset::operator| is not constexpr, so we'll construct the bitset with these values -constexpr uint32_t scope_game = 1 << SCOPE_GAME; -constexpr uint32_t scope_editor = 1 << SCOPE_EDITOR; -constexpr uint32_t scope_main = 1 << SCOPE_MAIN_MENU; - // // All static hotkeys. // diff --git a/src/hotkey/hotkey_command.hpp b/src/hotkey/hotkey_command.hpp index 9faaf88e733..bc5c02b0b45 100644 --- a/src/hotkey/hotkey_command.hpp +++ b/src/hotkey/hotkey_command.hpp @@ -39,6 +39,13 @@ enum scope { SCOPE_COUNT, }; +// For some reason std::bitset::operator| is not constexpr, so we'll construct the bitset with these values +// FIXME: unify these with the enum above. Right now these are the proper bitmasks to initialize a bitset, +// while the values above are used as indices to access the bits of the bitset. +constexpr uint32_t scope_game = 1 << SCOPE_GAME; +constexpr uint32_t scope_editor = 1 << SCOPE_EDITOR; +constexpr uint32_t scope_main = 1 << SCOPE_MAIN_MENU; + enum HOTKEY_COMMAND { HOTKEY_CYCLE_UNITS, HOTKEY_CYCLE_BACK_UNITS, HOTKEY_UNIT_HOLD_POSITION, diff --git a/src/tests/utils/game_config_manager_tests.cpp b/src/tests/utils/game_config_manager_tests.cpp index 935a3859aaa..455379318fc 100644 --- a/src/tests/utils/game_config_manager_tests.cpp +++ b/src/tests/utils/game_config_manager_tests.cpp @@ -89,7 +89,7 @@ namespace test_utils { unit_types.set_config(game_config_view_.merged_children_view("units")); game_config::load_config(cfg_.child("game_config")); - const hotkey::scope_changer hk_scope{hotkey::SCOPE_GAME, false}; + const hotkey::scope_changer hk_scope{hotkey::scope_game, false}; hotkey::load_default_hotkeys(game_config_view_); paths_manager_.set_paths(game_config_view_);