From ccc85e1fdae9d7a5f393a25c726426ef2c90146d Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sun, 1 Nov 2026 14:46:06 +0000 Subject: [PATCH] Decompile fn_03631 (UINavigationV4Wnd::LoadRoute) Batch #9520 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review. - fn_03631 UINavigationV4Wnd::LoadRoute: logic confirmed by peer review Peer-reviewed-by: Yommy, secret, dori, seumadruga Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Navigation/UINavigationV4Wnd.h | 1 + Source/UI/Window/UINavigationWnd.h | 2 + Source/UI/Window/UIWindow.cpp | 48 +++++++++++++++++++++++- 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/Source/UI/Navigation/UINavigationV4Wnd.h b/Source/UI/Navigation/UINavigationV4Wnd.h index df2d30be..07e1f842 100644 --- a/Source/UI/Navigation/UINavigationV4Wnd.h +++ b/Source/UI/Navigation/UINavigationV4Wnd.h @@ -43,6 +43,7 @@ public: std::string MobName(CNavi_Object* mob); void SelectRoute(int route); void FillRouteGroups(); + bool LoadRoute(int index); void SetRoadIcon(int slot); void InsertNavigationLink(std::string name, int x, int y); void DrawTargetSprite(int x, int y, int width, int height, const CBitmapRes* background); diff --git a/Source/UI/Window/UINavigationWnd.h b/Source/UI/Window/UINavigationWnd.h index d2907e50..cdfc410c 100644 --- a/Source/UI/Window/UINavigationWnd.h +++ b/Source/UI/Window/UINavigationWnd.h @@ -34,6 +34,8 @@ extern UIWindow* g_navigationWindow; extern bool g_navigationHidden; extern CActRes* g_navigationActions; extern CSprRes* g_navigationSprites; +extern bool g_navigationFilter; +extern int g_navigationSearchType; class UINavigationWnd : public UIFrameWnd { public: diff --git a/Source/UI/Window/UIWindow.cpp b/Source/UI/Window/UIWindow.cpp index e835d277..b025f1c9 100644 --- a/Source/UI/Window/UIWindow.cpp +++ b/Source/UI/Window/UIWindow.cpp @@ -1,3 +1,4 @@ +#include "Client/Application/Launcher.h" #include "Client/Input/InputCharset.h" #include "Client/Mode/CGameMode.h" #include "Client/Replay.h" @@ -27,9 +28,11 @@ #include "UI/Buttons/UIBasicButton.h" #include "UI/Buttons/UIBitmapButton.h" #include "UI/Buttons/UIButton.h" +#include "UI/Buttons/UICheckBox.h" #include "UI/Buttons/UIItemTagButton.h" #include "UI/Chat/ChatSuggestions.h" #include "UI/Edit/UIEditCtrl.h" +#include "UI/Lists/UIComboBoxDefWnd.h" #include "UI/Lists/UIListBoxNaviSearch.h" #include "UI/Lists/UIScrollBar.h" #include "UI/Lists/UIScrollBarNavi.h" @@ -2276,7 +2279,7 @@ void UIListBox_NaviSearch::Paint() { } } -// OFFSET: 0x005C5D40 +// OFFSET: 0x005C4EA0 // FUNCTION: fn_03582 void UINavigationroadiconWnd::Slot15(int, int) { this->AddCloseButton(*this->m_controls, LookupMessage(3045), 0); @@ -2581,6 +2584,49 @@ void UINavigationV4Wnd::SelectRoute(int route) { this->Invalidate(); } +// OFFSET: 0x005C9180 +// FUNCTION: fn_03631 +bool UINavigationV4Wnd::LoadRoute(int index) { + if (this->unknown_0104.empty() || static_cast(index) > this->unknown_0104.size() || index < 0) { + return false; + } + + std::string name = this->unknown_0104[index].c_str(); + if (name.size() == 0) { + return false; + } + + std::string path = FormatOwnedString("%s\\Navigationdata\\%s", g_applicationDirectory, name.c_str()); + FILE* file = fopen(path.c_str(), "rb"); + if (!file) { + return false; + } + + g_navigationManager.ClearStates(); + char delimiters[] = "\t ,\t\n"; + char line[1024]; + std::memset(line, 0, sizeof(line)); + std::vector tokens; + while (!feof(file)) { + fgets(line, 1024, file); + for (char* token = strtok(line, delimiters); token; token = strtok(nullptr, delimiters)) { + tokens.emplace_back(std::string(token)); + } + g_navigationManager.AddState(tokens); + tokens.erase(tokens.begin(), tokens.end()); + } + fclose(file); + g_navigationManager.BuildSingleNodePaths(); + + if (g_navigationManager.StateCount() > 0) { + reinterpret_cast(this)->RecordData(0x38F, g_navigationManager.WriteStates()); + } + + this->FillRouteGroups(); + this->SendMsg(this, 6, 190, 0, 0, 0); + return true; +} + // OFFSET: 0x005C9A20 // FUNCTION: fn_03634 void UINavigationV4Wnd::FillRouteGroups() {