Log the message "GMST ... not found" only once for each missing l10n GMST

depth-refraction
Petr Mikheev 2 years ago
parent 2b59c71333
commit 2838071751

@ -778,16 +778,21 @@ void OMW::Engine::prepareEngine()
mEnvironment.setWorldScene(mWorld->getWorldScene());
const MWWorld::Store<ESM::GameSetting>* gmst = &mWorld->getStore().get<ESM::GameSetting>();
mL10nManager->setGmstLoader([gmst](std::string_view gmstName) {
const ESM::GameSetting* res = gmst->search(gmstName);
if (res && res->mValue.getType() == ESM::VT_String)
return res->mValue.getString();
else
{
Log(Debug::Error) << "GMST " << gmstName << " not found";
return std::string("GMST:") + std::string(gmstName);
}
});
mL10nManager->setGmstLoader(
[gmst, misses = std::set<std::string, std::less<>>()](std::string_view gmstName) mutable {
const ESM::GameSetting* res = gmst->search(gmstName);
if (res && res->mValue.getType() == ESM::VT_String)
return res->mValue.getString();
else
{
if (misses.count(gmstName) == 0)
{
misses.emplace(gmstName);
Log(Debug::Error) << "GMST " << gmstName << " not found";
}
return std::string("GMST:") + std::string(gmstName);
}
});
mWindowManager->setStore(mWorld->getStore());
mWindowManager->initUI();

Loading…
Cancel
Save