1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-11-06 09:17:17 +01:00

Rename the lightweight object type.

Few adjustments to the tasks to overcome the limitation of removing themselves. Currently broken because they require a special Sqrat allocator.
This commit is contained in:
Sandu Liviu Catalin
2016-11-17 11:27:07 +02:00
parent 15c824ddae
commit 641e51e03c
5 changed files with 108 additions and 80 deletions

View File

@@ -20,7 +20,7 @@ public:
typedef Int64 Time;
typedef SQInteger Interval;
typedef Uint32 Iterator;
typedef LightObject Argument;
typedef LightObj Argument;
private:
@@ -31,8 +31,9 @@ private:
{
// ----------------------------------------------------------------------------------------
SQHash mHash; // The hash of the referenced function object.
HSQOBJECT mEnv; // A reference to the managed environment object.
HSQOBJECT mFunc; // A reference to the managed function object.
LightObj mSelf; // A reference to `this`as a script object.
LightObj mFunc; // A reference to the managed function object.
LightObj mInst; // A reference to the associated entity object.
Iterator mIterations; // Number of iterations before self destruct.
Interval mInterval; // Interval between task invocations.
Int16 mEntity; // The identifier of the entity to which is belongs.
@@ -45,8 +46,9 @@ private:
*/
Task()
: mHash(0)
, mEnv()
, mSelf()
, mFunc()
, mInst()
, mIterations(0)
, mInterval(0)
, mEntity(-1)
@@ -54,8 +56,7 @@ private:
, mArgc(0)
, mArgv()
{
sq_resetobject(&mEnv);
sq_resetobject(&mFunc);
/* ... */
}
/* ----------------------------------------------------------------------------------------
@@ -90,7 +91,7 @@ private:
/* ----------------------------------------------------------------------------------------
* Initializes the task parameters. (assumes previous values are already released)
*/
void Init(HSQOBJECT & env, HSQOBJECT & func, Interval intrv, Iterator itr, Int32 id, Int32 type);
void Init(HSQOBJECT & inst, HSQOBJECT & func, Interval intrv, Iterator itr, Int32 id, Int32 type);
/* ----------------------------------------------------------------------------------------
* Clear the arguments.
@@ -166,6 +167,11 @@ public:
*/
static void Initialize();
/* --------------------------------------------------------------------------------------------
* Register the task class.
*/
static void Register(HSQUIRRELVM vm);
/* --------------------------------------------------------------------------------------------
* Release all resources and prepare for shutdown.
*/