Skip to content

Commit

Permalink
fixup! Keep main script in to be executed before custom scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
MiranDMC committed Nov 28, 2024
1 parent 0722fec commit 800d78d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions source/CScriptEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,12 +942,21 @@ namespace CLEO
GetInstance().ModuleSystem.LoadCleoModules();
LoadState(GetInstance().saveSlot);

// keep main script as first to be exected
CRunningScript* main = *activeThreadQueue;
RemoveScriptFromQueue(main, activeThreadQueue);
// keep already loaded scripts at front of processing queue
auto head = *activeThreadQueue;

auto tail = head;
while (tail->Next) tail = tail->Next;

// load custom scripts as new list
*activeThreadQueue = nullptr;
LoadCustomScripts();
AddScriptToQueue(main, activeThreadQueue);

// append custom scripts list to the back
tail->Next = *activeThreadQueue;
(*activeThreadQueue)->Previous = tail;

*activeThreadQueue = head; // restore original
}

void CScriptEngine::GameEnd()
Expand Down

0 comments on commit 800d78d

Please sign in to comment.