Decompile fn_10408 (NavigationLinkParser::ExpandMessages)
Batch #14274 by secret: 0 byte-identical, 1 confirmed by peer review. - fn_10408 NavigationLinkParser::ExpandMessages: logic confirmed by peer review Peer-reviewed-by: Yommy, KWDev, codeplay Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
parent
9ba8de11f2
commit
ca7f713cc9
1 changed files with 9 additions and 4 deletions
|
|
@ -169,6 +169,8 @@ void DestroyNavigationLinkParser() {
|
|||
static const std::string g_parserMessageTag = "<MSG>";
|
||||
// GLOBAL: gl_25507
|
||||
static const std::string g_parserMessageCloseTag = "</MSG>";
|
||||
// STRING: st_13792
|
||||
static const std::string g_parserMessageIdPrefix = "MSI_";
|
||||
// STRING: st_13793
|
||||
static const std::string g_parserLineBreakTag = "<NR>";
|
||||
// GLOBAL: gl_25498
|
||||
|
|
@ -238,18 +240,18 @@ std::string NavigationLinkParser::ExpandMessages(std::string text) {
|
|||
|
||||
const std::size_t begin = work.find(g_parserMessageTag);
|
||||
if (begin == std::string::npos) {
|
||||
return text;
|
||||
break;
|
||||
}
|
||||
|
||||
work = work.substr(begin + std::strlen(g_parserMessageTag.c_str()));
|
||||
const std::size_t end = work.find(g_parserMessageCloseTag);
|
||||
if (end == std::string::npos) {
|
||||
return text;
|
||||
break;
|
||||
}
|
||||
|
||||
work = work.substr(0, end);
|
||||
int messageId;
|
||||
if (work.find("MSI_") != std::string::npos) {
|
||||
if (work.find(g_parserMessageIdPrefix) != std::string::npos) {
|
||||
messageId = FindMessageId(work.c_str());
|
||||
} else {
|
||||
messageId = std::atoi(work.c_str());
|
||||
|
|
@ -263,7 +265,8 @@ std::string NavigationLinkParser::ExpandMessages(std::string text) {
|
|||
work = expanded;
|
||||
}
|
||||
const std::string head = work.substr(0, begin);
|
||||
const std::string tail = work.substr(work.find(g_parserMessageCloseTag) + std::strlen(g_parserMessageCloseTag.c_str()));
|
||||
const std::size_t close = work.find(g_parserMessageCloseTag);
|
||||
const std::string tail = work.substr(close + std::strlen(g_parserMessageCloseTag.c_str()));
|
||||
expanded.clear();
|
||||
expanded += head;
|
||||
expanded += message;
|
||||
|
|
@ -273,6 +276,8 @@ std::string NavigationLinkParser::ExpandMessages(std::string text) {
|
|||
return expanded;
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00833160
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue