Unlinker: Do not list localized strings one by one in the zone file and do not include keyvaluepairs at all because they should be in the meta data

This commit is contained in:
Jan 2020-02-19 14:45:55 +01:00
parent f0b66f0a35
commit 14593b4799
3 changed files with 31 additions and 12 deletions

View File

@ -27,13 +27,3 @@ void AbstractZoneDefWriter::WriteEntry(const std::string& entryKey, const std::s
{ {
m_file->Printf("%s,%s\n", entryKey.c_str(), entryValue.c_str()); 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);
}
}

View File

@ -14,7 +14,6 @@ protected:
void WriteComment(const std::string& comment) const; void WriteComment(const std::string& comment) const;
void WriteMetaData(const std::string& metaDataKey, const std::string& metaDataValue) const; void WriteMetaData(const std::string& metaDataKey, const std::string& metaDataValue) const;
void WriteEntry(const std::string& entryKey, const std::string& entryValue) const; void WriteEntry(const std::string& entryKey, const std::string& entryValue) const;
void WriteContent() const;
AbstractZoneDefWriter(Zone* zone, FileAPI::IFile* file); AbstractZoneDefWriter(Zone* zone, FileAPI::IFile* file);

View File

@ -5,6 +5,7 @@
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
#include <cassert>
using namespace T6; using namespace T6;
@ -47,6 +48,35 @@ class ZoneDefWriterT6Impl final : public AbstractZoneDefWriter
WriteMetaData(str.str(), kvp->value); WriteMetaData(str.str(), kvp->value);
} }
void WriteContent() const
{
const auto* pools = dynamic_cast<GameAssetPoolT6*>(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: public:
ZoneDefWriterT6Impl(Zone* zone, FileAPI::IFile* file) ZoneDefWriterT6Impl(Zone* zone, FileAPI::IFile* file)
: AbstractZoneDefWriter(zone, file) : AbstractZoneDefWriter(zone, file)