1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-10-15 07:27:19 +02:00

Add the possibility to have null entity instances intentionally.

This commit is contained in:
Sandu Liviu Catalin
2016-08-07 01:54:33 +03:00
parent 5c26ba62df
commit 29b0f8d4c9
16 changed files with 233 additions and 1 deletions

View File

@@ -16,6 +16,19 @@ SQInteger CBlip::Typename(HSQUIRRELVM vm)
return 1;
}
// ------------------------------------------------------------------------------------------------
SQInteger CBlip::SqGetNull(HSQUIRRELVM vm)
{
sq_pushobject(vm, Core::Get().GetNullBlip().GetObject());
return 1;
}
// ------------------------------------------------------------------------------------------------
Object & CBlip::GetNull()
{
return Core::Get().GetNullBlip();
}
// ------------------------------------------------------------------------------------------------
CBlip::CBlip(Int32 id)
: m_ID(VALID_ENTITYGETEX(id, SQMOD_BLIP_POOL))
@@ -350,6 +363,8 @@ void Register_CBlip(HSQUIRRELVM vm)
(_SC("Create"), &Blip_Create)
.StaticOverload< Object & (*)(Int32, Int32, const Vector3 &, Int32, const Color4 &, Int32, Int32, Object &) >
(_SC("Create"), &Blip_Create)
// Raw Squirrel Methods
.SquirrelFunc(_SC("NullInst"), &CBlip::SqGetNull)
);
}

View File

@@ -95,6 +95,16 @@ public:
*/
static SQInteger Typename(HSQUIRRELVM vm);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated null entity instance.
*/
static SQInteger SqGetNull(HSQUIRRELVM vm);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated null entity instance.
*/
static Object & GetNull();
/* --------------------------------------------------------------------------------------------
* Retrieve the identifier of the entity managed by this instance.
*/

View File

@@ -29,6 +29,19 @@ SQInteger CCheckpoint::Typename(HSQUIRRELVM vm)
return 1;
}
// ------------------------------------------------------------------------------------------------
SQInteger CCheckpoint::SqGetNull(HSQUIRRELVM vm)
{
sq_pushobject(vm, Core::Get().GetNullCheckpoint().GetObject());
return 1;
}
// ------------------------------------------------------------------------------------------------
Object & CCheckpoint::GetNull()
{
return Core::Get().GetNullCheckpoint();
}
// ------------------------------------------------------------------------------------------------
CCheckpoint::CCheckpoint(Int32 id)
: m_ID(VALID_ENTITYGETEX(id, SQMOD_CHECKPOINT_POOL))
@@ -546,6 +559,8 @@ void Register_CCheckpoint(HSQUIRRELVM vm)
(_SC("Create"), &Checkpoint_Create)
.StaticOverload< Object & (*)(Int32, bool, const Vector3 &, const Color4 &, Float32, Int32, Object &) >
(_SC("Create"), &Checkpoint_Create)
// Raw Squirrel Methods
.SquirrelFunc(_SC("NullInst"), &CCheckpoint::SqGetNull)
);
}

View File

@@ -102,6 +102,16 @@ public:
*/
static SQInteger Typename(HSQUIRRELVM vm);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated null entity instance.
*/
static SQInteger SqGetNull(HSQUIRRELVM vm);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated null entity instance.
*/
static Object & GetNull();
/* --------------------------------------------------------------------------------------------
* Retrieve the identifier of the entity managed by this instance.
*/

View File

@@ -16,6 +16,19 @@ SQInteger CKeybind::Typename(HSQUIRRELVM vm)
return 1;
}
// ------------------------------------------------------------------------------------------------
SQInteger CKeybind::SqGetNull(HSQUIRRELVM vm)
{
sq_pushobject(vm, Core::Get().GetNullKeybind().GetObject());
return 1;
}
// ------------------------------------------------------------------------------------------------
Object & CKeybind::GetNull()
{
return Core::Get().GetNullKeybind();
}
// ------------------------------------------------------------------------------------------------
CKeybind::CKeybind(Int32 id)
: m_ID(VALID_ENTITYGETEX(id, SQMOD_KEYBIND_POOL))
@@ -233,6 +246,8 @@ void Register_CKeybind(HSQUIRRELVM vm)
(_SC("Create"), &Keybind_Create)
.StaticOverload< Object & (*)(bool, Int32, Int32, Int32, Int32, Object &) >
(_SC("Create"), &Keybind_Create)
// Raw Squirrel Methods
.SquirrelFunc(_SC("NullInst"), &CKeybind::SqGetNull)
);
}

View File

@@ -95,6 +95,16 @@ public:
*/
static SQInteger Typename(HSQUIRRELVM vm);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated null entity instance.
*/
static SQInteger SqGetNull(HSQUIRRELVM vm);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated null entity instance.
*/
static Object & GetNull();
/* --------------------------------------------------------------------------------------------
* Retrieve the identifier of the entity managed by this instance.
*/

View File

@@ -23,6 +23,19 @@ SQInteger CObject::Typename(HSQUIRRELVM vm)
return 1;
}
// ------------------------------------------------------------------------------------------------
SQInteger CObject::SqGetNull(HSQUIRRELVM vm)
{
sq_pushobject(vm, Core::Get().GetNullObject().GetObject());
return 1;
}
// ------------------------------------------------------------------------------------------------
Object & CObject::GetNull()
{
return Core::Get().GetNullObject();
}
// ------------------------------------------------------------------------------------------------
CObject::CObject(Int32 id)
: m_ID(VALID_ENTITYGETEX(id, SQMOD_OBJECT_POOL))
@@ -927,6 +940,8 @@ void Register_CObject(HSQUIRRELVM vm)
(_SC("Create"), &Object_Create)
.StaticOverload< Object & (*)(Int32, Int32, const Vector3 &, Int32, Int32, Object &) >
(_SC("Create"), &Object_Create)
// Raw Squirrel Methods
.SquirrelFunc(_SC("NullInst"), &CObject::SqGetNull)
);
}

View File

@@ -117,6 +117,16 @@ public:
*/
static SQInteger Typename(HSQUIRRELVM vm);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated null entity instance.
*/
static SQInteger SqGetNull(HSQUIRRELVM vm);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated null entity instance.
*/
static Object & GetNull();
/* --------------------------------------------------------------------------------------------
* Retrieve the identifier of the entity managed by this instance.
*/

View File

@@ -21,6 +21,19 @@ SQInteger CPickup::Typename(HSQUIRRELVM vm)
return 1;
}
// ------------------------------------------------------------------------------------------------
SQInteger CPickup::SqGetNull(HSQUIRRELVM vm)
{
sq_pushobject(vm, Core::Get().GetNullPickup().GetObject());
return 1;
}
// ------------------------------------------------------------------------------------------------
Object & CPickup::GetNull()
{
return Core::Get().GetNullPickup();
}
// ------------------------------------------------------------------------------------------------
CPickup::CPickup(Int32 id)
: m_ID(VALID_ENTITYGETEX(id, SQMOD_PICKUP_POOL))
@@ -427,6 +440,8 @@ void Register_CPickup(HSQUIRRELVM vm)
(_SC("Create"), &Pickup_Create)
.StaticOverload< Object & (*)(Int32, Int32, Int32, const Vector3 &, Int32, bool, Int32, Object &) >
(_SC("Create"), &Pickup_Create)
// Raw Squirrel Methods
.SquirrelFunc(_SC("NullInst"), &CPickup::SqGetNull)
);
}

View File

@@ -98,6 +98,16 @@ public:
*/
static SQInteger Typename(HSQUIRRELVM vm);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated null entity instance.
*/
static SQInteger SqGetNull(HSQUIRRELVM vm);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated null entity instance.
*/
static Object & GetNull();
/* --------------------------------------------------------------------------------------------
* Retrieve the identifier of the entity managed by this instance.
*/

View File

@@ -37,6 +37,19 @@ SQInteger CPlayer::Typename(HSQUIRRELVM vm)
return 1;
}
// ------------------------------------------------------------------------------------------------
SQInteger CPlayer::SqGetNull(HSQUIRRELVM vm)
{
sq_pushobject(vm, Core::Get().GetNullPlayer().GetObject());
return 1;
}
// ------------------------------------------------------------------------------------------------
Object & CPlayer::GetNull()
{
return Core::Get().GetNullPlayer();
}
// ------------------------------------------------------------------------------------------------
CPlayer::CPlayer(Int32 id)
: m_ID(VALID_ENTITYGETEX(id, SQMOD_PLAYER_POOL))
@@ -2357,6 +2370,7 @@ void Register_CPlayer(HSQUIRRELVM vm)
.SquirrelFunc(_SC("AnnounceEx"), &CPlayer::AnnounceEx)
.SquirrelFunc(_SC("Text"), &CPlayer::Announce)
.SquirrelFunc(_SC("TextEx"), &CPlayer::AnnounceEx)
.SquirrelFunc(_SC("NullInst"), &CPlayer::SqGetNull)
);
}

View File

@@ -174,6 +174,16 @@ public:
*/
static SQInteger Typename(HSQUIRRELVM vm);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated null entity instance.
*/
static SQInteger SqGetNull(HSQUIRRELVM vm);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated null entity instance.
*/
static Object & GetNull();
/* --------------------------------------------------------------------------------------------
* Retrieve the identifier of the entity managed by this instance.
*/

View File

@@ -25,6 +25,19 @@ SQInteger CVehicle::Typename(HSQUIRRELVM vm)
return 1;
}
// ------------------------------------------------------------------------------------------------
SQInteger CVehicle::SqGetNull(HSQUIRRELVM vm)
{
sq_pushobject(vm, Core::Get().GetNullVehicle().GetObject());
return 1;
}
// ------------------------------------------------------------------------------------------------
Object & CVehicle::GetNull()
{
return Core::Get().GetNullVehicle();
}
// ------------------------------------------------------------------------------------------------
CVehicle::CVehicle(Int32 id)
: m_ID(VALID_ENTITYGETEX(id, SQMOD_VEHICLE_POOL))
@@ -1811,7 +1824,8 @@ void Register_CVehicle(HSQUIRRELVM vm)
(_SC("Create"), &Vehicle_Create)
.StaticOverload< Object & (*)(Int32, Int32, const Vector3 &, Float32, Int32, Int32, Int32, Object &) >
(_SC("Create"), &Vehicle_Create)
// Raw Squirrel Methods
.SquirrelFunc(_SC("NullInst"), &CVehicle::SqGetNull)
);
}

View File

@@ -113,6 +113,16 @@ public:
*/
static SQInteger Typename(HSQUIRRELVM vm);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated null entity instance.
*/
static SQInteger SqGetNull(HSQUIRRELVM vm);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated null entity instance.
*/
static Object & GetNull();
/* --------------------------------------------------------------------------------------------
* Retrieve the identifier of the entity managed by this instance.
*/