1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-06-19 16:47:14 +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

@ -9,6 +9,9 @@
// ------------------------------------------------------------------------------------------------
namespace SqMod {
// ------------------------------------------------------------------------------------------------
SQMODE_DECL_TYPENAME(Typename, _SC("SqVehicle"))
// ------------------------------------------------------------------------------------------------
Vector2 CVehicle::s_Vector2;
Vector3 CVehicle::s_Vector3;
@ -17,14 +20,6 @@ Quaternion CVehicle::s_Quaternion;
// ------------------------------------------------------------------------------------------------
const Int32 CVehicle::Max = SQMOD_VEHICLE_POOL;
// ------------------------------------------------------------------------------------------------
SQInteger CVehicle::Typename(HSQUIRRELVM vm)
{
static const SQChar name[] = _SC("SqVehicle");
sq_pushstring(vm, name, sizeof(name));
return 1;
}
// ------------------------------------------------------------------------------------------------
SQInteger CVehicle::SqGetNull(HSQUIRRELVM vm)
{
@ -1764,11 +1759,11 @@ static Object & Vehicle_Create(Int32 model, Int32 world, const Vector3 & pos, Fl
// ================================================================================================
void Register_CVehicle(HSQUIRRELVM vm)
{
RootTable(vm).Bind(_SC("SqVehicle"),
Class< CVehicle, NoConstructor< CVehicle > >(vm, _SC("SqVehicle"))
RootTable(vm).Bind(Typename::Str,
Class< CVehicle, NoConstructor< CVehicle > >(vm, Typename::Str)
// Meta-methods
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
.Func(_SC("_cmp"), &CVehicle::Cmp)
.SquirrelFunc(_SC("_typename"), &CVehicle::Typename)
.Func(_SC("_tostring"), &CVehicle::ToString)
// Static Values
.SetStaticValue(_SC("MaxID"), CVehicle::Max)