rodecomp/Source/File/MapName.cpp
ragnarok-clanker 1e7bac76f1 Decompile fn_21276 (ScriptMapName)
Batch #16143 by Yommy: 1 byte-identical, 0 confirmed by peer review.

- fn_21276 ScriptMapName: byte-identical

Merged automatically: every function is byte-identical to the original.
2026-11-10 14:47:15 +00:00

24 lines
634 B
C++

#include "File/MapName.h"
#include <array>
#include <cstdint>
#include <cstdio>
#include <map>
#include <windows.h>
// OFFSET: 0x00CD4E40
// FUNCTION: fn_21276
const char* ScriptMapName(std::string name) {
// STATIC: 0x017203E0
// GLOBAL: gl_24517
static std::map<std::intptr_t, std::array<char, 16>> buffers;
auto& output = buffers[reinterpret_cast<std::intptr_t>(GetCurrentThread())];
const std::size_t marker = name.rfind("@");
if (marker != std::string::npos && marker >= 4) {
name.erase(marker - 4, 3);
}
_snprintf_s(output.data(), output.size(), _TRUNCATE, "%s", name.c_str());
return output.data();
}