1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +01:00

Update the script loading system to load and compile all scripts first and then execute them.

This commit is contained in:
Sandu Liviu Catalin 2016-06-18 13:09:08 +03:00
parent d1ae2fd7e8
commit 4be562c926

View File

@ -297,8 +297,8 @@ bool Core::Execute()
// Tell modules to do their monkey business // Tell modules to do their monkey business
_Func->SendPluginCommand(0xDEADBABE, ""); _Func->SendPluginCommand(0xDEADBABE, "");
LogDbg("Attempting to execute the specified scripts"); LogDbg("Attempting to compile the specified scripts");
// Go through each specified script // Compile scripts first so that the constants can take effect
for (auto & s : m_Scripts) for (auto & s : m_Scripts)
{ {
// Attempt to load and compile the script file // Attempt to load and compile the script file
@ -312,6 +312,14 @@ bool Core::Execute()
// Failed to execute properly // Failed to execute properly
return false; return false;
} }
// At this point the script should be completely loaded
LogDbg("Successfully compiled script: %s", s.mPath.c_str());
}
LogDbg("Attempting to execute the specified scripts");
// Execute scripts only after compilation successful
for (auto & s : m_Scripts)
{
// Attempt to execute the compiled script code // Attempt to execute the compiled script code
try try
{ {