1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-07-06 08:57:11 +02:00

Implement the pure typename meta-methods in entity types using the standard method.

This commit is contained in:
Sandu Liviu Catalin
2016-11-15 21:16:24 +02:00
parent 351d44a8e5
commit 411ac5ef28
14 changed files with 40 additions and 110 deletions

View File

@ -7,20 +7,15 @@
// ------------------------------------------------------------------------------------------------
namespace SqMod {
// ------------------------------------------------------------------------------------------------
SQMODE_DECL_TYPENAME(Typename, _SC("SqPickup"))
// ------------------------------------------------------------------------------------------------
Vector3 CPickup::s_Vector3;
// ------------------------------------------------------------------------------------------------
const Int32 CPickup::Max = SQMOD_PICKUP_POOL;
// ------------------------------------------------------------------------------------------------
SQInteger CPickup::Typename(HSQUIRRELVM vm)
{
static const SQChar name[] = _SC("SqPickup");
sq_pushstring(vm, name, sizeof(name));
return 1;
}
// ------------------------------------------------------------------------------------------------
SQInteger CPickup::SqGetNull(HSQUIRRELVM vm)
{
@ -452,11 +447,11 @@ static Object & Pickup_Create(Int32 model, Int32 world, Int32 quantity, const Ve
// ================================================================================================
void Register_CPickup(HSQUIRRELVM vm)
{
RootTable(vm).Bind(_SC("SqPickup"),
Class< CPickup, NoConstructor< CPickup > >(vm, _SC("SqPickup"))
RootTable(vm).Bind(Typename::Str,
Class< CPickup, NoConstructor< CPickup > >(vm, Typename::Str)
// Meta-methods
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
.Func(_SC("_cmp"), &CPickup::Cmp)
.SquirrelFunc(_SC("_typename"), &CPickup::Typename)
.Func(_SC("_tostring"), &CPickup::ToString)
// Static Values
.SetStaticValue(_SC("MaxID"), CPickup::Max)