diff --git a/Source/Contents/Configuration/ServiceOptions.cpp b/Source/Contents/Configuration/ServiceOptions.cpp index 88cc92b1b..7de827579 100644 --- a/Source/Contents/Configuration/ServiceOptions.cpp +++ b/Source/Contents/Configuration/ServiceOptions.cpp @@ -72,8 +72,8 @@ public: ~CGameSettingsMgr() override; /* 000C */ std::vector options; - /* 0018 */ std::unordered_map> actions; - /* 0038 */ std::unordered_map> functions; + /* 0018 */ std::unordered_map> actions; + /* 0038 */ std::unordered_map> functions; bool LoadSettings(); bool ReadOptionTable(); @@ -439,26 +439,19 @@ CGameSettingsMgr::~CGameSettingsMgr() { // OFFSET: 0x006C0C40 // FUNCTION: fn_06312 void GameSettings::SetOption(int id, unsigned char value, bool notify) { - for (const GameSettingsOption& option : this->options) { - if (option.id != id) { - continue; - } - - if (option.type != 0) { - return; - } - - const auto entry = this->actions.find(static_cast(id)); - if (entry == this->actions.end()) { - ApplyServiceOption(id, value, notify, option.unknown_005c, option.unknown_0060); - return; - } + const std::optional option = this->FindOption(id); + if (!option || (*option)->type != 0) { + return; + } + const auto entry = this->actions.find(id); + if (entry != this->actions.end()) { const std::function action = entry->second; if (action) { - action(id, value, notify, option.unknown_005c, option.unknown_0060); + action(id, value, notify, (*option)->unknown_005c, (*option)->unknown_0060); } - return; + } else { + ApplyServiceOption(id, value, notify, (*option)->unknown_005c, (*option)->unknown_0060); } }