diff options
author | glx <glx@openttd.org> | 2009-01-25 19:06:00 +0000 |
---|---|---|
committer | glx <glx@openttd.org> | 2009-01-25 19:06:00 +0000 |
commit | 53fe1afa1f176d89e5a770ebc5e370d0b66c66a3 (patch) | |
tree | e92b8bce8a6e198fc26860c8b75a4188cb2cd7c4 | |
parent | 1310ddf5b5ce97f5091b53abbd093ff9fa834fba (diff) | |
download | openttd-53fe1afa1f176d89e5a770ebc5e370d0b66c66a3.tar.xz |
(svn r15270) -Change [API CHANGE]: remove AIEventTest
-rw-r--r-- | src/ai/ai_instance.cpp | 1 | ||||
-rw-r--r-- | src/ai/api/ai_event_types.hpp | 33 | ||||
-rw-r--r-- | src/ai/api/ai_event_types.hpp.sq | 21 |
3 files changed, 0 insertions, 55 deletions
diff --git a/src/ai/ai_instance.cpp b/src/ai/ai_instance.cpp index 8d57e6da8..1d719b503 100644 --- a/src/ai/ai_instance.cpp +++ b/src/ai/ai_instance.cpp @@ -191,7 +191,6 @@ void AIInstance::RegisterAPI() SQAIEventSubsidyExpired_Register(this->engine); SQAIEventSubsidyOffer_Register(this->engine); SQAIEventSubsidyOfferExpired_Register(this->engine); - SQAIEventTest_Register(this->engine); SQAIEventVehicleCrashed_Register(this->engine); SQAIEventVehicleLost_Register(this->engine); SQAIEventVehicleUnprofitable_Register(this->engine); diff --git a/src/ai/api/ai_event_types.hpp b/src/ai/api/ai_event_types.hpp index 6fbf5be3f..75bef42a1 100644 --- a/src/ai/api/ai_event_types.hpp +++ b/src/ai/api/ai_event_types.hpp @@ -13,39 +13,6 @@ #include "ai_subsidy.hpp" /** - * Event Test: a simple test event, to see if the event system is working. - * Triggered via AIEventController::Test(); - */ -class AIEventTest : public AIEvent { -public: - static const char *GetClassName() { return "AIEventTest"; } - - /** - * @param test A test value. - */ - AIEventTest(uint test) : - AIEvent(AI_ET_TEST), - test(test) - {} - - /** - * Convert an AIEvent to the real instance. - * @param instance The instance to convert. - * @return The converted instance. - */ - static AIEventTest *Convert(AIEvent *instance) { return (AIEventTest *)instance; } - - /** - * Return the test value. - * @return The test value. - */ - uint GetTest() { return this->test; } - -private: - uint test; -}; - -/** * Event Vehicle Crash, indicating a vehicle of yours is crashed. * It contains both the crash site as the vehicle crashed. It has a nice * helper that creates a new vehicle in a depot with the same type diff --git a/src/ai/api/ai_event_types.hpp.sq b/src/ai/api/ai_event_types.hpp.sq index 84d8b722b..9c4537f8b 100644 --- a/src/ai/api/ai_event_types.hpp.sq +++ b/src/ai/api/ai_event_types.hpp.sq @@ -4,27 +4,6 @@ #include "ai_event_types.hpp" namespace SQConvert { - /* Allow AIEventTest to be used as Squirrel parameter */ - template <> AIEventTest *GetParam(ForceType<AIEventTest *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIEventTest *)instance; } - template <> AIEventTest &GetParam(ForceType<AIEventTest &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventTest *)instance; } - template <> const AIEventTest *GetParam(ForceType<const AIEventTest *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIEventTest *)instance; } - template <> const AIEventTest &GetParam(ForceType<const AIEventTest &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { 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 SQAIEventTest_Register(Squirrel *engine) { - DefSQClass <AIEventTest> SQAIEventTest("AIEventTest"); - SQAIEventTest.PreRegister(engine, "AIEvent"); - - 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 AIEventVehicleCrashed to be used as Squirrel parameter */ template <> AIEventVehicleCrashed *GetParam(ForceType<AIEventVehicleCrashed *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIEventVehicleCrashed *)instance; } template <> AIEventVehicleCrashed &GetParam(ForceType<AIEventVehicleCrashed &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventVehicleCrashed *)instance; } |