rodecomp/Source/Archive/PakName.cpp
ragnarok-clanker e168b4e4a6 Restore translation-unit ownership and publish verified source corrections
Owner-authorized source migration: 31 helper-only translation units were merged into their callers or existing inline headers; both build manifests updated. Includes the preserved source payload, Lua configuration matching wowdecomp, and exact malloca expansion without diagnostic pragmas.

449 native units compiled locally and 449 staged units compiled by the pinned server toolchain. No previously byte-matched function regressed. Compiler mapping diagnostics remain recorded as needs_cleanup, not accepted or peer-confirmed. Existing independent review records are preserved. README.md is intentionally unchanged.
2026-10-25 15:42:21 +00:00

55 lines
1.4 KiB
C++

#include "Archive/PakName.h"
#include <cstdlib>
#include <cstring>
namespace myGPack {
// OFFSET: 0x00AECE00
// FUNCTION: fn_18145
PakName::PakName() {
this->Assign("");
}
// OFFSET: 0x00AECF90
// FUNCTION: fn_18149
PakName& PakName::Assign(const char* name) {
AssignNameKey(this->m_hash, this->m_name, name);
return *this;
}
// INLINED
void AssignNameKey(std::uint32_t& result, char* destination, const char* source) {
std::strcpy(destination, source);
_strlwr(destination);
const std::size_t length = std::strlen(destination);
std::uint32_t hash = 5381;
for (std::size_t i = 0; i < length; ++i) {
hash = 33 * hash + static_cast<std::int8_t>(destination[i]);
}
result = hash;
}
// OFFSET: 0x00AECE20
// FUNCTION: fn_18146
bool PakName::operator==(const PakName& other) const {
return this->m_hash == other.m_hash && std::strcmp(this->m_name, other.m_name) == 0;
}
// OFFSET: 0x00AECE80
// FUNCTION: fn_18147
bool PakName::operator!=(const PakName& other) const {
return this->m_hash != other.m_hash || std::strcmp(this->m_name, other.m_name) != 0;
}
// OFFSET: 0x00AECEE0
// FUNCTION: fn_18148
bool PakName::operator<(const PakName& other) const {
if (this->m_hash == other.m_hash) {
return std::strcmp(this->m_name, other.m_name) < 0;
}
return this->m_hash < other.m_hash;
}
}