mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-09 20:26:24 +00:00
Fixed hotkey scope regression
See comment in hotkey/hotkey/hotkey_command.hpp for explanation. This isn't a good solution, but I need to figure out a better one.
This commit is contained in:
parent
8960e407e9
commit
7e76e21a87
@ -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)) {
|
||||
|
@ -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());
|
||||
|
@ -63,11 +63,6 @@ const std::map<HOTKEY_CATEGORY, std::string> 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.
|
||||
//
|
||||
|
@ -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,
|
||||
|
@ -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_);
|
||||
|
Loading…
x
Reference in New Issue
Block a user