1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-21 00:19:29 +02:00

Restored text export command

This commit is contained in:
Ivan Savenko
2022-12-28 01:13:48 +02:00
parent 1979b3e97f
commit a499390b9c
2 changed files with 29 additions and 60 deletions

View File

@ -543,14 +543,12 @@ CGeneralTextHandler::CGeneralTextHandler():
}
if (VLC->modh->modules.COMMANDERS)
{
if (CResourceHandler::get()->existsResource(ResourceID("DATA/ZNPC00.TXT", EResType::TEXT)))
readToVector("vcmi.znpc00", "DATA/ZNPC00.TXT" );
}
dumpAllTexts();
}
int32_t CGeneralTextHandler::pluralText(const int32_t textIndex, const int32_t count) const
if (CResourceHandler::get()->existsResource(ResourceID("DATA/ZNPC00.TXT", EResType::TEXT)))
readToVector("vcmi.znpc00", "DATA/ZNPC00.TXT" );
}
}
int32_t CGeneralTextHandler::pluralText(const int32_t textIndex, const int32_t count) const
{
if(textIndex == 0)
return 0;
@ -558,28 +556,28 @@ int32_t CGeneralTextHandler::pluralText(const int32_t textIndex, const int32_t c
return -textIndex;
else if(count == 1)
return textIndex;
else
return textIndex + 1;
}
void CGeneralTextHandler::dumpAllTexts()
{
logGlobal->trace("BEGIN TEXT EXPORT");
for ( auto const & entry : stringsLocalizations)
{
auto cleanString = entry.second;
boost::replace_all(cleanString, "\\", "\\\\");
boost::replace_all(cleanString, "\n", "\\n");
boost::replace_all(cleanString, "\r", "\\r");
boost::replace_all(cleanString, "\t", "\\t");
boost::replace_all(cleanString, "\"", "\\\"");
logGlobal->trace("\"%s\" : \"%s\",", entry.first, cleanString);
}
logGlobal->trace("END TEXT EXPORT");
}
size_t CGeneralTextHandler::getCampaignLength(size_t campaignID) const
else
return textIndex + 1;
}
void CGeneralTextHandler::dumpAllTexts()
{
logGlobal->info("BEGIN TEXT EXPORT");
for ( auto const & entry : stringsLocalizations)
{
auto cleanString = entry.second;
boost::replace_all(cleanString, "\\", "\\\\");
boost::replace_all(cleanString, "\n", "\\n");
boost::replace_all(cleanString, "\r", "\\r");
boost::replace_all(cleanString, "\t", "\\t");
boost::replace_all(cleanString, "\"", "\\\"");
logGlobal->info("\"%s\" : \"%s\",", entry.first, cleanString);
}
logGlobal->info("END TEXT EXPORT");
}
size_t CGeneralTextHandler::getCampaignLength(size_t campaignID) const
{
assert(campaignID < scenariosCountPerCampaign.size());