Decompile fn_13883 (StripColorTokens)
Batch #13855 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_13883 StripColorTokens: logic confirmed by peer review Peer-reviewed-by: Yommy, KWDev, StrawberrysherbetIX 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
93c0ad13bd
commit
878c46a2ca
1 changed files with 13 additions and 11 deletions
|
|
@ -45,17 +45,19 @@ bool IsHexColorToken(const char* text, const char* end) {
|
|||
std::string __stdcall StripColorTokens(const char* text, std::uint32_t length) {
|
||||
std::string result;
|
||||
result.reserve(length);
|
||||
if (text != nullptr) {
|
||||
const char* current = text;
|
||||
const char* end = text + length;
|
||||
while (current < end) {
|
||||
if (IsHexColorToken(current, end)) {
|
||||
current += 7;
|
||||
} else if (IsPipeColorToken(current)) {
|
||||
current += 3;
|
||||
} else {
|
||||
result.push_back(*current++);
|
||||
}
|
||||
if (text == nullptr) {
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* current = text;
|
||||
const char* end = text + length;
|
||||
while (current < end) {
|
||||
if (IsHexColorToken(current, end)) {
|
||||
current += 7;
|
||||
} else if (IsPipeColorToken(current)) {
|
||||
current += 3;
|
||||
} else {
|
||||
result.push_back(*current++);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue