|
|
|
|
@ -1194,12 +1194,23 @@ void KeymapperOptions::Action::LoadFromIni(std::string_view category)
|
|
|
|
|
return; // Use the default key if no key has been set.
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const std::string_view iniValue = iniValues.back().value; |
|
|
|
|
if (iniValue.empty()) { |
|
|
|
|
if (key == "SpeakCurrentLocation") { |
|
|
|
|
const std::span<const Ini::Value> chatLogValues = ini->get(category, "ChatLog"); |
|
|
|
|
if (!chatLogValues.empty() && chatLogValues.back().value == "L") { |
|
|
|
|
SetValue(defaultKey); |
|
|
|
|
const std::string_view iniValue = iniValues.back().value; |
|
|
|
|
if (iniValue.empty()) { |
|
|
|
|
// Migration: `ToggleAutomap` could have been saved as unbound due to a key
|
|
|
|
|
// conflict when `ToggleStashFocus` was also bound to TAB. Restore the default
|
|
|
|
|
// key in that case so TAB works consistently.
|
|
|
|
|
if (key == "ToggleAutomap") { |
|
|
|
|
const std::span<const Ini::Value> stashFocusValues = ini->get(category, "ToggleStashFocus"); |
|
|
|
|
if (!stashFocusValues.empty() && stashFocusValues.back().value == "TAB") { |
|
|
|
|
SetValue(defaultKey); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (key == "SpeakCurrentLocation") { |
|
|
|
|
const std::span<const Ini::Value> chatLogValues = ini->get(category, "ChatLog"); |
|
|
|
|
if (!chatLogValues.empty() && chatLogValues.back().value == "L") { |
|
|
|
|
SetValue(defaultKey); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -1219,15 +1230,23 @@ void KeymapperOptions::Action::LoadFromIni(std::string_view category)
|
|
|
|
|
SetValue(defaultKey); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
SetValue(SDLK_UNKNOWN); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
auto keyIt = GetOptions().Keymapper.keyNameToKeyID.find(iniValue); |
|
|
|
|
if (keyIt == GetOptions().Keymapper.keyNameToKeyID.end()) { |
|
|
|
|
// Use the default key if the key is unknown.
|
|
|
|
|
Log("Keymapper: unknown key '{}'", iniValue); |
|
|
|
|
|
|
|
|
|
SetValue(SDLK_UNKNOWN); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Migration: `ToggleStashFocus` previously defaulted to `TAB`, which conflicts
|
|
|
|
|
// with `ToggleAutomap` and can result in TAB doing nothing (e.g. when the action
|
|
|
|
|
// is disabled by a menu state). Unbind it when configured as TAB.
|
|
|
|
|
if (key == "ToggleStashFocus" && iniValue == "TAB") { |
|
|
|
|
SetValue(defaultKey); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
auto keyIt = GetOptions().Keymapper.keyNameToKeyID.find(iniValue); |
|
|
|
|
if (keyIt == GetOptions().Keymapper.keyNameToKeyID.end()) { |
|
|
|
|
// Use the default key if the key is unknown.
|
|
|
|
|
Log("Keymapper: unknown key '{}'", iniValue); |
|
|
|
|
SetValue(defaultKey); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|