From 92942e14c5d1dc9bed42386490ccedab356e96ce Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 29 Oct 2026 19:31:24 +0000 Subject: [PATCH] Decompile fn_19502 (CNaviInfo::SearchMap) Batch #2838 by youko: 0 byte-identical, 1 confirmed by peer review. - fn_19502 CNaviInfo::SearchMap: logic confirmed by peer review Peer-reviewed-by: meitogi, willerthal, superintelligence Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/NavigationRequest.cpp | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/Source/Contents/NavigationRequest.cpp b/Source/Contents/NavigationRequest.cpp index 28689780..a5cff971 100644 --- a/Source/Contents/NavigationRequest.cpp +++ b/Source/Contents/NavigationRequest.cpp @@ -422,6 +422,48 @@ void CNaviInfo::Search(int type, const std::vector& keywords, std:: } // OFFSET: 0x00B8EE50 +// FUNCTION: fn_19502 +void CNaviInfo::SearchMap(const std::vector& keywords, std::vector& out) { + NavigationTarget target(1, nullptr); + wchar_t buffer[100]; + std::memset(buffer, 0, sizeof(buffer)); + + std::vector wideKeywords; + for (const std::string& keyword : keywords) { + MultiByteToWideChar(CP_ACP, 0, keyword.c_str(), -1, buffer, 100); + wideKeywords.push_back(std::wstring(buffer)); + } + + const std::string text = this->name + ' ' + this->title + ' '; + MultiByteToWideChar(CP_ACP, 0, text.c_str(), -1, buffer, 100); + const std::wstring wideText(buffer); + + const char* mapName = this->name.c_str(); + if (std::strcmp(mapName, "gl_in01") != 0 && std::strstr(mapName, "_in") != nullptr) { + return; + } + + bool matched = true; + for (const std::wstring& keyword : wideKeywords) { + matched &= StrStrIW(wideText.c_str(), keyword.c_str()) != nullptr; + } + if (!matched) { + return; + } + + target.name = this->name; + target.object = this; + out.push_back(target); + + target.type = 3; + for (CNavi_Object* mob : this->mobs) { + target.x = -1000; + target.y = -1000; + target.name = mob->GetName(); + target.object = mob; + out.push_back(target); + } +} // OFFSET: 0x00B8F560