mirror of https://github.com/zeldaret/botw.git
ksys/qst: match Manager::setQuestStep
I'm not a big fan of how the actual logic has to be inside the loop, but unfortunately std::find_if doesn't match and it's clear that the original version used iterators.
This commit is contained in:
parent
726d8a2b31
commit
a196e0ca5a
|
@ -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
|
||||
|
|
Can't render this file because it is too large.
|
|
@ -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) {
|
||||
quest->_e0 = true;
|
||||
const char* x = quest->x_11();
|
||||
it->_e0 = true;
|
||||
if (step_name.isEmpty())
|
||||
quest->_e8.copy(sead::SafeString(x));
|
||||
it->_e8.copy(it->x_11());
|
||||
}
|
||||
if (force_run_telop)
|
||||
quest->mForceRunTelop = true;
|
||||
it->mForceRunTelop = true;
|
||||
if (setAocVersionFlag1)
|
||||
quest->mAocVersionFlags |= 1;
|
||||
it->mAocVersionFlags |= 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ksys::qst
|
||||
|
|
Loading…
Reference in New Issue