mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Fix crash on starting Launcher without H3 data
This commit is contained in:
@@ -48,6 +48,20 @@ void CGeneralTextHandler::detectInstallParameters()
|
|||||||
"ukrainian"
|
"ukrainian"
|
||||||
} };
|
} };
|
||||||
|
|
||||||
|
if(!CResourceHandler::get("core")->existsResource(ResourceID("DATA/GENRLTXT.TXT", EResType::TEXT)))
|
||||||
|
{
|
||||||
|
Settings language = settings.write["session"]["language"];
|
||||||
|
language->String() = "english";
|
||||||
|
|
||||||
|
Settings confidence = settings.write["session"]["languageDeviation"];
|
||||||
|
confidence->Float() = 1.0;
|
||||||
|
|
||||||
|
Settings encoding = settings.write["session"]["encoding"];
|
||||||
|
encoding->String() = Languages::getLanguageOptions("english").encoding;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// load file that will be used for footprint generation
|
// load file that will be used for footprint generation
|
||||||
// this is one of the most text-heavy files in game and consists solely from translated texts
|
// this is one of the most text-heavy files in game and consists solely from translated texts
|
||||||
auto resource = CResourceHandler::get("core")->load(ResourceID("DATA/GENRLTXT.TXT", EResType::TEXT));
|
auto resource = CResourceHandler::get("core")->load(ResourceID("DATA/GENRLTXT.TXT", EResType::TEXT));
|
||||||
@@ -254,7 +268,7 @@ const std::string & CGeneralTextHandler::deserialize(const TextIdentifier & iden
|
|||||||
return identifier.get();
|
return identifier.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto const & entry = stringsLocalizations.at(identifier.get());
|
const auto & entry = stringsLocalizations.at(identifier.get());
|
||||||
|
|
||||||
if (!entry.overrideValue.empty())
|
if (!entry.overrideValue.empty())
|
||||||
return entry.overrideValue;
|
return entry.overrideValue;
|
||||||
@@ -312,7 +326,7 @@ bool CGeneralTextHandler::validateTranslation(const std::string & language, cons
|
|||||||
{
|
{
|
||||||
bool allPresent = true;
|
bool allPresent = true;
|
||||||
|
|
||||||
for (auto const & string : stringsLocalizations)
|
for(const auto & string : stringsLocalizations)
|
||||||
{
|
{
|
||||||
if (string.second.modContext != modContext)
|
if (string.second.modContext != modContext)
|
||||||
continue; // Not our mod
|
continue; // Not our mod
|
||||||
@@ -341,7 +355,7 @@ bool CGeneralTextHandler::validateTranslation(const std::string & language, cons
|
|||||||
|
|
||||||
bool allFound = true;
|
bool allFound = true;
|
||||||
|
|
||||||
for (auto const & string : config.Struct())
|
for(const auto & string : config.Struct())
|
||||||
{
|
{
|
||||||
if (stringsLocalizations.count(string.first) > 0)
|
if (stringsLocalizations.count(string.first) > 0)
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user