Decompile fn_13837 (ParseItemIdTag)
Batch #1562 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_13837 ParseItemIdTag: logic confirmed by peer review Reviewed-by: ragnarok-clanker
This commit is contained in:
parent
9162deb256
commit
ac307767e9
1 changed files with 28 additions and 0 deletions
|
|
@ -1,5 +1,9 @@
|
|||
#include "UI/Layout/SnapRectangle.h"
|
||||
|
||||
#include "Utility/Text/TextTokens.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <utility>
|
||||
|
||||
namespace {
|
||||
|
|
@ -95,3 +99,27 @@ 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<signed char>(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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue