Decompile fn_06312 (CGameSettingsMgr::SetOption)

Batch #14661 by secret: 0 byte-identical, 1 confirmed by peer review.

- fn_06312 CGameSettingsMgr::SetOption: logic confirmed by peer review

Peer-reviewed-by: Yommy, Tanke
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-11-07 13:08:14 +00:00
commit 6fdd9155b6

View file

@ -72,8 +72,8 @@ public:
~CGameSettingsMgr() override;
/* 000C */ std::vector<GameSettingsOption> options;
/* 0018 */ std::unordered_map<std::uint32_t, std::function<void(int, unsigned char, bool, int, int)>> actions;
/* 0038 */ std::unordered_map<std::uint32_t, std::function<void()>> functions;
/* 0018 */ std::unordered_map<int, std::function<void(int, unsigned char, bool, int, int)>> actions;
/* 0038 */ std::unordered_map<int, std::function<void()>> 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<std::uint32_t>(id));
if (entry == this->actions.end()) {
ApplyServiceOption(id, value, notify, option.unknown_005c, option.unknown_0060);
return;
}
const std::optional<GameSettingsOption*> 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<void(int, unsigned char, bool, int, int)> 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);
}
}