(svn r10631) [NoAI] -Add: AIEvent, to take care of events; for now it only reports when vehicles are crashed
#include "ai_event_types.hpp"
namespace SQConvert {
/* Allow AIEventTest to be used as Squirrel parameter */
template <> AIEventTest *GetParam(ForceType<AIEventTest *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIEventTest *)instance; }
template <> AIEventTest &GetParam(ForceType<AIEventTest &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventTest *)instance; }
template <> const AIEventTest *GetParam(ForceType<const AIEventTest *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIEventTest *)instance; }
template <> const AIEventTest &GetParam(ForceType<const AIEventTest &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventTest *)instance; }
template <> int Return<AIEventTest *>(HSQUIRRELVM vm, AIEventTest *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventTest", res, NULL, DefSQDestructorCallback<AIEventTest>); return 1; }
}; // namespace SQConvert
void SQAIEventTestRegister(Squirrel *engine) {
DefSQClass <AIEventTest> SQAIEventTest("AIEventTest");
SQAIEventTest.PreRegister(engine, "AIEvent");
SQAIEventTest.AddConstructor<void (AIEventTest::*)(uint test), 2>(engine, "xi");
SQAIEventTest.DefSQStaticMethod(engine, &AIEventTest::GetClassName, "GetClassName", 1, "x");
SQAIEventTest.DefSQStaticMethod(engine, &AIEventTest::Convert, "Convert", 2, "xx");
SQAIEventTest.DefSQMethod(engine, &AIEventTest::GetTest, "GetTest", 1, "x");
SQAIEventTest.PostRegister(engine);
}
namespace SQConvert {
/* Allow AIEventVehicleCrash to be used as Squirrel parameter */
template <> AIEventVehicleCrash *GetParam(ForceType<AIEventVehicleCrash *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIEventVehicleCrash *)instance; }
template <> AIEventVehicleCrash &GetParam(ForceType<AIEventVehicleCrash &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventVehicleCrash *)instance; }
template <> const AIEventVehicleCrash *GetParam(ForceType<const AIEventVehicleCrash *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIEventVehicleCrash *)instance; }
template <> const AIEventVehicleCrash &GetParam(ForceType<const AIEventVehicleCrash &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventVehicleCrash *)instance; }
template <> int Return<AIEventVehicleCrash *>(HSQUIRRELVM vm, AIEventVehicleCrash *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventVehicleCrash", res, NULL, DefSQDestructorCallback<AIEventVehicleCrash>); return 1; }
}; // namespace SQConvert
void SQAIEventVehicleCrashRegister(Squirrel *engine) {
DefSQClass <AIEventVehicleCrash> SQAIEventVehicleCrash("AIEventVehicleCrash");
SQAIEventVehicleCrash.PreRegister(engine, "AIEvent");
SQAIEventVehicleCrash.AddConstructor<void (AIEventVehicleCrash::*)(VehicleID vehicle, TileIndex crash_site), 3>(engine, "xii");
SQAIEventVehicleCrash.DefSQStaticMethod(engine, &AIEventVehicleCrash::GetClassName, "GetClassName", 1, "x");
SQAIEventVehicleCrash.DefSQStaticMethod(engine, &AIEventVehicleCrash::Convert, "Convert", 2, "xx");
SQAIEventVehicleCrash.DefSQMethod(engine, &AIEventVehicleCrash::GetVehicleID, "GetVehicleID", 1, "x");
SQAIEventVehicleCrash.DefSQMethod(engine, &AIEventVehicleCrash::GetCrashSite, "GetCrashSite", 1, "x");
SQAIEventVehicleCrash.DefSQMethod(engine, &AIEventVehicleCrash::CloneCrashedVehicle, "CloneCrashedVehicle", 2, "xi");
SQAIEventVehicleCrash.PostRegister(engine);
}