diff --git a/src/Unlinker/ContentLister/ZoneDefWriter.cpp b/src/Unlinker/ContentLister/ZoneDefWriter.cpp index 586e1bc4..7888a47f 100644 --- a/src/Unlinker/ContentLister/ZoneDefWriter.cpp +++ b/src/Unlinker/ContentLister/ZoneDefWriter.cpp @@ -26,14 +26,4 @@ void AbstractZoneDefWriter::WriteMetaData(const std::string& metaDataKey, const void AbstractZoneDefWriter::WriteEntry(const std::string& entryKey, const std::string& entryValue) const { m_file->Printf("%s,%s\n", entryKey.c_str(), entryValue.c_str()); -} - -void AbstractZoneDefWriter::WriteContent() const -{ - const auto* pools = m_zone->GetPools(); - - for(const auto& asset : *pools) - { - WriteEntry(pools->GetAssetTypeName(asset->m_type), asset->m_name); - } -} +} \ No newline at end of file diff --git a/src/Unlinker/ContentLister/ZoneDefWriter.h b/src/Unlinker/ContentLister/ZoneDefWriter.h index 5c8f9e01..c378d115 100644 --- a/src/Unlinker/ContentLister/ZoneDefWriter.h +++ b/src/Unlinker/ContentLister/ZoneDefWriter.h @@ -14,7 +14,6 @@ protected: void WriteComment(const std::string& comment) const; void WriteMetaData(const std::string& metaDataKey, const std::string& metaDataValue) const; void WriteEntry(const std::string& entryKey, const std::string& entryValue) const; - void WriteContent() const; AbstractZoneDefWriter(Zone* zone, FileAPI::IFile* file); diff --git a/src/Unlinker/Game/T6/ZoneDefWriterT6.cpp b/src/Unlinker/Game/T6/ZoneDefWriterT6.cpp index 55c68643..b8b3487e 100644 --- a/src/Unlinker/Game/T6/ZoneDefWriterT6.cpp +++ b/src/Unlinker/Game/T6/ZoneDefWriterT6.cpp @@ -5,6 +5,7 @@ #include #include +#include using namespace T6; @@ -47,6 +48,35 @@ class ZoneDefWriterT6Impl final : public AbstractZoneDefWriter WriteMetaData(str.str(), kvp->value); } + void WriteContent() const + { + const auto* pools = dynamic_cast(m_zone->GetPools()); + + assert(pools); + if (!pools) + return; + + // Localized strings are all collected in one string file. So only add this to the zone file. + if(!pools->m_localize->m_asset_lookup.empty()) + { + WriteEntry(pools->GetAssetTypeName(ASSET_TYPE_LOCALIZE_ENTRY), m_zone->m_name); + } + + for (const auto& asset : *pools) + { + switch (asset->m_type) + { + case ASSET_TYPE_LOCALIZE_ENTRY: + case ASSET_TYPE_KEYVALUEPAIRS: // KeyValuePairs should be included as zone file metadata and not as content + break; + + default: + WriteEntry(pools->GetAssetTypeName(asset->m_type), asset->m_name); + break; + } + } + } + public: ZoneDefWriterT6Impl(Zone* zone, FileAPI::IFile* file) : AbstractZoneDefWriter(zone, file)