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

Remove the need to specify a VM after new changes.

This commit is contained in:
Sandu Liviu Catalin 2020-09-04 18:52:09 +03:00
parent 78fac29da0
commit 6fa8e85189
3 changed files with 6 additions and 11 deletions

View File

@ -151,21 +151,16 @@ void ScriptSrc::Process()
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
ScriptSrc::ScriptSrc(HSQUIRRELVM vm, const String & path, bool delay, bool info) ScriptSrc::ScriptSrc(const String & path, bool delay, bool info)
: mExec(vm) : mExec()
, mPath(path) , mPath(path)
, mData() , mData()
, mLine() , mLine()
, mInfo(info) , mInfo(info)
, mDelay(delay) , mDelay(delay)
{ {
// Is the specified virtual machine invalid?
if (!vm)
{
throw std::runtime_error("Invalid virtual machine pointer");
}
// Is the specified path empty? // Is the specified path empty?
else if (mPath.empty()) if (mPath.empty())
{ {
throw std::runtime_error("Invalid or empty script path"); throw std::runtime_error("Invalid or empty script path");
} }

View File

@ -39,7 +39,7 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Base constructor. * Base constructor.
*/ */
ScriptSrc(HSQUIRRELVM vm, const String & path, bool delay = false, bool info = false); ScriptSrc(const String & path, bool delay = false, bool info = false);
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Copy constructor. * Copy constructor.

View File

@ -686,7 +686,7 @@ bool Core::LoadScript(CSStr filepath, bool delay)
else if (m_Executed) else if (m_Executed)
{ {
// Create a new script container and insert it into the script pool // Create a new script container and insert it into the script pool
m_Scripts.emplace_back(m_VM, path, delay, m_Debugging); m_Scripts.emplace_back(path, delay, m_Debugging);
// Attempt to load and compile the script file // Attempt to load and compile the script file
try try
@ -728,7 +728,7 @@ bool Core::LoadScript(CSStr filepath, bool delay)
try try
{ {
// Create a new script container and insert it into the pending script pool // Create a new script container and insert it into the pending script pool
m_PendingScripts.emplace_back(m_VM, path, delay, m_Debugging); m_PendingScripts.emplace_back(path, delay, m_Debugging);
} }
catch (const Sqrat::Exception & e) catch (const Sqrat::Exception & e)
{ {