From e4e285180f0b482f722601e1ebb852583b8c9602 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 28 Oct 2026 22:50:17 +0000 Subject: [PATCH] Decompile fn_19610 (CNavigationManager::SavedTargetText) Batch #1844 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review. - fn_19610 CNavigationManager::SavedTargetText: logic confirmed by peer review 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 | 53 +++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/Source/Contents/NavigationManager.h b/Source/Contents/NavigationManager.h index 7fa6a00..111511e 100644 --- a/Source/Contents/NavigationManager.h +++ b/Source/Contents/NavigationManager.h @@ -254,6 +254,7 @@ public: float FitToSquare(int* offsetX, int* offsetY, int width, int height, float size) const; void LoadSettings(); bool BuildRoute(int startX, int startY, int destX, int destY, bool collectCells); + bool SavedTargetText(char* out, int size); int RequestRoute(int cellX, int cellY); NaviCell* MapCellToView(NaviCell* out, const char* mapName, int cellX, int cellY, float size); std::string RouteText(); diff --git a/Source/Contents/NavigationRoute.cpp b/Source/Contents/NavigationRoute.cpp index 8734e9b..cfb2156 100644 --- a/Source/Contents/NavigationRoute.cpp +++ b/Source/Contents/NavigationRoute.cpp @@ -392,3 +392,56 @@ CNavi_Object::~CNavi_Object() { this->info = nullptr; this->links.clear(); } + +// OFFSET: 0x00B98E40 +// FUNCTION: fn_19610 +bool CNavigationManager::SavedTargetText(char* out, int size) { + if (out == nullptr || this->savedTarget.object == nullptr) { + return false; + } + + std::memset(out, 0, size); + char text[0x104]; + std::memset(text, 0, sizeof(text)); + + switch (this->savedTarget.type) { + case 0: { + CNaviInfo* info = static_cast(this->savedTarget.object); + NaviCell cellY; + NaviCell cellX; + const int y = this->data.GetCell(&cellY)->y; + const int x = this->data.GetCell(&cellX)->x; + std::sprintf(text, "%s %d %d", info->GetName(), x, y); + break; + } + case 1: + std::sprintf(text, "%s", static_cast(this->savedTarget.object)->GetName()); + break; + case 2: { + CNavi_Object* object = static_cast(this->savedTarget.object); + CNaviInfo* info = object->GetInfo(); + NaviCell cellY; + NaviCell cellX; + const int y = object->GetCell(&cellY)->y; + const int x = object->GetCell(&cellX)->x; + std::sprintf(text, "%s %d %d", info->GetName(), x, y); + break; + } + case 3: + std::sprintf(text, "%s", static_cast(this->savedTarget.object)->GetInfo()->GetName()); + break; + default: + return false; + } + + const int length = static_cast(std::strlen(text)); + if (size > length) { + std::memcpy(out, text, length); + } else { + char truncated[0x104]; + std::memset(truncated, 0, sizeof(truncated)); + std::memcpy(truncated, text, size - 4); + std::sprintf(out, "%s...", truncated); + } + return true; +}