aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/squirrel/squirrel.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/squirrel/squirrel.cpp
parent2c2bd9ebb8f832ff117caca16e5cb3bc806666db (diff)
downloadNorthstarLauncher-56372efa9706898c8646376182b544bc6350c5c7.tar.gz
NorthstarLauncher-56372efa9706898c8646376182b544bc6350c5c7.zip
refactor modloading and implement initial automatic reload code
Diffstat (limited to 'NorthstarDLL/squirrel/squirrel.cpp')
-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 0bbc496f..0c538b21 100644
--- a/NorthstarDLL/squirrel/squirrel.cpp
+++ b/NorthstarDLL/squirrel/squirrel.cpp
@@ -194,11 +194,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;
@@ -208,6 +205,7 @@ template <ScriptContext context> void SquirrelManager<context>::VMCreated(CSquir
defconst(m_pSQVM, pair.first.c_str(), bWasFound);
}
+
g_pSquirrel<context>->messageBuffer = new SquirrelMessageBuffer();
}
@@ -218,7 +216,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)
{
@@ -472,11 +470,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)
@@ -499,11 +494,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)