From 76859364590d3e240b32465b1ed0aad598d1f61e Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 5 Nov 2026 01:31:26 +0000 Subject: [PATCH] Decompile 2 functions in Source/Contents/AdventureGuideMgr.cpp, Source/Contents/AdventureGuideMgr.h Batch #11266 by cremane: 0 byte-identical, 2 confirmed by peer review. - fn_05256 CAdventureGuideMgr::IsAvailable: logic confirmed by peer review - fn_05238 CAdventureGuideMgr::GetContentsList: logic confirmed by peer review Peer-reviewed-by: Yommy, Tanke, dori Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/AdventureGuideMgr.cpp | 28 +++++++++++++-------------- Source/Contents/AdventureGuideMgr.h | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Source/Contents/AdventureGuideMgr.cpp b/Source/Contents/AdventureGuideMgr.cpp index 49ea9a8f..8a2b8b96 100644 --- a/Source/Contents/AdventureGuideMgr.cpp +++ b/Source/Contents/AdventureGuideMgr.cpp @@ -1225,11 +1225,11 @@ void CAdventureGuideMgr::GetContentsList(std::listbegin(), (*contents)->end(), std::back_inserter(out), + [](const std::pair& entry) { + return entry.second.unknown_0004 <= g_session.m_level && g_session.m_level <= entry.second.unknown_0008; + }); + out.sort([](const std::pair& lhs, const std::pair& rhs) { return lhs.second.unknown_0004 < rhs.second.unknown_0004; }); @@ -1569,8 +1569,8 @@ bool CAdventureGuideMgr::Load() { // OFFSET: 0x00667200 // FUNCTION: fn_05256 -bool CAdventureGuideMgr::IsAvailable(int type, int id) const { - const std::map>* contents = nullptr; +bool CAdventureGuideMgr::IsAvailable(int type, int id) { + std::map>* contents = nullptr; switch (type) { case 1: contents = &this->unknown_003C; @@ -1583,12 +1583,12 @@ bool CAdventureGuideMgr::IsAvailable(int type, int id) const { break; case 5: case 6: { - const auto& entries = type == 5 ? this->unknown_0054 : this->unknown_005C; - const auto found = entries.find(id); - if (found == entries.end()) { + auto& entries = type == 5 ? this->unknown_0054 : this->unknown_005C; + const std::optional*> found = FindMapped(entries, id); + if (!found) { return true; } - for (const auto& entry : found->second) { + for (const auto& entry : **found) { if (entry.second.IsAvailable(entry.first)) { return true; } @@ -1599,11 +1599,11 @@ bool CAdventureGuideMgr::IsAvailable(int type, int id) const { return true; } - const auto found = contents->find(id); - if (found == contents->end()) { + const std::optional*> found = FindMapped(*contents, id); + if (!found) { return true; } - for (const auto& entry : found->second) { + for (const auto& entry : **found) { if (entry.second.unknown_0004 <= g_session.m_level && g_session.m_level <= entry.second.unknown_0008) { return true; } diff --git a/Source/Contents/AdventureGuideMgr.h b/Source/Contents/AdventureGuideMgr.h index f680ce44..0671a3d8 100644 --- a/Source/Contents/AdventureGuideMgr.h +++ b/Source/Contents/AdventureGuideMgr.h @@ -101,7 +101,7 @@ public: CAdventureGuideMgr(); virtual ~CAdventureGuideMgr(); - bool IsAvailable(int type, int id) const; + bool IsAvailable(int type, int id); void Init(); bool Load(); void GetEpisodeList(std::list& out);