From dddb972fd995e2ca498b45f8312785547553e8d2 Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Sat, 27 Aug 2016 12:15:51 +0300 Subject: [PATCH] Fix the empty initialization option being ignored in the execution stage. --- source/Core.cpp | 18 +++++++++++++++--- source/Core.hpp | 1 + 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/source/Core.cpp b/source/Core.cpp index c81ffbdc..b6207419 100644 --- a/source/Core.cpp +++ b/source/Core.cpp @@ -156,6 +156,7 @@ Core::Core() , m_LockPreLoadSignal(false) , m_LockPostLoadSignal(false) , m_LockUnloadSignal(false) + , m_EmptyInit(false) , m_Verbosity(1) { /* ... */ @@ -206,6 +207,8 @@ bool Core::Initialize() return false; } + // Configure the empty initialization + m_EmptyInit = conf.GetBoolValue("Squirrel", "EmptyInit", false); // Configure the verbosity level m_Verbosity = conf.GetLongValue("Log", "VerbosityLevel", 1); // Initialize the log filename @@ -316,7 +319,7 @@ bool Core::Initialize() } // 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"); // No point in loading the plug-in @@ -360,9 +363,18 @@ bool Core::Initialize() bool Core::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 diff --git a/source/Core.hpp b/source/Core.hpp index e439eb15..7afe5243 100644 --- a/source/Core.hpp +++ b/source/Core.hpp @@ -568,6 +568,7 @@ private: bool m_LockPreLoadSignal; // Lock pre load signal container. bool m_LockPostLoadSignal; // Lock post load 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.