fix: fix weapon attachment unique hidetags

This commit is contained in:
Jan 2024-02-13 23:53:59 +01:00
parent 66e8f8fa78
commit b9bf4778fa
No known key found for this signature in database
GPG Key ID: 44B581F78FF5C57C
2 changed files with 8 additions and 5 deletions

View File

@ -112,7 +112,8 @@ bool AssetLoaderWeaponAttachment::LoadFromInfoString(
CalculateAttachmentFields(attachment); CalculateAttachmentFields(attachment);
attachment->szInternalName = memory->Dup(assetName.c_str()); attachment->szInternalName = memory->Dup(assetName.c_str());
manager->AddAsset(ASSET_TYPE_ATTACHMENT, assetName, attachment, converter.GetDependencies(), converter.GetUsedScriptStrings()); manager->AddAsset(
ASSET_TYPE_ATTACHMENT, assetName, attachment, converter.GetDependencies(), converter.GetUsedScriptStrings(), converter.GetIndirectAssetReferences());
return true; return true;
} }

View File

@ -34,23 +34,25 @@ namespace T6
} }
auto* hideTags = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset); auto* hideTags = reinterpret_cast<scr_string_t*>(reinterpret_cast<uintptr_t>(m_structure) + field.iOffset);
auto currentHideTag = 0u;
if (valueArray.size() < std::extent_v<decltype(WeaponFullDef::hideTags)>) if (valueArray.size() < std::extent_v<decltype(WeaponFullDef::hideTags)>)
{ {
m_used_script_string_list.emplace(m_zone_script_strings.AddOrGetScriptString("")); m_used_script_string_list.emplace(m_zone_script_strings.AddOrGetScriptString(nullptr));
} }
auto currentHideTag = 0u;
for (; currentHideTag < valueArray.size(); currentHideTag++) for (; currentHideTag < valueArray.size(); currentHideTag++)
{ {
const auto scrString = m_zone_script_strings.AddOrGetScriptString(valueArray[currentHideTag]); const auto& currentValue = valueArray[currentHideTag];
const auto scrString =
!currentValue.empty() ? m_zone_script_strings.AddOrGetScriptString(currentValue) : m_zone_script_strings.AddOrGetScriptString(nullptr);
hideTags[currentHideTag] = scrString; hideTags[currentHideTag] = scrString;
m_used_script_string_list.emplace(scrString); m_used_script_string_list.emplace(scrString);
} }
for (; currentHideTag < std::extent_v<decltype(WeaponFullDef::hideTags)>; currentHideTag++) for (; currentHideTag < std::extent_v<decltype(WeaponFullDef::hideTags)>; currentHideTag++)
{ {
hideTags[currentHideTag] = m_zone_script_strings.GetScriptString(""); hideTags[currentHideTag] = m_zone_script_strings.GetScriptString(nullptr);
} }
return true; return true;