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.
87 lines
2.6 KiB
C++
87 lines
2.6 KiB
C++
#include "Contents/Items/ItemDescription.h"
|
|
#include "Contents/Items/ItemInfo.h"
|
|
|
|
#include <cstdio>
|
|
#include <cstdlib>
|
|
#include <cstring>
|
|
|
|
// OFFSET: 0x006D3540
|
|
// FUNCTION: fn_06540
|
|
ITEM_DESC::ITEM_DESC()
|
|
: identifiedName(nullptr), identifiedResource(nullptr), unidentifiedName(nullptr), unidentifiedResource(nullptr), unknown_002C(0), slots(0),
|
|
unknown_0040(0) {
|
|
}
|
|
|
|
// OFFSET: 0x006D3610
|
|
// OFFSET: 0x006D3680
|
|
// FUNCTION: fn_06541
|
|
ITEM_DESC::~ITEM_DESC() = default;
|
|
|
|
// OFFSET: 0x006D5160
|
|
// FUNCTION: fn_06568
|
|
ITEM_DESC& ITEM_DESC::operator=(const ITEM_DESC& other) {
|
|
if (this == &other) {
|
|
return *this;
|
|
}
|
|
|
|
this->identifiedName = other.identifiedName;
|
|
this->identifiedResource = other.identifiedResource;
|
|
this->identifiedDescription = other.identifiedDescription;
|
|
this->unidentifiedName = other.unidentifiedName;
|
|
this->unidentifiedResource = other.unidentifiedResource;
|
|
this->unidentifiedDescription = other.unidentifiedDescription;
|
|
this->unknown_002C = other.unknown_002C;
|
|
this->slots = other.slots;
|
|
this->unknown_0034 = other.unknown_0034;
|
|
this->unknown_0040 = other.unknown_0040;
|
|
|
|
return *this;
|
|
}
|
|
|
|
// OFFSET: 0x006D3A00
|
|
// OFFSET: 0x006D5890
|
|
// FUNCTION: fn_06545
|
|
ITEM_DESC& ItemDescriptions::Find(int id) {
|
|
static ITEM_DESC missing;
|
|
const auto entry = this->values.find(id);
|
|
return entry == this->values.end() ? missing : entry->second;
|
|
}
|
|
|
|
// OFFSET: 0x006D3DC0
|
|
// FUNCTION: fn_06548
|
|
ITEM_DESC& ItemDescriptions::Ensure(int id) {
|
|
return this->values[id];
|
|
}
|
|
|
|
// OFFSET: 0x00DDD280
|
|
// FUNCTION: fn_23382
|
|
void ItemDescriptions::IconPath(char* output, const char* id, int identified) {
|
|
const ITEM_DESC& value = this->Find(std::atoi(id));
|
|
const char* resource = identified != 0 ? value.identifiedResource : value.unidentifiedResource;
|
|
std::sprintf(output, "\xC0\xAF\xC0\xFA\xC0\xCE\xC5\xCD\xC6\xE4\xC0\xCC\xBD\xBA\\item\\%s.bmp", resource);
|
|
}
|
|
|
|
// OFFSET: 0x006D5730
|
|
// FUNCTION: fn_06576
|
|
const std::vector<const char*>& ItemDescriptions::Description(const ItemInfo& item) {
|
|
const ITEM_DESC& value = this->Find(std::atoi(item.itemId.c_str()));
|
|
return item.identified == 1 ? value.identifiedDescription : value.unidentifiedDescription;
|
|
}
|
|
|
|
// OFFSET: 0x006D5810
|
|
// FUNCTION: fn_06578
|
|
int ItemDescriptions::Name(const ItemInfo& item, char* output, int& capacity, unsigned char consume) {
|
|
const char* name = this->Find(std::atoi(item.itemId.c_str())).identifiedName;
|
|
const int error = strncpy_s(output, capacity, name ? name : " ", _TRUNCATE);
|
|
|
|
if (error != 0 && error != 80) {
|
|
return 0;
|
|
}
|
|
|
|
const int length = output ? static_cast<int>(strnlen(output, capacity)) : 0;
|
|
if (consume != 0) {
|
|
capacity -= length;
|
|
}
|
|
|
|
return length;
|
|
}
|