diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 6e72d0ed2..06a2cde26 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -84571,7 +84571,7 @@ Address,Quality,Size,Name 0x0000007100fd7a10,O,000116,_ZNK4ksys3qst7Manager5auto4EPNS_3act5ActorE 0x0000007100fd7a84,m,000172,_ZN4ksys3qst7Manager5auto0EPNS_3act5ActorE 0x0000007100fd7b30,O,000016,_ZN4ksys3qst7Manager14sub_7100FD7B30ERKN4sead14SafeStringBaseIcEES6_b -0x0000007100fd7b40,m,000624,_ZN4ksys3qst7Manager12setQuestStepERKN4sead14SafeStringBaseIcEES6_bbb +0x0000007100fd7b40,O,000624,_ZN4ksys3qst7Manager12setQuestStepERKN4sead14SafeStringBaseIcEES6_bbb 0x0000007100fd7db0,O,000020,_ZN4ksys3qst7Manager21setQuestStepFromEventERKN4sead14SafeStringBaseIcEES6_bb 0x0000007100fd7dc4,U,000680,sinitQuestManagerStrings 0x0000007100fd806c,m,000472,_ZN4ksys3qst5QuestC1ERKN4sead14SafeStringBaseIcEEPNS2_4HeapE diff --git a/src/KingSystem/Quest/qstManager.cpp b/src/KingSystem/Quest/qstManager.cpp index a59297902..6237b9313 100644 --- a/src/KingSystem/Quest/qstManager.cpp +++ b/src/KingSystem/Quest/qstManager.cpp @@ -102,38 +102,34 @@ bool Manager::setQuestStepFromEvent(const sead::SafeString& quest_name, return setQuestStep(quest_name, step_name, true, force_run_telop, setAocVersionFlag1); } -// NON_MATCHING: quest is dereferenced several times bool Manager::setQuestStep(const sead::SafeString& quest_name, const sead::SafeString& step_name, bool copy_name, bool force_run_telop, bool setAocVersionFlag1) { - u32 hash = sead::HashCRC32::calcStringHash(quest_name.cstr()); - Quest* quest; - for (auto& q : mQuests) { - if (q._c - 1 <= 1 && q.mNameHash == hash) { - quest = &q; - break; - } - } - if (quest == nullptr) - return false; + u32 hash = sead::HashCRC32::calcStringHash(quest_name); + for (auto it = mQuests.begin(), end = mQuests.end(); it != end; ++it) { + if ((it->_c != 1 && it->_c != 2) || it->mNameHash != hash) + continue; - quest->setField31(); + it->setField31(); - quest->_e8.copy(step_name); + it->_e8.copy(step_name); - quest->_e0 = false; - quest->mForceRunTelop = false; + it->_e0 = false; + it->mForceRunTelop = false; + + if (copy_name) { + it->_e0 = true; + if (step_name.isEmpty()) + it->_e8.copy(it->x_11()); + } + if (force_run_telop) + it->mForceRunTelop = true; + if (setAocVersionFlag1) + it->mAocVersionFlags |= 1; - if (copy_name) { - quest->_e0 = true; - const char* x = quest->x_11(); - if (step_name.isEmpty()) - quest->_e8.copy(sead::SafeString(x)); + return true; } - if (force_run_telop) - quest->mForceRunTelop = true; - if (setAocVersionFlag1) - quest->mAocVersionFlags |= 1; - return true; + + return false; } } // namespace ksys::qst