mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-20 17:17:13 +02:00
Code cleanup.
Get rid of ReleaseGently.
This commit is contained in:
@ -143,13 +143,13 @@ static inline Array Player_AllWhereNameEquals(bool neg, bool cs, CSStr name)
|
||||
// Remember the current stack size
|
||||
const StackGuard sg;
|
||||
// Allocate an empty array on the stack
|
||||
sq_newarray(DefaultVM::Get(), 0);
|
||||
sq_newarray(SqVM(), 0);
|
||||
// Process each entity in the pool
|
||||
EachEquals(InstSpec< CPlayer >::CBegin(), InstSpec< CPlayer >::CEnd(),
|
||||
ValidInstFunc< CPlayer >(), PlayerName(),
|
||||
AppendElemFunc< CPlayer >(), name, !neg, cs);
|
||||
// Return the array at the top of the stack
|
||||
return Var< Array >(DefaultVM::Get(), -1).value;
|
||||
return Var< Array >(SqVM(), -1).value;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@ -161,13 +161,13 @@ static inline Array Player_AllWhereNameBegins(bool neg, bool cs, CSStr name)
|
||||
// Remember the current stack size
|
||||
const StackGuard sg;
|
||||
// Allocate an empty array on the stack
|
||||
sq_newarray(DefaultVM::Get(), 0);
|
||||
sq_newarray(SqVM(), 0);
|
||||
// Process each entity in the pool
|
||||
EachBegins(InstSpec< CPlayer >::CBegin(), InstSpec< CPlayer >::CEnd(),
|
||||
ValidInstFunc< CPlayer >(), PlayerName(),
|
||||
AppendElemFunc< CPlayer >(), name, strlen(name), !neg, cs);
|
||||
// Return the array at the top of the stack
|
||||
return Var< Array >(DefaultVM::Get(), -1).value;
|
||||
return Var< Array >(SqVM(), -1).value;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@ -179,13 +179,13 @@ static inline Array Player_AllWhereNameEnds(bool neg, bool cs, CSStr name)
|
||||
// Remember the current stack size
|
||||
const StackGuard sg;
|
||||
// Allocate an empty array on the stack
|
||||
sq_newarray(DefaultVM::Get(), 0);
|
||||
sq_newarray(SqVM(), 0);
|
||||
// Process each entity in the pool
|
||||
EachEnds(InstSpec< CPlayer >::CBegin(), InstSpec< CPlayer >::CEnd(),
|
||||
ValidInstFunc< CPlayer >(), PlayerName(),
|
||||
AppendElemFunc< CPlayer >(), name, strlen(name), !neg, cs);
|
||||
// Return the array at the top of the stack
|
||||
return Var< Array >(DefaultVM::Get(), -1).value;
|
||||
return Var< Array >(SqVM(), -1).value;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@ -197,13 +197,13 @@ static inline Array Player_AllWhereNameContains(bool neg, bool cs, CSStr name)
|
||||
// Remember the current stack size
|
||||
const StackGuard sg;
|
||||
// Allocate an empty array on the stack
|
||||
sq_newarray(DefaultVM::Get(), 0);
|
||||
sq_newarray(SqVM(), 0);
|
||||
// Process each entity in the pool
|
||||
EachContains(InstSpec< CPlayer >::CBegin(), InstSpec< CPlayer >::CEnd(),
|
||||
ValidInstFunc< CPlayer >(), PlayerName(),
|
||||
AppendElemFunc< CPlayer >(), name, !neg, cs);
|
||||
// Return the array at the top of the stack
|
||||
return Var< Array >(DefaultVM::Get(), -1).value;
|
||||
return Var< Array >(SqVM(), -1).value;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@ -215,13 +215,13 @@ static inline Array Player_AllWhereNameMatches(bool neg, bool cs, CSStr name)
|
||||
// Remember the current stack size
|
||||
const StackGuard sg;
|
||||
// Allocate an empty array on the stack
|
||||
sq_newarray(DefaultVM::Get(), 0);
|
||||
sq_newarray(SqVM(), 0);
|
||||
// Process each entity in the pool
|
||||
EachMatches(InstSpec< CPlayer >::CBegin(), InstSpec< CPlayer >::CEnd(),
|
||||
ValidInstFunc< CPlayer >(), PlayerName(),
|
||||
AppendElemFunc< CPlayer >(), name, !neg, cs);
|
||||
// Return the array at the top of the stack
|
||||
return Var< Array >(DefaultVM::Get(), -1).value;
|
||||
return Var< Array >(SqVM(), -1).value;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
|
@ -895,7 +895,7 @@ template < typename T > struct AppendElemFunc
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Base constructor.
|
||||
*/
|
||||
explicit AppendElemFunc(SQInteger idx = -2, HSQUIRRELVM vm = DefaultVM::Get())
|
||||
explicit AppendElemFunc(SQInteger idx = -2, HSQUIRRELVM vm = SqVM())
|
||||
: mIdx(idx), mVM(vm)
|
||||
{
|
||||
/* ... */
|
||||
@ -971,7 +971,7 @@ public:
|
||||
*/
|
||||
bool operator () (const typename InstSpec< T >::Instance & inst)
|
||||
{
|
||||
HSQUIRRELVM vm = DefaultVM::Get();
|
||||
HSQUIRRELVM vm = SqVM();
|
||||
// Push the callback object
|
||||
sq_pushobject(vm, mFunc.mObj);
|
||||
// Push the callback environment object
|
||||
@ -1045,7 +1045,7 @@ public:
|
||||
*/
|
||||
bool operator () (const typename InstSpec< T >::Instance & inst)
|
||||
{
|
||||
HSQUIRRELVM vm = DefaultVM::Get();
|
||||
HSQUIRRELVM vm = SqVM();
|
||||
// Push the callback object
|
||||
sq_pushobject(vm, mFunc.mObj);
|
||||
// Push the callback environment object
|
||||
@ -1212,11 +1212,11 @@ public:
|
||||
{
|
||||
const StackGuard sg;
|
||||
// Allocate an empty array on the stack
|
||||
sq_newarray(DefaultVM::Get(), 0);
|
||||
sq_newarray(SqVM(), 0);
|
||||
// Process each entity in the pool
|
||||
Collect(Inst::CBegin(), Inst::CEnd(), ValidInst(), AppendElem());
|
||||
// Return the array at the top of the stack
|
||||
return Var< Array >(DefaultVM::Get(), -1).value;
|
||||
return Var< Array >(SqVM(), -1).value;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
@ -1228,11 +1228,11 @@ public:
|
||||
// Remember the current stack size
|
||||
const StackGuard sg;
|
||||
// Allocate an empty array on the stack
|
||||
sq_newarray(DefaultVM::Get(), 0);
|
||||
sq_newarray(SqVM(), 0);
|
||||
// Process each entity in the pool
|
||||
EachEquals(Inst::CBegin(), Inst::CEnd(), ValidInst(), InstTag(), AppendElem(), tag, !neg, cs);
|
||||
// Return the array at the top of the stack
|
||||
return Var< Array >(DefaultVM::Get(), -1).value;
|
||||
return Var< Array >(SqVM(), -1).value;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
@ -1244,11 +1244,11 @@ public:
|
||||
// Remember the current stack size
|
||||
const StackGuard sg;
|
||||
// Allocate an empty array on the stack
|
||||
sq_newarray(DefaultVM::Get(), 0);
|
||||
sq_newarray(SqVM(), 0);
|
||||
// Process each entity in the pool
|
||||
EachBegins(Inst::CBegin(), Inst::CEnd(), ValidInst(), InstTag(), AppendElem(), tag, strlen(tag), !neg, cs);
|
||||
// Return the array at the top of the stack
|
||||
return Var< Array >(DefaultVM::Get(), -1).value;
|
||||
return Var< Array >(SqVM(), -1).value;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
@ -1260,11 +1260,11 @@ public:
|
||||
// Remember the current stack size
|
||||
const StackGuard sg;
|
||||
// Allocate an empty array on the stack
|
||||
sq_newarray(DefaultVM::Get(), 0);
|
||||
sq_newarray(SqVM(), 0);
|
||||
// Process each entity in the pool
|
||||
EachEnds(Inst::CBegin(), Inst::CEnd(), ValidInst(), InstTag(), AppendElem(), tag, strlen(tag), !neg, cs);
|
||||
// Return the array at the top of the stack
|
||||
return Var< Array >(DefaultVM::Get(), -1).value;
|
||||
return Var< Array >(SqVM(), -1).value;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
@ -1276,11 +1276,11 @@ public:
|
||||
// Remember the current stack size
|
||||
const StackGuard sg;
|
||||
// Allocate an empty array on the stack
|
||||
sq_newarray(DefaultVM::Get(), 0);
|
||||
sq_newarray(SqVM(), 0);
|
||||
// Process each entity in the pool
|
||||
EachContains(Inst::CBegin(), Inst::CEnd(), ValidInst(), InstTag(), AppendElem(), tag, !neg, cs);
|
||||
// Return the array at the top of the stack
|
||||
return Var< Array >(DefaultVM::Get(), -1).value;
|
||||
return Var< Array >(SqVM(), -1).value;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
@ -1292,11 +1292,11 @@ public:
|
||||
// Remember the current stack size
|
||||
const StackGuard sg;
|
||||
// Allocate an empty array on the stack
|
||||
sq_newarray(DefaultVM::Get(), 0);
|
||||
sq_newarray(SqVM(), 0);
|
||||
// Process each entity in the pool
|
||||
EachMatches(Inst::CBegin(), Inst::CEnd(), ValidInst(), InstTag(), AppendElem(), tag, !neg, cs);
|
||||
// Return the array at the top of the stack
|
||||
return Var< Array >(DefaultVM::Get(), -1).value;
|
||||
return Var< Array >(SqVM(), -1).value;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
|
@ -81,7 +81,7 @@ bool Area::Manage()
|
||||
}
|
||||
// We expect this to be called only from the script so that the first parameter in the vm
|
||||
// is the area instance
|
||||
LightObj obj(1, DefaultVM::Get());
|
||||
LightObj obj(1, SqVM());
|
||||
// Attempt to manage this area
|
||||
AreaManager::Get().InsertArea(*this, obj);
|
||||
// Return whether the area is now managed by any cells
|
||||
|
@ -105,9 +105,9 @@ Object & Controller::Attach(Object && obj, Listener * ptr)
|
||||
// Obtain the initial stack size
|
||||
const StackGuard sg;
|
||||
// Push the instance on the stack
|
||||
ClassType< Listener >::PushInstance(DefaultVM::Get(), ptr);
|
||||
ClassType< Listener >::PushInstance(SqVM(), ptr);
|
||||
// Grab the instance from the stack
|
||||
obj = Var< Object >(DefaultVM::Get(), -1).value;
|
||||
obj = Var< Object >(SqVM(), -1).value;
|
||||
}
|
||||
// Are we supposed to grab the instance?
|
||||
else if (ptr == nullptr)
|
||||
@ -362,7 +362,7 @@ Int32 Controller::Exec(Context & ctx)
|
||||
if (ctx.mInstance->m_Associate)
|
||||
{
|
||||
// Create the associative container
|
||||
Table args(DefaultVM::Get());
|
||||
Table args(SqVM());
|
||||
// Copy the arguments into the table
|
||||
for (Uint32 arg = 0; arg < ctx.mArgc; ++arg)
|
||||
{
|
||||
@ -393,7 +393,7 @@ Int32 Controller::Exec(Context & ctx)
|
||||
else
|
||||
{
|
||||
// Reserve an array for the extracted arguments
|
||||
Array args(DefaultVM::Get(), ctx.mArgc);
|
||||
Array args(SqVM(), ctx.mArgc);
|
||||
// Copy the arguments into the array
|
||||
for (Uint32 arg = 0; arg < ctx.mArgc; ++arg)
|
||||
{
|
||||
@ -513,15 +513,15 @@ bool Controller::Parse(Context & ctx)
|
||||
if (itr != ctx.mArgument.end())
|
||||
{
|
||||
// Transform it into a script object
|
||||
sq_pushstring(DefaultVM::Get(), &(*itr), std::distance(itr, ctx.mArgument.cend()));
|
||||
sq_pushstring(SqVM(), &(*itr), std::distance(itr, ctx.mArgument.cend()));
|
||||
}
|
||||
// Just push an empty string
|
||||
else
|
||||
{
|
||||
sq_pushstring(DefaultVM::Get(), _SC(""), 0);
|
||||
sq_pushstring(SqVM(), _SC(""), 0);
|
||||
}
|
||||
// Get the object from the stack and add it to the argument list along with it's type
|
||||
ctx.mArgv.emplace_back(CMDARG_STRING, Var< Object >(DefaultVM::Get(), -1).value);
|
||||
ctx.mArgv.emplace_back(CMDARG_STRING, Var< Object >(SqVM(), -1).value);
|
||||
// Include this argument into the count
|
||||
++ctx.mArgc;
|
||||
// Nothing left to parse
|
||||
@ -615,16 +615,16 @@ bool Controller::Parse(Context & ctx)
|
||||
if (str >= end)
|
||||
{
|
||||
// Just push an empty string
|
||||
sq_pushstring(DefaultVM::Get(), _SC(""), 0);
|
||||
sq_pushstring(SqVM(), _SC(""), 0);
|
||||
}
|
||||
// Add it to the argument list along with it's type
|
||||
else
|
||||
{
|
||||
// Transform it into a script object
|
||||
sq_pushstring(DefaultVM::Get(), str, end - str - 1);
|
||||
sq_pushstring(SqVM(), str, end - str - 1);
|
||||
}
|
||||
// Get the object from the stack and add it to the argument list along with it's type
|
||||
ctx.mArgv.emplace_back(CMDARG_STRING, Var< Object >(DefaultVM::Get(), -1).value);
|
||||
ctx.mArgv.emplace_back(CMDARG_STRING, Var< Object >(SqVM(), -1).value);
|
||||
// Advance to the next argument and obtain its flags
|
||||
arg_flags = ctx.mInstance->m_ArgSpec[++ctx.mArgc];
|
||||
}
|
||||
@ -656,9 +656,9 @@ bool Controller::Parse(Context & ctx)
|
||||
// Remember the current stack size
|
||||
const StackGuard sg;
|
||||
// Transform it into a script object
|
||||
sq_pushinteger(DefaultVM::Get(), ConvTo< SQInteger >::From(value));
|
||||
sq_pushinteger(SqVM(), ConvTo< SQInteger >::From(value));
|
||||
// Get the object from the stack and add it to the argument list along with it's type
|
||||
ctx.mArgv.emplace_back(CMDARG_INTEGER, Var< Object >(DefaultVM::Get(), -1).value);
|
||||
ctx.mArgv.emplace_back(CMDARG_INTEGER, Var< Object >(SqVM(), -1).value);
|
||||
// We've identified the correct value type
|
||||
identified = true;
|
||||
}
|
||||
@ -680,9 +680,9 @@ bool Controller::Parse(Context & ctx)
|
||||
// Remember the current stack size
|
||||
const StackGuard sg;
|
||||
// Transform it into a script object
|
||||
sq_pushfloat(DefaultVM::Get(), ConvTo< SQFloat >::From(value));
|
||||
sq_pushfloat(SqVM(), ConvTo< SQFloat >::From(value));
|
||||
// Get the object from the stack and add it to the argument list along with it's type
|
||||
ctx.mArgv.emplace_back(CMDARG_FLOAT, Var< Object >(DefaultVM::Get(), -1).value);
|
||||
ctx.mArgv.emplace_back(CMDARG_FLOAT, Var< Object >(SqVM(), -1).value);
|
||||
// We've identified the correct value type
|
||||
identified = true;
|
||||
}
|
||||
@ -709,7 +709,7 @@ bool Controller::Parse(Context & ctx)
|
||||
if (std::strcmp(lc, "true") == 0 || std::strcmp(lc, "on") == 0)
|
||||
{
|
||||
// Transform it into a script object
|
||||
sq_pushbool(DefaultVM::Get(), static_cast< SQBool >(true));
|
||||
sq_pushbool(SqVM(), static_cast< SQBool >(true));
|
||||
// We've identified the correct value type
|
||||
identified = true;
|
||||
}
|
||||
@ -717,7 +717,7 @@ bool Controller::Parse(Context & ctx)
|
||||
else if (std::strcmp(lc, "false") == 0 || std::strcmp(lc, "off") == 0)
|
||||
{
|
||||
// Transform it into a script object
|
||||
sq_pushbool(DefaultVM::Get(), static_cast< SQBool >(false));
|
||||
sq_pushbool(SqVM(), static_cast< SQBool >(false));
|
||||
// We've identified the correct value type
|
||||
identified = true;
|
||||
}
|
||||
@ -725,7 +725,7 @@ bool Controller::Parse(Context & ctx)
|
||||
if (identified)
|
||||
{
|
||||
// Get the object from the stack and add it to the argument list along with it's type
|
||||
ctx.mArgv.emplace_back(CMDARG_BOOLEAN, Var< Object >(DefaultVM::Get(), -1).value);
|
||||
ctx.mArgv.emplace_back(CMDARG_BOOLEAN, Var< Object >(SqVM(), -1).value);
|
||||
}
|
||||
}
|
||||
// If everything else failed then simply treat the value as a string
|
||||
@ -742,7 +742,7 @@ bool Controller::Parse(Context & ctx)
|
||||
*chr = static_cast< CharT >(std::tolower(*str));
|
||||
}
|
||||
// Transform it into a script object
|
||||
sq_pushstring(DefaultVM::Get(), ctx.mBuffer.Get< SQChar >(), sz);
|
||||
sq_pushstring(SqVM(), ctx.mBuffer.Get< SQChar >(), sz);
|
||||
}
|
||||
// Do we have to make the string uppercase?
|
||||
else if (arg_flags & CMDARG_UPPER)
|
||||
@ -753,15 +753,15 @@ bool Controller::Parse(Context & ctx)
|
||||
*chr = static_cast< CharT >(std::toupper(*str));
|
||||
}
|
||||
// Transform it into a script object
|
||||
sq_pushstring(DefaultVM::Get(), ctx.mBuffer.Get< SQChar >(), sz);
|
||||
sq_pushstring(SqVM(), ctx.mBuffer.Get< SQChar >(), sz);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Transform it into a script object
|
||||
sq_pushstring(DefaultVM::Get(), str, sz);
|
||||
sq_pushstring(SqVM(), str, sz);
|
||||
}
|
||||
// Get the object from the stack and add it to the argument list along with it's type
|
||||
ctx.mArgv.emplace_back(CMDARG_STRING, Var< Object >(DefaultVM::Get(), -1).value);
|
||||
ctx.mArgv.emplace_back(CMDARG_STRING, Var< Object >(SqVM(), -1).value);
|
||||
}
|
||||
// Advance to the next argument and obtain its flags
|
||||
arg_flags = ctx.mInstance->m_ArgSpec[++ctx.mArgc];
|
||||
|
@ -516,8 +516,8 @@ public:
|
||||
// Clear the command listeners
|
||||
ctr->Clear();
|
||||
// Release the script callbacks, if any
|
||||
ctr->m_OnFail.ReleaseGently();
|
||||
ctr->m_OnAuth.ReleaseGently();
|
||||
ctr->m_OnFail.Release();
|
||||
ctr->m_OnAuth.Release();
|
||||
}
|
||||
}
|
||||
|
||||
@ -631,7 +631,7 @@ public:
|
||||
// Are we supposed to unbind current callback?
|
||||
if (func.IsNull())
|
||||
{
|
||||
m_OnFail.ReleaseGently();
|
||||
m_OnFail.Release();
|
||||
}
|
||||
// Was there a custom environment specified?
|
||||
else if (env.IsNull())
|
||||
@ -660,7 +660,7 @@ public:
|
||||
// Are we supposed to unbind current callback?
|
||||
if (func.IsNull())
|
||||
{
|
||||
m_OnAuth.ReleaseGently();
|
||||
m_OnAuth.Release();
|
||||
}
|
||||
// Was there a custom environment specified?
|
||||
if (env.IsNull())
|
||||
@ -743,7 +743,7 @@ public:
|
||||
Array GetCommandsArray() const
|
||||
{
|
||||
// Allocate an array with an adequate size
|
||||
Array arr(DefaultVM::Get(), m_Commands.size());
|
||||
Array arr(SqVM(), m_Commands.size());
|
||||
// Index of the currently processed command listener
|
||||
SQInteger index = 0;
|
||||
// Populate the array with the command listeners
|
||||
@ -761,7 +761,7 @@ public:
|
||||
Table GetCommandsTable() const
|
||||
{
|
||||
// Allocate an empty table
|
||||
Table tbl(DefaultVM::Get());
|
||||
Table tbl(SqVM());
|
||||
// Populate the table with the command listeners
|
||||
for (const auto & cmd : m_Commands)
|
||||
{
|
||||
@ -1296,10 +1296,10 @@ public:
|
||||
m_Controller.Lock()->Detach(this);
|
||||
}
|
||||
// Release callbacks
|
||||
m_OnExec.ReleaseGently();
|
||||
m_OnAuth.ReleaseGently();
|
||||
m_OnPost.ReleaseGently();
|
||||
m_OnFail.ReleaseGently();
|
||||
m_OnExec.Release();
|
||||
m_OnAuth.Release();
|
||||
m_OnPost.Release();
|
||||
m_OnFail.Release();
|
||||
// Is there an element behind us?
|
||||
if (m_Prev != nullptr)
|
||||
{
|
||||
@ -1420,9 +1420,9 @@ public:
|
||||
// Obtain the initial stack size
|
||||
const StackGuard sg;
|
||||
// Push the instance on the stack
|
||||
ClassType< Manager >::PushInstance(DefaultVM::Get(), m_Controller.Lock()->m_Manager);
|
||||
ClassType< Manager >::PushInstance(SqVM(), m_Controller.Lock()->m_Manager);
|
||||
// Grab the instance from the stack
|
||||
return Var< Object >(DefaultVM::Get(), -1).value;
|
||||
return Var< Object >(SqVM(), -1).value;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
@ -1515,7 +1515,7 @@ public:
|
||||
Array GetArgTags() const
|
||||
{
|
||||
// Allocate an array to encapsulate all tags
|
||||
Array arr(DefaultVM::Get(), SQMOD_MAX_CMD_ARGS);
|
||||
Array arr(SqVM(), SQMOD_MAX_CMD_ARGS);
|
||||
// Put the tags to the allocated array
|
||||
for (Uint32 arg = 0; arg < SQMOD_MAX_CMD_ARGS; ++arg)
|
||||
{
|
||||
@ -1752,7 +1752,7 @@ public:
|
||||
// Are we supposed to unbind current callback?
|
||||
if (func.IsNull())
|
||||
{
|
||||
m_OnExec.ReleaseGently();
|
||||
m_OnExec.Release();
|
||||
}
|
||||
// Was there a custom environment specified?
|
||||
else if (env.IsNull())
|
||||
@ -1781,7 +1781,7 @@ public:
|
||||
// Are we supposed to unbind current callback?
|
||||
if (func.IsNull())
|
||||
{
|
||||
m_OnAuth.ReleaseGently();
|
||||
m_OnAuth.Release();
|
||||
}
|
||||
// Was there a custom environment specified?
|
||||
else if (env.IsNull())
|
||||
@ -1810,7 +1810,7 @@ public:
|
||||
// Are we supposed to unbind current callback?
|
||||
if (func.IsNull())
|
||||
{
|
||||
m_OnPost.ReleaseGently();
|
||||
m_OnPost.Release();
|
||||
}
|
||||
// Was there a custom environment specified?
|
||||
else if (env.IsNull())
|
||||
@ -1839,7 +1839,7 @@ public:
|
||||
// Are we supposed to unbind current callback?
|
||||
if (func.IsNull())
|
||||
{
|
||||
m_OnFail.ReleaseGently();
|
||||
m_OnFail.Release();
|
||||
}
|
||||
// Was there a custom environment specified?
|
||||
else if (env.IsNull())
|
||||
|
@ -142,7 +142,7 @@ private:
|
||||
else if (!mSuspended)
|
||||
{
|
||||
// Grab the virtual machine once
|
||||
HSQUIRRELVM vm = DefaultVM::Get();
|
||||
HSQUIRRELVM vm = SqVM();
|
||||
// Push the function on the stack
|
||||
sq_pushobject(vm, mFunc);
|
||||
// Push the environment on the stack
|
||||
|
@ -1521,11 +1521,11 @@ LightObj Signal::CreateFree()
|
||||
// Create the signal instance
|
||||
DeleteGuard< Signal > dg(new Signal());
|
||||
// Attempt to create the signal instance
|
||||
ClassType< Signal >::PushInstance(DefaultVM::Get(), dg.Get());
|
||||
ClassType< Signal >::PushInstance(SqVM(), dg.Get());
|
||||
// This is now managed by the script
|
||||
dg.Release();
|
||||
// Return the created signal
|
||||
return Var< LightObj >(DefaultVM::Get(), -1).value;
|
||||
return Var< LightObj >(SqVM(), -1).value;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -1555,11 +1555,11 @@ LightObj Signal::Create(StackStrF & name)
|
||||
// Grab the signal instance pointer
|
||||
Signal * ptr = dg.Get();
|
||||
// Attempt to create the signal instance
|
||||
ClassType< Signal >::PushInstance(DefaultVM::Get(), ptr);
|
||||
ClassType< Signal >::PushInstance(SqVM(), ptr);
|
||||
// This is now managed by the script
|
||||
dg.Release();
|
||||
// Grab a reference to the instance created on the stack
|
||||
s_Signals.emplace_back(hash, SignalPair(ptr, Var< LightObj >(DefaultVM::Get(), -1).value));
|
||||
s_Signals.emplace_back(hash, SignalPair(ptr, Var< LightObj >(SqVM(), -1).value));
|
||||
// Return the created signal
|
||||
return s_Signals.back().second.second.mObj;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ protected:
|
||||
, mThisRef(env)
|
||||
, mFuncRef(func)
|
||||
{
|
||||
HSQUIRRELVM vm = DefaultVM::Get();
|
||||
HSQUIRRELVM vm = SqVM();
|
||||
// Remember the current stack size
|
||||
const StackGuard sg(vm);
|
||||
// Is there an explicit environment?
|
||||
@ -175,8 +175,8 @@ protected:
|
||||
// Track reference
|
||||
if (mFuncHash != 0)
|
||||
{
|
||||
sq_addref(DefaultVM::Get(), &mThisRef);
|
||||
sq_addref(DefaultVM::Get(), &mFuncRef);
|
||||
sq_addref(SqVM(), &mThisRef);
|
||||
sq_addref(SqVM(), &mFuncRef);
|
||||
}
|
||||
}
|
||||
|
||||
@ -217,8 +217,8 @@ protected:
|
||||
mThisRef = o.mThisRef;
|
||||
mFuncRef = o.mFuncRef;
|
||||
// Track reference
|
||||
sq_addref(DefaultVM::Get(), &const_cast< HSQOBJECT & >(o.mThisRef));
|
||||
sq_addref(DefaultVM::Get(), &const_cast< HSQOBJECT & >(o.mFuncRef));
|
||||
sq_addref(SqVM(), &const_cast< HSQOBJECT & >(o.mThisRef));
|
||||
sq_addref(SqVM(), &const_cast< HSQOBJECT & >(o.mFuncRef));
|
||||
}
|
||||
|
||||
return *this;
|
||||
@ -278,7 +278,7 @@ protected:
|
||||
// Should we release any environment object?
|
||||
if (mThisHash != 0)
|
||||
{
|
||||
sq_release(DefaultVM::Get(), &mThisRef);
|
||||
sq_release(SqVM(), &mThisRef);
|
||||
sq_resetobject(&mThisRef);
|
||||
// Also reset the hash
|
||||
mThisHash = 0;
|
||||
@ -286,7 +286,7 @@ protected:
|
||||
// Should we release any callback object?
|
||||
if (mFuncHash != 0)
|
||||
{
|
||||
sq_release(DefaultVM::Get(), &mFuncRef);
|
||||
sq_release(SqVM(), &mFuncRef);
|
||||
sq_resetobject(&mFuncRef);
|
||||
// Also reset the hash
|
||||
mFuncHash = 0;
|
||||
@ -681,7 +681,7 @@ protected:
|
||||
*/
|
||||
template < typename T > void PushParameters(T v)
|
||||
{
|
||||
Var< T >::push(DefaultVM::Get(), v);
|
||||
Var< T >::push(SqVM(), v);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
@ -689,7 +689,7 @@ protected:
|
||||
*/
|
||||
template < typename T, typename... Args > void PushParameters(T v, Args... args)
|
||||
{
|
||||
Var< T >::push(DefaultVM::Get(), v);
|
||||
Var< T >::push(SqVM(), v);
|
||||
PushParameters(args...);
|
||||
}
|
||||
|
||||
@ -732,7 +732,7 @@ public:
|
||||
// Activate the current scope and create a guard to restore it
|
||||
const AutoAssign< Scope * > aa(m_Scope, scope.mParent, &scope);
|
||||
// Grab the default virtual machine
|
||||
HSQUIRRELVM vm = DefaultVM::Get();
|
||||
HSQUIRRELVM vm = SqVM();
|
||||
// Process the slots from this scope
|
||||
while (scope.mItr != scope.mEnd)
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ void Tasks::Task::Init(HSQOBJECT & func, HSQOBJECT & inst, Interval intrv, Itera
|
||||
mEntity = ConvTo< Int16 >::From(id);
|
||||
mType = ConvTo< Uint8 >::From(type);
|
||||
// Grab the virtual machine once
|
||||
HSQUIRRELVM vm = DefaultVM::Get();
|
||||
HSQUIRRELVM vm = SqVM();
|
||||
// Remember the current stack size
|
||||
const StackGuard sg(vm);
|
||||
// Is there a valid function?
|
||||
@ -71,7 +71,7 @@ Tasks::Interval Tasks::Task::Execute()
|
||||
return 0; // Dunno how we got here but it ends now
|
||||
}
|
||||
// Grab the virtual machine once
|
||||
HSQUIRRELVM vm = DefaultVM::Get();
|
||||
HSQUIRRELVM vm = SqVM();
|
||||
// Push the function on the stack
|
||||
sq_pushobject(vm, mFunc);
|
||||
// Push the environment on the stack
|
||||
|
@ -179,7 +179,7 @@ private:
|
||||
STHROWF("Invalid callback type %s", SqTypeName(mFunc.GetType()));
|
||||
}
|
||||
// Grab the virtual machine once
|
||||
HSQUIRRELVM vm = DefaultVM::Get();
|
||||
HSQUIRRELVM vm = SqVM();
|
||||
// Remember the current stack size
|
||||
const StackGuard sg(vm);
|
||||
// Push the callback on the stack
|
||||
|
Reference in New Issue
Block a user