Save scriptstrings per zone and not per asset since that solves all problems with multiple assets of the same zone referencing the same struct in memory that has scriptstring indices

This commit is contained in:
Jan
2020-10-23 15:54:27 +02:00
parent f8e7a10789
commit eed7164b5b
36 changed files with 387 additions and 447 deletions

View File

@ -26,7 +26,7 @@ bool ZoneDumper::DumpZone(Zone* zone, const std::string& basePath) const
dumper.DumpPool(zone, assetPools->poolName.get(), basePath); \
}
const auto* assetPools = dynamic_cast<GameAssetPoolIW4*>(zone->GetPools());
const auto* assetPools = dynamic_cast<GameAssetPoolIW4*>(zone->m_pools.get());
// DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset)
// DUMP_ASSET_POOL(AssetDumperPhysCollmap, m_phys_collmap)

View File

@ -1450,7 +1450,7 @@ namespace T6
std::stringstream ss;
bool first = true;
for(auto i = 0u; i < _countof(WeaponFullDef::notetrackSoundMapKeys); i++)
for (auto i = 0u; i < _countof(WeaponFullDef::notetrackSoundMapKeys); i++)
{
const auto& key = m_get_scr_string(keys[i]);
const auto& value = m_get_scr_string(values[i]);
@ -1634,10 +1634,11 @@ void AssetDumperWeapon::DumpAsset(Zone* zone, XAssetInfo<WeaponVariantDef>* asse
InfoStringFromWeaponConverter converter(fullDef, weapon_fields, _countof(weapon_fields), [asset](const scr_string_t scrStr) -> std::string
{
if (scrStr >= asset->m_script_strings.size())
assert(scrStr < asset->m_zone->m_script_strings.size());
if (scrStr >= asset->m_zone->m_script_strings.size())
return "";
return asset->m_script_strings[scrStr];
return asset->m_zone->m_script_strings[scrStr];
});
const auto infoString = converter.Convert();

View File

@ -29,7 +29,7 @@ bool ZoneDumper::DumpZone(Zone* zone, const std::string& basePath) const
dumper.DumpPool(zone, assetPools->poolName, basePath); \
}
const auto assetPools = dynamic_cast<GameAssetPoolT6*>(zone->GetPools());
const auto assetPools = dynamic_cast<GameAssetPoolT6*>(zone->m_pools.get());
// DUMP_ASSET_POOL(AssetDumperPhysPreset, m_phys_preset);
// DUMP_ASSET_POOL(AssetDumperPhysConstraints, m_phys_constraints);