1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 23:04:36 +01:00

Merge pull request #15407 from ZehMatt/refactor/optional-use

Make use of std::optional strict
This commit is contained in:
Hielke Morsink
2021-09-14 17:45:18 +02:00
committed by GitHub
40 changed files with 212 additions and 208 deletions

View File

@@ -167,10 +167,10 @@ void ShortcutManager::ProcessEvent(const InputEvent& e)
if (shortcut != nullptr && shortcut->IsSuitableInputEvent(e))
{
auto shortcutInput = ShortcutInput::FromInputEvent(e);
if (shortcutInput)
if (shortcutInput.has_value())
{
shortcut->Current.clear();
shortcut->Current.push_back(std::move(*shortcutInput));
shortcut->Current.push_back(std::move(shortcutInput.value()));
}
_pendingShortcutChange.clear();
window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
@@ -271,9 +271,9 @@ void ShortcutManager::LoadLegacyBindings(const fs::path& path)
{
shortcut->Current.clear();
auto input = ConvertLegacyBinding(value);
if (input)
if (input.has_value())
{
shortcut->Current.push_back(std::move(*input));
shortcut->Current.push_back(std::move(input.value()));
}
}
}