Dump and read attachment and attachment uniques to and from weapon files

This commit is contained in:
Jan
2021-03-26 15:27:37 +01:00
parent 540e631fd5
commit 055dd5e840
4 changed files with 168 additions and 5 deletions

View File

@ -214,6 +214,50 @@ namespace T6
break;
}
case WFT_ATTACHMENTS:
{
const auto* attachments = reinterpret_cast<WeaponAttachment**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
std::stringstream ss;
auto first = true;
for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::attachments)>::value; i++)
{
if (attachments[i])
{
if (!first)
ss << "\n";
else
first = false;
ss << AssetName(attachments[i]->szInternalName);
}
}
m_info_string.SetValueForKey(std::string(field.szName), ss.str());
break;
}
case WFT_ATTACHMENT_UNIQUES:
{
const auto* attachmentUniques = reinterpret_cast<WeaponAttachmentUnique**>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
std::stringstream ss;
auto first = true;
for (auto i = 0u; i < std::extent<decltype(WeaponFullDef::attachmentUniques)>::value; i++)
{
if (attachmentUniques[i])
{
if (!first)
ss << "\n";
else
first = false;
ss << AssetName(attachmentUniques[i]->szInternalName);
}
}
m_info_string.SetValueForKey(std::string(field.szName), ss.str());
break;
}
case WFT_NUM_FIELD_TYPES:
default:
assert(false);