1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

Don't load empty rumor strings

This commit is contained in:
Ivan Savenko
2022-12-28 01:14:19 +02:00
parent a499390b9c
commit 10541855d9
2 changed files with 44 additions and 32 deletions

View File

@ -398,7 +398,6 @@ CGeneralTextHandler::CGeneralTextHandler():
readToVector("core.priskill", "DATA/PRISKILL.TXT" );
readToVector("core.jktext", "DATA/JKTEXT.TXT" );
readToVector("core.tvrninfo", "DATA/TVRNINFO.TXT" );
readToVector("core.randtvrn", "DATA/RANDTVRN.TXT" );
readToVector("core.turndur", "DATA/TURNDUR.TXT" );
readToVector("core.heroscrn", "DATA/HEROSCRN.TXT" );
readToVector("core.tentcolr", "DATA/TENTCOLR.TXT" );
@ -416,6 +415,21 @@ CGeneralTextHandler::CGeneralTextHandler():
for ( auto const & node : vcmiTexts.Struct())
registerString(node.first, node.second.String());
{
CLegacyConfigParser parser("DATA/RANDTVRN.TXT");
parser.endLine();
size_t index = 0;
do
{
std::string line = parser.readString();
if (!line.empty())
{
registerH3String("core.randtvrn", index, line);
index += 1;
}
}
while (parser.endLine());
}
{
CLegacyConfigParser parser("DATA/GENRLTXT.TXT");
parser.endLine();
@ -543,12 +557,12 @@ CGeneralTextHandler::CGeneralTextHandler():
}
if (VLC->modh->modules.COMMANDERS)
{
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 (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;
@ -556,28 +570,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->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
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());