feat(DBC): correct dbcstructure interfacing (#48)

32600759b8
This commit is contained in:
Kargatum
2021-10-22 22:41:22 +07:00
committed by GitHub
parent eb62c1e0f2
commit 627be00a2d

View File

@@ -198,22 +198,20 @@ std::string Transmogrification::GetItemLink(Item* item, WorldSession* session) c
if (int32 itemRandPropId = item->GetItemRandomPropertyId()) if (int32 itemRandPropId = item->GetItemRandomPropertyId())
{ {
char* const* suffix = NULL; std::array<char const*, 16> const* suffix = nullptr;
if (itemRandPropId < 0) if (itemRandPropId < 0)
{ {
const ItemRandomSuffixEntry* itemRandEntry = sItemRandomSuffixStore.LookupEntry(-item->GetItemRandomPropertyId()); if (const ItemRandomSuffixEntry* itemRandEntry = sItemRandomSuffixStore.LookupEntry(-itemRandPropId))
if (itemRandEntry) suffix = &itemRandEntry->Name;
suffix = itemRandEntry->nameSuffix;
} }
else else
{ {
const ItemRandomPropertiesEntry* itemRandEntry = sItemRandomPropertiesStore.LookupEntry(item->GetItemRandomPropertyId()); if (const ItemRandomPropertiesEntry* itemRandEntry = sItemRandomPropertiesStore.LookupEntry(itemRandPropId))
if (itemRandEntry) suffix = &itemRandEntry->Name;
suffix = itemRandEntry->nameSuffix;
} }
if (suffix) if (suffix)
{ {
std::string test(suffix[(name != temp->Name1) ? loc_idx : DEFAULT_LOCALE]); std::string_view test((*suffix)[(name != temp->Name1) ? loc_idx : DEFAULT_LOCALE]);
if (!test.empty()) if (!test.empty())
{ {
name += ' '; name += ' ';