mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-01-19 12:07:13 +01:00
Make the custom environment optional in script callbacks from command system.
This commit is contained in:
parent
50b396bf05
commit
c854700cac
@ -621,7 +621,15 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetOnFail(Object & env, Function & func)
|
void SetOnFail(Object & env, Function & func)
|
||||||
{
|
{
|
||||||
m_OnFail = Function(env.GetVM(), env, func.GetFunc());
|
// Was there a custom environment specified?
|
||||||
|
if (env.IsNull())
|
||||||
|
{
|
||||||
|
m_OnFail = func;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_OnFail = Function(env.GetVM(), env.GetObject(), func.GetFunc());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
@ -637,7 +645,15 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetOnAuth(Object & env, Function & func)
|
void SetOnAuth(Object & env, Function & func)
|
||||||
{
|
{
|
||||||
m_OnAuth = Function(env.GetVM(), env, func.GetFunc());
|
// Was there a custom environment specified?
|
||||||
|
if (env.IsNull())
|
||||||
|
{
|
||||||
|
m_OnAuth = func;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_OnAuth = Function(env.GetVM(), env.GetObject(), func.GetFunc());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
@ -1619,9 +1635,16 @@ public:
|
|||||||
{
|
{
|
||||||
STHROWF("Detached commands cannot store script resources");
|
STHROWF("Detached commands cannot store script resources");
|
||||||
}
|
}
|
||||||
// Apply the specified information
|
// Was there a custom environment specified?
|
||||||
|
else if (env.IsNull())
|
||||||
|
{
|
||||||
|
m_OnExec = func;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_OnExec = Function(env.GetVM(), env.GetObject(), func.GetFunc());
|
m_OnExec = Function(env.GetVM(), env.GetObject(), func.GetFunc());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Retrieve the function that must be called when this command listener needs to authenticate.
|
* Retrieve the function that must be called when this command listener needs to authenticate.
|
||||||
@ -1641,9 +1664,16 @@ public:
|
|||||||
{
|
{
|
||||||
STHROWF("Detached commands cannot store script resources");
|
STHROWF("Detached commands cannot store script resources");
|
||||||
}
|
}
|
||||||
// Apply the specified information
|
// Was there a custom environment specified?
|
||||||
|
else if (env.IsNull())
|
||||||
|
{
|
||||||
|
m_OnAuth = func;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_OnAuth = Function(env.GetVM(), env.GetObject(), func.GetFunc());
|
m_OnAuth = Function(env.GetVM(), env.GetObject(), func.GetFunc());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Retrieve the function that must be called when this command listener finished execution.
|
* Retrieve the function that must be called when this command listener finished execution.
|
||||||
@ -1663,9 +1693,16 @@ public:
|
|||||||
{
|
{
|
||||||
STHROWF("Detached listeners cannot store script resources");
|
STHROWF("Detached listeners cannot store script resources");
|
||||||
}
|
}
|
||||||
// Apply the specified information
|
// Was there a custom environment specified?
|
||||||
|
else if (env.IsNull())
|
||||||
|
{
|
||||||
|
m_OnPost = func;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_OnPost = Function(env.GetVM(), env.GetObject(), func.GetFunc());
|
m_OnPost = Function(env.GetVM(), env.GetObject(), func.GetFunc());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Retrieve the function that must be called when this command listener failed execution.
|
* Retrieve the function that must be called when this command listener failed execution.
|
||||||
@ -1685,9 +1722,16 @@ public:
|
|||||||
{
|
{
|
||||||
STHROWF("Detached listeners cannot store script resources");
|
STHROWF("Detached listeners cannot store script resources");
|
||||||
}
|
}
|
||||||
// Apply the specified information
|
// Was there a custom environment specified?
|
||||||
|
else if (env.IsNull())
|
||||||
|
{
|
||||||
|
m_OnFail = func;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_OnFail = Function(env.GetVM(), env.GetObject(), func.GetFunc());
|
m_OnFail = Function(env.GetVM(), env.GetObject(), func.GetFunc());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Retrieve the tag of a certain argument.
|
* Retrieve the tag of a certain argument.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user