aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/client/modlocalisation.cpp
diff options
context:
space:
mode:
authorunknown <for.oliver.kirkham@gmail.com>2023-02-13 13:51:40 +0000
committerunknown <for.oliver.kirkham@gmail.com>2023-02-13 13:51:40 +0000
commit56372efa9706898c8646376182b544bc6350c5c7 (patch)
tree08b609e38c758f6c3431be5df6591d0c34d802bc /NorthstarDLL/client/modlocalisation.cpp
parent2c2bd9ebb8f832ff117caca16e5cb3bc806666db (diff)
downloadNorthstarLauncher-56372efa9706898c8646376182b544bc6350c5c7.tar.gz
NorthstarLauncher-56372efa9706898c8646376182b544bc6350c5c7.zip
refactor modloading and implement initial automatic reload code
Diffstat (limited to 'NorthstarDLL/client/modlocalisation.cpp')
-rw-r--r--NorthstarDLL/client/modlocalisation.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/NorthstarDLL/client/modlocalisation.cpp b/NorthstarDLL/client/modlocalisation.cpp
index db138315..04719934 100644
--- a/NorthstarDLL/client/modlocalisation.cpp
+++ b/NorthstarDLL/client/modlocalisation.cpp
@@ -26,10 +26,9 @@ void, __fastcall, (void* pVguiLocalize))
// clang-format on
{
// load all mod localization manually, so we keep track of all files, not just previously loaded ones
- for (Mod& mod : g_pModManager->GetMods())
- if (mod.m_bEnabled)
- for (std::string& localisationFile : mod.LocalisationFiles)
- CLocalize__AddFile(g_pVguiLocalize, localisationFile.c_str(), nullptr, false);
+ for (Mod& mod : g_pModManager->GetMods() | ModManager::FilterEnabled)
+ for (std::string& localisationFile : mod.LocalisationFiles)
+ CLocalize__AddFile(g_pVguiLocalize, localisationFile.c_str(), nullptr, false);
spdlog::info("reloading localization...");
CLocalize__ReloadLocalizationFiles(pVguiLocalize);
@@ -44,10 +43,9 @@ void, __fastcall, (void* self))
// previously we did this in CLocalize::AddFile, but for some reason it won't properly overwrite localization from
// files loaded previously if done there, very weird but this works so whatever
- for (Mod& mod : g_pModManager->GetMods())
- if (mod.m_bEnabled)
- for (std::string& localisationFile : mod.LocalisationFiles)
- CLocalize__AddFile(g_pVguiLocalize, localisationFile.c_str(), nullptr, false);
+ for (Mod& mod : g_pModManager->GetMods() | ModManager::FilterEnabled)
+ for (std::string& localisationFile : mod.LocalisationFiles)
+ CLocalize__AddFile(g_pVguiLocalize, localisationFile.c_str(), nullptr, false);
}
ON_DLL_LOAD_CLIENT("localize.dll", Localize, (CModule module))