From c348afbe7b629a428ef5ec0e18ddda779da9973f Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 31 Oct 2026 18:04:40 +0000 Subject: [PATCH] Decompile fn_19620 (CNavigationManager::UpdateSearchResults) Batch #8461 by alisonrag: 0 byte-identical, 1 confirmed by peer review. - fn_19620 CNavigationManager::UpdateSearchResults: logic confirmed by peer review Peer-reviewed-by: Yommy, dori Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/NavigationManager.h | 1 + Source/Contents/NavigationRoute.cpp | 38 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/Source/Contents/NavigationManager.h b/Source/Contents/NavigationManager.h index 9c9951ab..2d7c637e 100644 --- a/Source/Contents/NavigationManager.h +++ b/Source/Contents/NavigationManager.h @@ -345,6 +345,7 @@ public: void ClearStates(); void ClearNodes(); void RefreshSearch(); + bool UpdateSearchResults(); int FindNodePath(unsigned int index); void SelectNodePath(std::string name); int GetRouteResult() const; diff --git a/Source/Contents/NavigationRoute.cpp b/Source/Contents/NavigationRoute.cpp index 4d071e55..51ae97f7 100644 --- a/Source/Contents/NavigationRoute.cpp +++ b/Source/Contents/NavigationRoute.cpp @@ -22,6 +22,7 @@ #include "Utility/RegistryKey.h" #include +#include #include #include #include @@ -1024,6 +1025,43 @@ void CNavigationManager::RefreshSearch() { } } +// OFFSET: 0x00B9C5C0 +// FUNCTION: fn_19620 +bool CNavigationManager::UpdateSearchResults() { + this->unknown_125C = 0; + if (!this->data.Search(this->unknown_1264, 0, this->states)) { + return false; + } + + std::sort(this->states.begin(), this->states.end(), [](const NavigationTarget& left, const NavigationTarget& right) { return left > right; }); + this->ClearNodePaths(); + + if (this->unknown_1260 == 0 || this->unknown_1260 == 1) { + for (unsigned index = 0; index < this->states.size(); ++index) { + if (this->states[index].type == 1) { + this->nodePaths.push_back(std::vector(1, static_cast(index))); + } + } + } + + for (unsigned index = 0; index < this->states.size(); ++index) { + const int type = this->states[index].type; + if ((this->unknown_1260 != 0 && type != this->unknown_1260) || type == 1) { + continue; + } + + const int path = this->FindNodePath(index); + if (path == -1) { + this->nodePaths.push_back(std::vector(1, static_cast(index))); + } else { + this->nodePaths[path].push_back(static_cast(index)); + } + } + + this->SelectNodePath(this->unknown_1264); + return true; +} + // OFFSET: 0x00B9C740 // FUNCTION: fn_19623 int CNavigationManager::AddWrappedRouteLines(int kind, int x, int y, const char* text) {