aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/squirrel
diff options
context:
space:
mode:
authorunknown <for.oliver.kirkham@gmail.com>2023-02-13 13:51:40 +0000
committerBobTheBob <for.oliver.kirkham@gmail.com>2023-02-22 22:18:56 +0000
commit93871f36c2e36996d880aa68d6445c7d3802c100 (patch)
treefb1dfd1555eb9b4bc061394cd78856667d48fe4a /NorthstarDLL/squirrel
parent07e386b12cb1a92c99cd5e3034cb4f94f28fb3eb (diff)
downloadNorthstarLauncher-93871f36c2e36996d880aa68d6445c7d3802c100.tar.gz
NorthstarLauncher-93871f36c2e36996d880aa68d6445c7d3802c100.zip
refactor modloading and implement initial automatic reload code
Diffstat (limited to 'NorthstarDLL/squirrel')
-rw-r--r--NorthstarDLL/squirrel/squirrel.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/NorthstarDLL/squirrel/squirrel.cpp b/NorthstarDLL/squirrel/squirrel.cpp
index 4e64aecc..06ba445c 100644
--- a/NorthstarDLL/squirrel/squirrel.cpp
+++ b/NorthstarDLL/squirrel/squirrel.cpp
@@ -193,11 +193,8 @@ template <ScriptContext context> void SquirrelManager<context>::VMCreated(CSquir
{
bool bWasFound = false;
- for (Mod& dependency : g_pModManager->GetMods())
+ for (Mod& dependency : g_pModManager->GetMods() | ModManager::FilterEnabled)
{
- if (!dependency.m_bEnabled)
- continue;
-
if (dependency.Name == pair.second)
{
bWasFound = true;
@@ -207,6 +204,7 @@ template <ScriptContext context> void SquirrelManager<context>::VMCreated(CSquir
defconst(m_pSQVM, pair.first.c_str(), bWasFound);
}
+
g_pSquirrel<context>->messageBuffer = new SquirrelMessageBuffer();
}
@@ -217,7 +215,7 @@ template <ScriptContext context> void SquirrelManager<context>::VMDestroyed()
{
NS::log::squirrel_logger<context>()->info("Calling Destroy callbacks for all loaded mods.");
- for (const Mod& loadedMod : g_pModManager->m_LoadedMods)
+ for (const Mod& loadedMod : g_pModManager->GetMods())
{
for (const ModScript& script : loadedMod.Scripts)
{
@@ -471,11 +469,8 @@ template <ScriptContext context> bool __fastcall CallScriptInitCallbackHook(void
if (bShouldCallCustomCallbacks)
{
- for (Mod& mod : g_pModManager->GetMods())
+ for (Mod& mod : g_pModManager->GetMods() | ModManager::FilterEnabled)
{
- if (!mod.m_bEnabled)
- continue;
-
for (ModScript script : mod.Scripts)
{
for (ModScriptCallback modCallback : script.Callbacks)
@@ -498,11 +493,8 @@ template <ScriptContext context> bool __fastcall CallScriptInitCallbackHook(void
// run after callbacks
if (bShouldCallCustomCallbacks)
{
- for (Mod& mod : g_pModManager->GetMods())
+ for (Mod& mod : g_pModManager->GetMods() | ModManager::FilterEnabled)
{
- if (!mod.m_bEnabled)
- continue;
-
for (ModScript script : mod.Scripts)
{
for (ModScriptCallback modCallback : script.Callbacks)