Decompile fn_18376 (LookupMessage)

Batch #14033 by eAthena: 0 byte-identical, 1 confirmed by peer review.

- fn_18376 LookupMessage: logic confirmed by peer review

Peer-reviewed-by: Yommy, KWDev, aDw
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-07 04:31:52 +00:00
commit 8e219d5737

View file

@ -4920,28 +4920,28 @@ const char* LookupMessage(int id) {
}
auto found = g_messageStrings.find(id);
if (found == g_messageStrings.end()) {
return "NO MSG";
if (found != g_messageStrings.end()) {
const std::string& text = found->second;
if (!g_inlineCharset || text[0] == '/' || text == "NO MSG") {
return text.c_str();
}
// STATIC: 0x016D57B4
// GLOBAL: gl_24383
static std::vector<std::string> cached(4698);
std::string& result = cached[id];
if (result.empty() || g_serviceType == 19) {
// STATIC: 0x016D57C8
// GLOBAL: gl_24384
static char buffer[260];
_snprintf_s(buffer, sizeof(buffer), _TRUNCATE, "%s%s", g_serverLanguage->Prefix(true), text.c_str());
result = buffer;
}
return result.c_str();
}
const std::string& text = found->second;
if (!g_inlineCharset || text[0] == '/' || text == "NO MSG") {
return text.c_str();
}
// STATIC: 0x016D57B4
// GLOBAL: gl_24383
static std::vector<std::string> cached(4698);
std::string& result = cached[id];
if (result.empty() || g_serviceType == 19) {
// STATIC: 0x016D57C8
// GLOBAL: gl_24384
static char buffer[260];
_snprintf_s(buffer, sizeof(buffer), _TRUNCATE, "%s%s", g_serverLanguage->Prefix(true), text.c_str());
result = buffer;
}
return result.c_str();
return "NO MSG";
}
void InsertMessageRow(std::vector<const char*>& row);