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).
This commit is contained in:
ragnarok-clanker 2026-11-05 14:28:28 +00:00
commit d9ff71a7fa

View file

@ -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<CNaviInfo*>(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<CNaviInfo*>(this->savedTarget.object)->GetName());
break;
case 2: {
if (this->savedTarget.type == 2) {
CNavi_Object* object = static_cast<CNavi_Object*>(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<CNavi_Object*>(this->savedTarget.object)->GetInfo()->GetName());
break;
default:
} else if (this->savedTarget.type == 1) {
std::sprintf(text, "%s", static_cast<CNaviInfo*>(this->savedTarget.object)->GetName());
} else if (this->savedTarget.type == 0) {
CNaviInfo* info = static_cast<CNaviInfo*>(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<int>(std::strlen(text));
if (size > length) {
std::memcpy(out, text, length);
} else {
if (size <= static_cast<int>(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;
}