truelight@9652: #include "ai_pathfinder.hpp" truelight@9652: truelight@9652: namespace SQConvert { truelight@9652: /* Allow enums to be used as Squirrel parameters */ truelight@9652: template <> AIPathFinder::PathFinderType GetParam(ForceType, HSQUIRRELVM vm, int index) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIPathFinder::PathFinderType)tmp; } truelight@9652: template <> int Return(HSQUIRRELVM vm, AIPathFinder::PathFinderType res) { sq_pushinteger(vm, (int32)res); return 1; } truelight@9652: truelight@9652: /* Allow AIPathFinder to be used as Squirrel parameter */ truelight@9652: template <> AIPathFinder *GetParam(ForceType, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIPathFinder *)instance; } truelight@9652: template <> AIPathFinder &GetParam(ForceType, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIPathFinder *)instance; } truelight@9652: template <> const AIPathFinder *GetParam(ForceType, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIPathFinder *)instance; } truelight@9652: template <> const AIPathFinder &GetParam(ForceType, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIPathFinder *)instance; } truelight@9680: template <> int Return(HSQUIRRELVM vm, AIPathFinder *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIPathFinder", res, NULL, DefSQDestructorCallback); return 1; } truelight@9652: }; // namespace SQConvert truelight@9652: truebrain@9741: void SQAIPathFinder_Register(Squirrel *engine) { truelight@9652: DefSQClass SQAIPathFinder("AIPathFinder"); truelight@9652: SQAIPathFinder.PreRegister(engine); truelight@9652: truelight@9652: SQAIPathFinder.DefSQConst(engine, AIPathFinder::PATHFINDER_ROAD, "PATHFINDER_ROAD"); truelight@9652: SQAIPathFinder.DefSQConst(engine, AIPathFinder::PATHFINDER_RAIL, "PATHFINDER_RAIL"); truelight@9652: truelight@9652: SQAIPathFinder.DefSQStaticMethod(engine, &AIPathFinder::GetClassName, "GetClassName", 1, "x"); truelight@9652: truelight@9652: SQAIPathFinder.PostRegister(engine); truelight@9652: }