1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-03-15 08:37:14 +01:00

Fix the empty initialization option being ignored in the execution stage.

This commit is contained in:
Sandu Liviu Catalin 2016-08-27 12:15:51 +03:00
parent 7241d0bd02
commit dddb972fd9
2 changed files with 16 additions and 3 deletions

View File

@ -156,6 +156,7 @@ Core::Core()
, m_LockPreLoadSignal(false) , m_LockPreLoadSignal(false)
, m_LockPostLoadSignal(false) , m_LockPostLoadSignal(false)
, m_LockUnloadSignal(false) , m_LockUnloadSignal(false)
, m_EmptyInit(false)
, m_Verbosity(1) , m_Verbosity(1)
{ {
/* ... */ /* ... */
@ -206,6 +207,8 @@ bool Core::Initialize()
return false; return false;
} }
// Configure the empty initialization
m_EmptyInit = conf.GetBoolValue("Squirrel", "EmptyInit", false);
// Configure the verbosity level // Configure the verbosity level
m_Verbosity = conf.GetLongValue("Log", "VerbosityLevel", 1); m_Verbosity = conf.GetLongValue("Log", "VerbosityLevel", 1);
// Initialize the log filename // Initialize the log filename
@ -316,7 +319,7 @@ bool Core::Initialize()
} }
// See if any script could be queued for loading // See if any script could be queued for loading
if (m_PendingScripts.empty() && !conf.GetBoolValue("Squirrel", "EmptyInit", false)) if (m_PendingScripts.empty() && !m_EmptyInit)
{ {
LogErr("No scripts loaded. No reason to load the plug-in"); LogErr("No scripts loaded. No reason to load the plug-in");
// No point in loading the plug-in // No point in loading the plug-in
@ -360,9 +363,18 @@ bool Core::Initialize()
bool Core::Execute() bool Core::Execute()
{ {
// Are there any scripts to execute? // Are there any scripts to execute?
if (cLogErr(m_PendingScripts.empty(), "No scripts to execute. Plug-in has no purpose")) if (m_PendingScripts.empty())
{ {
return false; // No reason to execute the plug-in // Are we allowed to continue without any scripts?
if (m_EmptyInit)
{
LogWrn("No scripts to execute. Empty initialization was forced");
// Allow empty initialization since it was requested
return true;
}
LogWrn("No scripts to execute. Plug-in has no purpose");
// No reason to execute the plug-in
return false;
} }
// Unlock signal containers // Unlock signal containers

View File

@ -568,6 +568,7 @@ private:
bool m_LockPreLoadSignal; // Lock pre load signal container. bool m_LockPreLoadSignal; // Lock pre load signal container.
bool m_LockPostLoadSignal; // Lock post load signal container. bool m_LockPostLoadSignal; // Lock post load signal container.
bool m_LockUnloadSignal; // Lock unload signal container. bool m_LockUnloadSignal; // Lock unload signal container.
bool m_EmptyInit; // Whether to initialize without any scripts.
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
Int32 m_Verbosity; // Restrict the amount of outputted information. Int32 m_Verbosity; // Restrict the amount of outputted information.