Decompile fn_10410 (EncodeNavigationNumber)
Batch #1448 by Yommy: 0 byte-identical, 1 confirmed by peer review. - fn_10410 EncodeNavigationNumber: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker Reviewed-by: ragnarok-clanker
This commit is contained in:
parent
a0aa87c8b2
commit
6805deb8aa
2 changed files with 22 additions and 0 deletions
|
|
@ -3,6 +3,7 @@
|
|||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
|
||||
// OFFSET: 0x00833160
|
||||
// FUNCTION: fn_10409
|
||||
|
|
@ -30,6 +31,26 @@ int DecodeNavigationNumber(std::string value) {
|
|||
return static_cast<int>(result);
|
||||
}
|
||||
|
||||
// OFFSET: 0x00833270
|
||||
// FUNCTION: fn_10410
|
||||
std::string EncodeNavigationNumber(int value) {
|
||||
const char digits[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
std::vector<char> characters;
|
||||
|
||||
do {
|
||||
characters.push_back(digits[value % 62]);
|
||||
value /= 62;
|
||||
} while (value >= 62);
|
||||
characters.push_back(digits[value]);
|
||||
|
||||
std::string result;
|
||||
const std::size_t count = characters.size();
|
||||
for (std::size_t index = 0; index < count; ++index) {
|
||||
result += characters[count - 1 - index];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00835890
|
||||
// FUNCTION: fn_10420
|
||||
bool ParseNavigationLink(std::string value, std::string& name, int& x, int& y) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <string>
|
||||
|
||||
int DecodeNavigationNumber(std::string value);
|
||||
std::string EncodeNavigationNumber(int value);
|
||||
bool ParseNavigationLink(std::string value, std::string& name, int& x, int& y);
|
||||
std::string FormatNavigationLink(std::string value, bool brackets);
|
||||
void DisplayNavigationLink(std::string& output, std::string value);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue