From d9ff71a7fa18e75a97ad8f05f6dd7cfe65d205fd Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 5 Nov 2026 14:28:28 +0000 Subject: [PATCH] Decompile fn_19610 (CNavigationManager::SavedTargetText) Batch #12276 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_19610 CNavigationManager::SavedTargetText: logic confirmed by peer review Peer-reviewed-by: Yommy, Tanke, cremane Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/NavigationRoute.cpp | 41 +++++++++++------------------ 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/Source/Contents/NavigationRoute.cpp b/Source/Contents/NavigationRoute.cpp index 377a7ad2..9476c196 100644 --- a/Source/Contents/NavigationRoute.cpp +++ b/Source/Contents/NavigationRoute.cpp @@ -991,45 +991,34 @@ bool CNavigationManager::SavedTargetText(char* out, int 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: { + if (this->savedTarget.type == 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 %d %d", info->GetName(), object->GetCell(&cellX)->x, object->GetCell(&cellY)->y); + } else if (this->savedTarget.type == 3) { std::sprintf(text, "%s", static_cast(this->savedTarget.object)->GetInfo()->GetName()); - break; - default: + } else if (this->savedTarget.type == 1) { + std::sprintf(text, "%s", static_cast(this->savedTarget.object)->GetName()); + } else if (this->savedTarget.type == 0) { + CNaviInfo* info = static_cast(this->savedTarget.object); + NaviCell cellY; + NaviCell cellX; + std::sprintf(text, "%s %d %d", info->GetName(), this->data.GetCell(&cellX)->x, this->data.GetCell(&cellY)->y); + } else { return false; } - const int length = static_cast(std::strlen(text)); - if (size > length) { - std::memcpy(out, text, length); - } else { + if (size <= static_cast(std::strlen(text))) { char truncated[0x104]; std::memset(truncated, 0, sizeof(truncated)); std::memcpy(truncated, text, size - 4); std::sprintf(out, "%s...", truncated); + return true; } + + std::memcpy(out, text, std::strlen(text)); return true; }