From e303fc62ad6ac1bc26403939b5bb320e46177064 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 7 Nov 2026 05:04:49 +0000 Subject: [PATCH] Decompile fn_13837 (ParseItemIdTag) Batch #14076 by Yommy: 1 byte-identical, 0 confirmed by peer review. - fn_13837 ParseItemIdTag: byte-identical Merged automatically: every function is byte-identical to the original. --- Source/UI/Layout/SnapRectangle.cpp | 23 ----------------------- Source/UI/Text/TextWrapping.cpp | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/Source/UI/Layout/SnapRectangle.cpp b/Source/UI/Layout/SnapRectangle.cpp index 992eda4dd..4750068e0 100644 --- a/Source/UI/Layout/SnapRectangle.cpp +++ b/Source/UI/Layout/SnapRectangle.cpp @@ -110,26 +110,3 @@ void SnapRectangle::Snap(const SnapRectangle& other, int& dx, int& dy) const { } } -// OFFSET: 0x009B5140 -// FUNCTION: fn_13837 -int ParseItemIdTag(const char* text, const char* end, int& length, int& itemId) { - if (std::strncmp(text, "^nItemID^", 9) != 0) { - return 0; - } - - unsigned int digits = 0; - while (text + digits < end && g_colorHexDigit[static_cast(text[9 + digits])] != 0) { - ++digits; - } - - if (digits == 0) { - return 0; - } - - char number[10]; - std::strncpy(number, text + 9, digits); - number[digits] = '\0'; - length = digits + 9; - itemId = std::atoi(number); - return 1; -} diff --git a/Source/UI/Text/TextWrapping.cpp b/Source/UI/Text/TextWrapping.cpp index 35f595a2c..b2ba3e249 100644 --- a/Source/UI/Text/TextWrapping.cpp +++ b/Source/UI/Text/TextWrapping.cpp @@ -13,6 +13,12 @@ #include #include +// INLINED +static void AppendLine(std::vector& lines, const char* first, const char* last) { + const std::string line(first, last); + lines.push_back(line); +} + // OFFSET: 0x009B4220 // FUNCTION: fn_13829 void WrapPlainText(const char* text, std::vector& lines, int width) { @@ -162,3 +168,27 @@ void WrapRichText( } } } + +// OFFSET: 0x009B5140 +// FUNCTION: fn_13837 +int ParseItemIdTag(const char* text, const char* end, int& length, int& itemId) { + if (std::strncmp(text, "^nItemID^", 9) != 0) { + return 0; + } + + unsigned int digits = 0; + while (text + digits < end && g_colorHexDigit[static_cast(text[9 + digits])] != 0) { + ++digits; + } + + if (digits == 0) { + return 0; + } + + char number[10]; + std::strncpy(number, text + 9, digits); + number[digits] = '\0'; + length = digits + 9; + itemId = std::atoi(number); + return 1; +}