47 }; |
47 }; |
48 |
48 |
49 #ifdef DEFINE_SQUIRREL_CLASS |
49 #ifdef DEFINE_SQUIRREL_CLASS |
50 namespace SQConvert { |
50 namespace SQConvert { |
51 /* Allow AIBase to be used as Squirrel parameter */ |
51 /* Allow AIBase to be used as Squirrel parameter */ |
52 template <> AIBase *GetParam(ForceType<AIBase *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIBase *)instance; } |
52 template <> AIBase *GetParam(ForceType<AIBase *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIBase *)instance; } |
|
53 template <> AIBase &GetParam(ForceType<AIBase &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIBase *)instance; } |
|
54 template <> const AIBase *GetParam(ForceType<const AIBase *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIBase *)instance; } |
|
55 template <> const AIBase &GetParam(ForceType<const AIBase &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIBase *)instance; } |
53 }; // namespace SQConvert |
56 }; // namespace SQConvert |
54 |
57 |
55 void SQAIBaseRegister(Squirrel *engine) { |
58 void SQAIBaseRegister(Squirrel *engine) { |
56 DefSQClass <AIBase> SQAIBase("AIBase"); |
59 DefSQClass <AIBase> SQAIBase("AIBase"); |
57 SQAIBase.PreRegister(engine); |
60 SQAIBase.PreRegister(engine); |