Add IW3 zone writing

This commit is contained in:
Jan
2021-04-17 11:19:55 +02:00
parent e6a10fb992
commit 687d1185a3
10 changed files with 342 additions and 13 deletions

View File

@ -84,13 +84,13 @@ void ZoneDefinitionOutputStream::WriteEntry(const std::string& entryKey, const s
{
m_stream << entryKey << ",";
if(entryValue.find('"') != std::string::npos
if (entryValue.find('"') != std::string::npos
|| entryValue.find("//") != std::string::npos)
{
m_stream << '"';
for(const auto& c : entryValue)
for (const auto& c : entryValue)
{
switch(c)
switch (c)
{
case '"':
m_stream << "\\\"";
@ -107,6 +107,10 @@ void ZoneDefinitionOutputStream::WriteEntry(const std::string& entryKey, const s
}
m_stream << '"';
}
else if (entryValue.empty())
{
m_stream << R"("")";
}
else
{
m_stream << entryValue;