diff options
author | rubidium <rubidium@openttd.org> | 2011-11-13 20:52:39 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2011-11-13 20:52:39 +0000 |
commit | 3f7eb71b17da7840678c68953729aff156cc500b (patch) | |
tree | 5d71bc9aae9a9bc39ae15c1794f85d7e14987628 /src/ai/api | |
parent | b7a655bf4cafc68e14cade593e8b1aca7f04f7dd (diff) | |
download | openttd-3f7eb71b17da7840678c68953729aff156cc500b.tar.xz |
(svn r23210) -Codechange: generate the GetClassName function for the AI classes programmatically
Diffstat (limited to 'src/ai/api')
99 files changed, 175 insertions, 254 deletions
diff --git a/src/ai/api/ai_accounting.hpp b/src/ai/api/ai_accounting.hpp index 976513269..a68571805 100644 --- a/src/ai/api/ai_accounting.hpp +++ b/src/ai/api/ai_accounting.hpp @@ -29,9 +29,6 @@ */ class AIAccounting : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIAccounting"; } - /** * Creating instance of this class starts counting the costs of commands * from zero. Saves the current value of GetCosts so we can return to diff --git a/src/ai/api/ai_accounting.hpp.sq b/src/ai/api/ai_accounting.hpp.sq index 37d65b5d7..1b71acf07 100644 --- a/src/ai/api/ai_accounting.hpp.sq +++ b/src/ai/api/ai_accounting.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AIAccounting *>(HSQUIRRELVM vm, AIAccounting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIAccounting", res, NULL, DefSQDestructorCallback<AIAccounting>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIAccounting>() { return "AIAccounting"; } + void SQAIAccounting_Register(Squirrel *engine) { DefSQClass <AIAccounting> SQAIAccounting("AIAccounting"); diff --git a/src/ai/api/ai_airport.hpp b/src/ai/api/ai_airport.hpp index a889b3289..28b870bba 100644 --- a/src/ai/api/ai_airport.hpp +++ b/src/ai/api/ai_airport.hpp @@ -19,9 +19,6 @@ */ class AIAirport : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIAirport"; } - /** * The types of airports available in the game. */ diff --git a/src/ai/api/ai_airport.hpp.sq b/src/ai/api/ai_airport.hpp.sq index c4fa0f9ed..e70dea465 100644 --- a/src/ai/api/ai_airport.hpp.sq +++ b/src/ai/api/ai_airport.hpp.sq @@ -26,6 +26,8 @@ namespace SQConvert { template <> int Return<AIAirport *>(HSQUIRRELVM vm, AIAirport *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIAirport", res, NULL, DefSQDestructorCallback<AIAirport>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIAirport>() { return "AIAirport"; } + void SQAIAirport_Register(Squirrel *engine) { DefSQClass <AIAirport> SQAIAirport("AIAirport"); diff --git a/src/ai/api/ai_base.hpp b/src/ai/api/ai_base.hpp index 40d7ed94b..a98f2b844 100644 --- a/src/ai/api/ai_base.hpp +++ b/src/ai/api/ai_base.hpp @@ -25,9 +25,6 @@ */ class AIBase : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIBase"; } - /** * Get a random value. * @return A random value between 0 and MAX(uint32). diff --git a/src/ai/api/ai_base.hpp.sq b/src/ai/api/ai_base.hpp.sq index 059e752da..474b257dc 100644 --- a/src/ai/api/ai_base.hpp.sq +++ b/src/ai/api/ai_base.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AIBase *>(HSQUIRRELVM vm, AIBase *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIBase", res, NULL, DefSQDestructorCallback<AIBase>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIBase>() { return "AIBase"; } + void SQAIBase_Register(Squirrel *engine) { DefSQClass <AIBase> SQAIBase("AIBase"); diff --git a/src/ai/api/ai_basestation.hpp b/src/ai/api/ai_basestation.hpp index 94d698354..d17acf474 100644 --- a/src/ai/api/ai_basestation.hpp +++ b/src/ai/api/ai_basestation.hpp @@ -19,9 +19,6 @@ */ class AIBaseStation : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIBaseStation"; } - /** * Special station IDs for building adjacent/new stations when * the adjacent/distant join features are enabled. diff --git a/src/ai/api/ai_basestation.hpp.sq b/src/ai/api/ai_basestation.hpp.sq index cf1e5e33f..33e184337 100644 --- a/src/ai/api/ai_basestation.hpp.sq +++ b/src/ai/api/ai_basestation.hpp.sq @@ -24,6 +24,8 @@ namespace SQConvert { template <> int Return<AIBaseStation *>(HSQUIRRELVM vm, AIBaseStation *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIBaseStation", res, NULL, DefSQDestructorCallback<AIBaseStation>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIBaseStation>() { return "AIBaseStation"; } + void SQAIBaseStation_Register(Squirrel *engine) { DefSQClass <AIBaseStation> SQAIBaseStation("AIBaseStation"); diff --git a/src/ai/api/ai_bridge.hpp b/src/ai/api/ai_bridge.hpp index 92204d123..e3d4eaa10 100644 --- a/src/ai/api/ai_bridge.hpp +++ b/src/ai/api/ai_bridge.hpp @@ -39,9 +39,6 @@ public: ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT, // [STR_ERROR_BRIDGEHEADS_NOT_SAME_HEIGHT] }; - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIBridge"; } - /** * Checks whether the given bridge type is valid. * @param bridge_id The bridge to check. diff --git a/src/ai/api/ai_bridge.hpp.sq b/src/ai/api/ai_bridge.hpp.sq index 2dee58c75..fbb664b67 100644 --- a/src/ai/api/ai_bridge.hpp.sq +++ b/src/ai/api/ai_bridge.hpp.sq @@ -24,6 +24,8 @@ namespace SQConvert { template <> int Return<AIBridge *>(HSQUIRRELVM vm, AIBridge *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIBridge", res, NULL, DefSQDestructorCallback<AIBridge>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIBridge>() { return "AIBridge"; } + void SQAIBridge_Register(Squirrel *engine) { DefSQClass <AIBridge> SQAIBridge("AIBridge"); diff --git a/src/ai/api/ai_bridgelist.hpp b/src/ai/api/ai_bridgelist.hpp index 7dd41b221..cae2f82c0 100644 --- a/src/ai/api/ai_bridgelist.hpp +++ b/src/ai/api/ai_bridgelist.hpp @@ -20,8 +20,6 @@ */ class AIBridgeList : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIBridgeList"; } AIBridgeList(); }; @@ -31,9 +29,6 @@ public: */ class AIBridgeList_Length : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIBridgeList_Length"; } - /** * @param length The length of the bridge you want to build. */ diff --git a/src/ai/api/ai_bridgelist.hpp.sq b/src/ai/api/ai_bridgelist.hpp.sq index 82cd49049..47ad5f77e 100644 --- a/src/ai/api/ai_bridgelist.hpp.sq +++ b/src/ai/api/ai_bridgelist.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AIBridgeList *>(HSQUIRRELVM vm, AIBridgeList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIBridgeList", res, NULL, DefSQDestructorCallback<AIBridgeList>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIBridgeList>() { return "AIBridgeList"; } + void SQAIBridgeList_Register(Squirrel *engine) { DefSQClass <AIBridgeList> SQAIBridgeList("AIBridgeList"); @@ -38,6 +40,8 @@ namespace SQConvert { template <> int Return<AIBridgeList_Length *>(HSQUIRRELVM vm, AIBridgeList_Length *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIBridgeList_Length", res, NULL, DefSQDestructorCallback<AIBridgeList_Length>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIBridgeList_Length>() { return "AIBridgeList_Length"; } + void SQAIBridgeList_Length_Register(Squirrel *engine) { DefSQClass <AIBridgeList_Length> SQAIBridgeList_Length("AIBridgeList_Length"); diff --git a/src/ai/api/ai_cargo.hpp b/src/ai/api/ai_cargo.hpp index 4cc3a1a1c..ed658c0a4 100644 --- a/src/ai/api/ai_cargo.hpp +++ b/src/ai/api/ai_cargo.hpp @@ -19,9 +19,6 @@ */ class AICargo : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AICargo"; } - /** * The classes of cargo (from newgrf_cargo.h). */ diff --git a/src/ai/api/ai_cargo.hpp.sq b/src/ai/api/ai_cargo.hpp.sq index 19154dc3f..6426cfb39 100644 --- a/src/ai/api/ai_cargo.hpp.sq +++ b/src/ai/api/ai_cargo.hpp.sq @@ -28,6 +28,8 @@ namespace SQConvert { template <> int Return<AICargo *>(HSQUIRRELVM vm, AICargo *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AICargo", res, NULL, DefSQDestructorCallback<AICargo>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AICargo>() { return "AICargo"; } + void SQAICargo_Register(Squirrel *engine) { DefSQClass <AICargo> SQAICargo("AICargo"); diff --git a/src/ai/api/ai_cargolist.hpp b/src/ai/api/ai_cargolist.hpp index 0efd72ae2..01d2ec605 100644 --- a/src/ai/api/ai_cargolist.hpp +++ b/src/ai/api/ai_cargolist.hpp @@ -20,8 +20,6 @@ */ class AICargoList : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AICargoList"; } AICargoList(); }; @@ -33,9 +31,6 @@ public: */ class AICargoList_IndustryAccepting : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AICargoList_IndustryAccepting"; } - /** * @param industry_id The industry to get the list of cargos it accepts from. */ @@ -48,9 +43,6 @@ public: */ class AICargoList_IndustryProducing : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AICargoList_IndustryProducing"; } - /** * @param industry_id The industry to get the list of cargos it produces from. */ @@ -63,9 +55,6 @@ public: */ class AICargoList_StationAccepting : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AICargoList_StationAccepting"; } - /** * @param station_id The station to get the list of cargos it accepts from. */ diff --git a/src/ai/api/ai_cargolist.hpp.sq b/src/ai/api/ai_cargolist.hpp.sq index 2ba0154a4..28b0cabfe 100644 --- a/src/ai/api/ai_cargolist.hpp.sq +++ b/src/ai/api/ai_cargolist.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AICargoList *>(HSQUIRRELVM vm, AICargoList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AICargoList", res, NULL, DefSQDestructorCallback<AICargoList>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AICargoList>() { return "AICargoList"; } + void SQAICargoList_Register(Squirrel *engine) { DefSQClass <AICargoList> SQAICargoList("AICargoList"); @@ -38,6 +40,8 @@ namespace SQConvert { template <> int Return<AICargoList_IndustryAccepting *>(HSQUIRRELVM vm, AICargoList_IndustryAccepting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AICargoList_IndustryAccepting", res, NULL, DefSQDestructorCallback<AICargoList_IndustryAccepting>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AICargoList_IndustryAccepting>() { return "AICargoList_IndustryAccepting"; } + void SQAICargoList_IndustryAccepting_Register(Squirrel *engine) { DefSQClass <AICargoList_IndustryAccepting> SQAICargoList_IndustryAccepting("AICargoList_IndustryAccepting"); @@ -56,6 +60,8 @@ namespace SQConvert { template <> int Return<AICargoList_IndustryProducing *>(HSQUIRRELVM vm, AICargoList_IndustryProducing *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AICargoList_IndustryProducing", res, NULL, DefSQDestructorCallback<AICargoList_IndustryProducing>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AICargoList_IndustryProducing>() { return "AICargoList_IndustryProducing"; } + void SQAICargoList_IndustryProducing_Register(Squirrel *engine) { DefSQClass <AICargoList_IndustryProducing> SQAICargoList_IndustryProducing("AICargoList_IndustryProducing"); @@ -74,6 +80,8 @@ namespace SQConvert { template <> int Return<AICargoList_StationAccepting *>(HSQUIRRELVM vm, AICargoList_StationAccepting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AICargoList_StationAccepting", res, NULL, DefSQDestructorCallback<AICargoList_StationAccepting>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AICargoList_StationAccepting>() { return "AICargoList_StationAccepting"; } + void SQAICargoList_StationAccepting_Register(Squirrel *engine) { DefSQClass <AICargoList_StationAccepting> SQAICargoList_StationAccepting("AICargoList_StationAccepting"); diff --git a/src/ai/api/ai_company.hpp b/src/ai/api/ai_company.hpp index f7e329531..4980f0ebc 100644 --- a/src/ai/api/ai_company.hpp +++ b/src/ai/api/ai_company.hpp @@ -19,9 +19,6 @@ */ class AICompany : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AICompany"; } - /** The range of possible quarters to get company information of. */ enum Quarter { CURRENT_QUARTER = 0, ///< The current quarter. diff --git a/src/ai/api/ai_company.hpp.sq b/src/ai/api/ai_company.hpp.sq index f2dae40b7..078f578e2 100644 --- a/src/ai/api/ai_company.hpp.sq +++ b/src/ai/api/ai_company.hpp.sq @@ -28,6 +28,8 @@ namespace SQConvert { template <> int Return<AICompany *>(HSQUIRRELVM vm, AICompany *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AICompany", res, NULL, DefSQDestructorCallback<AICompany>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AICompany>() { return "AICompany"; } + void SQAICompany_Register(Squirrel *engine) { DefSQClass <AICompany> SQAICompany("AICompany"); diff --git a/src/ai/api/ai_controller.hpp b/src/ai/api/ai_controller.hpp index ce74d39c9..0df721109 100644 --- a/src/ai/api/ai_controller.hpp +++ b/src/ai/api/ai_controller.hpp @@ -24,9 +24,6 @@ class AIController { friend class AIInstance; public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIController"; } - /** * Initializer of the AIController. */ diff --git a/src/ai/api/ai_controller.hpp.sq b/src/ai/api/ai_controller.hpp.sq index fdfb47788..8a0e70ccd 100644 --- a/src/ai/api/ai_controller.hpp.sq +++ b/src/ai/api/ai_controller.hpp.sq @@ -9,6 +9,8 @@ #include "ai_controller.hpp" +template <> const char *GetClassName<AIController>() { return "AIController"; } + void SQAIController_Register(Squirrel *engine) { DefSQClass <AIController> SQAIController("AIController"); diff --git a/src/ai/api/ai_date.hpp b/src/ai/api/ai_date.hpp index 3bb22f993..3927845b3 100644 --- a/src/ai/api/ai_date.hpp +++ b/src/ai/api/ai_date.hpp @@ -26,9 +26,6 @@ */ class AIDate : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIDate"; } - /** * Get the current date. * This is the number of days since epoch under the assumption that diff --git a/src/ai/api/ai_date.hpp.sq b/src/ai/api/ai_date.hpp.sq index 76e9775b0..6a5a01222 100644 --- a/src/ai/api/ai_date.hpp.sq +++ b/src/ai/api/ai_date.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AIDate *>(HSQUIRRELVM vm, AIDate *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIDate", res, NULL, DefSQDestructorCallback<AIDate>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIDate>() { return "AIDate"; } + void SQAIDate_Register(Squirrel *engine) { DefSQClass <AIDate> SQAIDate("AIDate"); diff --git a/src/ai/api/ai_depotlist.hpp b/src/ai/api/ai_depotlist.hpp index db180a35c..a84e698ea 100644 --- a/src/ai/api/ai_depotlist.hpp +++ b/src/ai/api/ai_depotlist.hpp @@ -21,9 +21,6 @@ */ class AIDepotList : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIDepotList"; } - /** * @param transport_type The type of transport to make a list of depots for. */ diff --git a/src/ai/api/ai_depotlist.hpp.sq b/src/ai/api/ai_depotlist.hpp.sq index 0ea52b077..440aa106a 100644 --- a/src/ai/api/ai_depotlist.hpp.sq +++ b/src/ai/api/ai_depotlist.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AIDepotList *>(HSQUIRRELVM vm, AIDepotList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIDepotList", res, NULL, DefSQDestructorCallback<AIDepotList>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIDepotList>() { return "AIDepotList"; } + void SQAIDepotList_Register(Squirrel *engine) { DefSQClass <AIDepotList> SQAIDepotList("AIDepotList"); diff --git a/src/ai/api/ai_engine.hpp b/src/ai/api/ai_engine.hpp index 337b80485..f44268668 100644 --- a/src/ai/api/ai_engine.hpp +++ b/src/ai/api/ai_engine.hpp @@ -21,9 +21,6 @@ */ class AIEngine : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEngine"; } - /** * Checks whether the given engine type is valid. An engine is valid if you * have at least one vehicle of this engine or it's currently buildable. diff --git a/src/ai/api/ai_engine.hpp.sq b/src/ai/api/ai_engine.hpp.sq index 58a9744aa..205e10309 100644 --- a/src/ai/api/ai_engine.hpp.sq +++ b/src/ai/api/ai_engine.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AIEngine *>(HSQUIRRELVM vm, AIEngine *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEngine", res, NULL, DefSQDestructorCallback<AIEngine>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEngine>() { return "AIEngine"; } + void SQAIEngine_Register(Squirrel *engine) { DefSQClass <AIEngine> SQAIEngine("AIEngine"); diff --git a/src/ai/api/ai_enginelist.hpp b/src/ai/api/ai_enginelist.hpp index ff9a72729..d5e67ddd8 100644 --- a/src/ai/api/ai_enginelist.hpp +++ b/src/ai/api/ai_enginelist.hpp @@ -21,9 +21,6 @@ */ class AIEngineList : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEngineList"; } - /** * @param vehicle_type The type of vehicle to make a list of engines for. */ diff --git a/src/ai/api/ai_enginelist.hpp.sq b/src/ai/api/ai_enginelist.hpp.sq index f91a590fd..053c02f90 100644 --- a/src/ai/api/ai_enginelist.hpp.sq +++ b/src/ai/api/ai_enginelist.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AIEngineList *>(HSQUIRRELVM vm, AIEngineList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEngineList", res, NULL, DefSQDestructorCallback<AIEngineList>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEngineList>() { return "AIEngineList"; } + void SQAIEngineList_Register(Squirrel *engine) { DefSQClass <AIEngineList> SQAIEngineList("AIEngineList"); diff --git a/src/ai/api/ai_error.hpp b/src/ai/api/ai_error.hpp index 44e4573d4..77f0a5ea4 100644 --- a/src/ai/api/ai_error.hpp +++ b/src/ai/api/ai_error.hpp @@ -43,9 +43,6 @@ */ class AIError : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIError"; } - /** * All categories errors can be divided in. */ diff --git a/src/ai/api/ai_error.hpp.sq b/src/ai/api/ai_error.hpp.sq index 5101d77f3..bd6275988 100644 --- a/src/ai/api/ai_error.hpp.sq +++ b/src/ai/api/ai_error.hpp.sq @@ -26,6 +26,8 @@ namespace SQConvert { template <> int Return<AIError *>(HSQUIRRELVM vm, AIError *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIError", res, NULL, DefSQDestructorCallback<AIError>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIError>() { return "AIError"; } + void SQAIError_Register(Squirrel *engine) { DefSQClass <AIError> SQAIError("AIError"); diff --git a/src/ai/api/ai_event.hpp b/src/ai/api/ai_event.hpp index 4b3b2cf94..cbd5134f8 100644 --- a/src/ai/api/ai_event.hpp +++ b/src/ai/api/ai_event.hpp @@ -21,9 +21,6 @@ */ class AIEvent : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEvent"; } - /** * The type of event. Needed to lookup the detailed class. */ @@ -81,12 +78,6 @@ protected: class AIEventController : public AIObject { public: /** - * The name of the class, needed by several sub-processes. - */ - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventController"; } - - /** * Check if there is an event waiting. * @return true if there is an event on the stack. */ diff --git a/src/ai/api/ai_event.hpp.sq b/src/ai/api/ai_event.hpp.sq index b97de98ed..d1147c58c 100644 --- a/src/ai/api/ai_event.hpp.sq +++ b/src/ai/api/ai_event.hpp.sq @@ -24,6 +24,8 @@ namespace SQConvert { template <> int Return<AIEvent *>(HSQUIRRELVM vm, AIEvent *res) { if (res == NULL) { sq_pushnull(vm); return 1; } Squirrel::CreateClassInstanceVM(vm, "AIEvent", res, NULL, DefSQDestructorCallback<AIEvent>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEvent>() { return "AIEvent"; } + void SQAIEvent_Register(Squirrel *engine) { DefSQClass <AIEvent> SQAIEvent("AIEvent"); @@ -68,6 +70,8 @@ namespace SQConvert { template <> int Return<AIEventController *>(HSQUIRRELVM vm, AIEventController *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventController", res, NULL, DefSQDestructorCallback<AIEventController>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventController>() { return "AIEventController"; } + void SQAIEventController_Register(Squirrel *engine) { DefSQClass <AIEventController> SQAIEventController("AIEventController"); diff --git a/src/ai/api/ai_event_types.hpp b/src/ai/api/ai_event_types.hpp index 0bebb53b7..92d7e3cfe 100644 --- a/src/ai/api/ai_event_types.hpp +++ b/src/ai/api/ai_event_types.hpp @@ -21,9 +21,6 @@ */ class AIEventVehicleCrashed : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventVehicleCrashed"; } - /** * The reasons for vehicle crashes */ @@ -84,9 +81,6 @@ private: */ class AIEventSubsidyOffer : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventSubsidyOffer"; } - /** * @param subsidy_id The index of this subsidy in the _subsidies array. */ @@ -117,9 +111,6 @@ private: */ class AIEventSubsidyOfferExpired : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventSubsidyOfferExpired"; } - /** * @param subsidy_id The index of this subsidy in the _subsidies array. */ @@ -150,9 +141,6 @@ private: */ class AIEventSubsidyAwarded : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventSubsidyAwarded"; } - /** * @param subsidy_id The index of this subsidy in the _subsidies array. */ @@ -183,9 +171,6 @@ private: */ class AIEventSubsidyExpired : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventSubsidyExpired"; } - /** * @param subsidy_id The index of this subsidy in the _subsidies array. */ @@ -218,9 +203,6 @@ private: */ class AIEventEnginePreview : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventEnginePreview"; } - /** * @param engine The engine offered to test. */ @@ -309,9 +291,6 @@ private: */ class AIEventCompanyNew : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventCompanyNew"; } - /** * @param owner The new company. */ @@ -343,9 +322,6 @@ private: */ class AIEventCompanyInTrouble : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventCompanyInTrouble"; } - /** * @param owner The company that is in trouble. */ @@ -376,9 +352,6 @@ private: */ class AIEventCompanyAskMerger : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventCompanyAskMerger"; } - /** * @param owner The company that can be bough. * @param value The value/costs of buying the company. @@ -426,9 +399,6 @@ private: */ class AIEventCompanyMerger : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventCompanyMerger"; } - /** * @param old_owner The company bought off. * @param new_owner The company that bougth owner. @@ -471,9 +441,6 @@ private: */ class AIEventCompanyBankrupt : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventCompanyBankrupt"; } - /** * @param owner The company that has gone bankrupt. */ @@ -504,9 +471,6 @@ private: */ class AIEventVehicleLost : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventVehicleLost"; } - /** * @param vehicle_id The vehicle that is lost. */ @@ -537,9 +501,6 @@ private: */ class AIEventVehicleWaitingInDepot : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventVehicleWaitingInDepot"; } - /** * @param vehicle_id The vehicle that is waiting in a depot. */ @@ -570,9 +531,6 @@ private: */ class AIEventVehicleUnprofitable : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventVehicleUnprofitable"; } - /** * @param vehicle_id The vehicle that was unprofitable. */ @@ -603,9 +561,6 @@ private: */ class AIEventIndustryOpen : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventIndustryOpen"; } - /** * @param industry_id The new industry. */ @@ -636,9 +591,6 @@ private: */ class AIEventIndustryClose : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventIndustryClose"; } - /** * @param industry_id The new industry. */ @@ -669,9 +621,6 @@ private: */ class AIEventEngineAvailable : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventEngineAvailable"; } - /** * @param engine The engine that is available. */ @@ -702,9 +651,6 @@ private: */ class AIEventStationFirstVehicle : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventStationFirstVehicle"; } - /** * @param station The station visited for the first time. * @param vehicle The vehicle visiting the station. @@ -744,9 +690,6 @@ private: */ class AIEventDisasterZeppelinerCrashed : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventDisasterZeppelinerCrashed"; } - /** * @param station The station containing the affected airport */ @@ -777,9 +720,6 @@ private: */ class AIEventDisasterZeppelinerCleared : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventDisasterZeppelinerCleared"; } - /** * @param station The station containing the affected airport */ @@ -810,9 +750,6 @@ private: */ class AIEventTownFounded : public AIEvent { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIEventTownFounded"; } - /** * @param town The town that was created. */ diff --git a/src/ai/api/ai_event_types.hpp.sq b/src/ai/api/ai_event_types.hpp.sq index 771a0778e..a6ae6f6c8 100644 --- a/src/ai/api/ai_event_types.hpp.sq +++ b/src/ai/api/ai_event_types.hpp.sq @@ -24,6 +24,8 @@ namespace SQConvert { template <> int Return<AIEventVehicleCrashed *>(HSQUIRRELVM vm, AIEventVehicleCrashed *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventVehicleCrashed", res, NULL, DefSQDestructorCallback<AIEventVehicleCrashed>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventVehicleCrashed>() { return "AIEventVehicleCrashed"; } + void SQAIEventVehicleCrashed_Register(Squirrel *engine) { DefSQClass <AIEventVehicleCrashed> SQAIEventVehicleCrashed("AIEventVehicleCrashed"); @@ -54,6 +56,8 @@ namespace SQConvert { template <> int Return<AIEventSubsidyOffer *>(HSQUIRRELVM vm, AIEventSubsidyOffer *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventSubsidyOffer", res, NULL, DefSQDestructorCallback<AIEventSubsidyOffer>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventSubsidyOffer>() { return "AIEventSubsidyOffer"; } + void SQAIEventSubsidyOffer_Register(Squirrel *engine) { DefSQClass <AIEventSubsidyOffer> SQAIEventSubsidyOffer("AIEventSubsidyOffer"); @@ -75,6 +79,8 @@ namespace SQConvert { template <> int Return<AIEventSubsidyOfferExpired *>(HSQUIRRELVM vm, AIEventSubsidyOfferExpired *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventSubsidyOfferExpired", res, NULL, DefSQDestructorCallback<AIEventSubsidyOfferExpired>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventSubsidyOfferExpired>() { return "AIEventSubsidyOfferExpired"; } + void SQAIEventSubsidyOfferExpired_Register(Squirrel *engine) { DefSQClass <AIEventSubsidyOfferExpired> SQAIEventSubsidyOfferExpired("AIEventSubsidyOfferExpired"); @@ -96,6 +102,8 @@ namespace SQConvert { template <> int Return<AIEventSubsidyAwarded *>(HSQUIRRELVM vm, AIEventSubsidyAwarded *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventSubsidyAwarded", res, NULL, DefSQDestructorCallback<AIEventSubsidyAwarded>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventSubsidyAwarded>() { return "AIEventSubsidyAwarded"; } + void SQAIEventSubsidyAwarded_Register(Squirrel *engine) { DefSQClass <AIEventSubsidyAwarded> SQAIEventSubsidyAwarded("AIEventSubsidyAwarded"); @@ -117,6 +125,8 @@ namespace SQConvert { template <> int Return<AIEventSubsidyExpired *>(HSQUIRRELVM vm, AIEventSubsidyExpired *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventSubsidyExpired", res, NULL, DefSQDestructorCallback<AIEventSubsidyExpired>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventSubsidyExpired>() { return "AIEventSubsidyExpired"; } + void SQAIEventSubsidyExpired_Register(Squirrel *engine) { DefSQClass <AIEventSubsidyExpired> SQAIEventSubsidyExpired("AIEventSubsidyExpired"); @@ -138,6 +148,8 @@ namespace SQConvert { template <> int Return<AIEventEnginePreview *>(HSQUIRRELVM vm, AIEventEnginePreview *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventEnginePreview", res, NULL, DefSQDestructorCallback<AIEventEnginePreview>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventEnginePreview>() { return "AIEventEnginePreview"; } + void SQAIEventEnginePreview_Register(Squirrel *engine) { DefSQClass <AIEventEnginePreview> SQAIEventEnginePreview("AIEventEnginePreview"); @@ -166,6 +178,8 @@ namespace SQConvert { template <> int Return<AIEventCompanyNew *>(HSQUIRRELVM vm, AIEventCompanyNew *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventCompanyNew", res, NULL, DefSQDestructorCallback<AIEventCompanyNew>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventCompanyNew>() { return "AIEventCompanyNew"; } + void SQAIEventCompanyNew_Register(Squirrel *engine) { DefSQClass <AIEventCompanyNew> SQAIEventCompanyNew("AIEventCompanyNew"); @@ -187,6 +201,8 @@ namespace SQConvert { template <> int Return<AIEventCompanyInTrouble *>(HSQUIRRELVM vm, AIEventCompanyInTrouble *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventCompanyInTrouble", res, NULL, DefSQDestructorCallback<AIEventCompanyInTrouble>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventCompanyInTrouble>() { return "AIEventCompanyInTrouble"; } + void SQAIEventCompanyInTrouble_Register(Squirrel *engine) { DefSQClass <AIEventCompanyInTrouble> SQAIEventCompanyInTrouble("AIEventCompanyInTrouble"); @@ -208,6 +224,8 @@ namespace SQConvert { template <> int Return<AIEventCompanyAskMerger *>(HSQUIRRELVM vm, AIEventCompanyAskMerger *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventCompanyAskMerger", res, NULL, DefSQDestructorCallback<AIEventCompanyAskMerger>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventCompanyAskMerger>() { return "AIEventCompanyAskMerger"; } + void SQAIEventCompanyAskMerger_Register(Squirrel *engine) { DefSQClass <AIEventCompanyAskMerger> SQAIEventCompanyAskMerger("AIEventCompanyAskMerger"); @@ -231,6 +249,8 @@ namespace SQConvert { template <> int Return<AIEventCompanyMerger *>(HSQUIRRELVM vm, AIEventCompanyMerger *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventCompanyMerger", res, NULL, DefSQDestructorCallback<AIEventCompanyMerger>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventCompanyMerger>() { return "AIEventCompanyMerger"; } + void SQAIEventCompanyMerger_Register(Squirrel *engine) { DefSQClass <AIEventCompanyMerger> SQAIEventCompanyMerger("AIEventCompanyMerger"); @@ -253,6 +273,8 @@ namespace SQConvert { template <> int Return<AIEventCompanyBankrupt *>(HSQUIRRELVM vm, AIEventCompanyBankrupt *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventCompanyBankrupt", res, NULL, DefSQDestructorCallback<AIEventCompanyBankrupt>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventCompanyBankrupt>() { return "AIEventCompanyBankrupt"; } + void SQAIEventCompanyBankrupt_Register(Squirrel *engine) { DefSQClass <AIEventCompanyBankrupt> SQAIEventCompanyBankrupt("AIEventCompanyBankrupt"); @@ -274,6 +296,8 @@ namespace SQConvert { template <> int Return<AIEventVehicleLost *>(HSQUIRRELVM vm, AIEventVehicleLost *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventVehicleLost", res, NULL, DefSQDestructorCallback<AIEventVehicleLost>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventVehicleLost>() { return "AIEventVehicleLost"; } + void SQAIEventVehicleLost_Register(Squirrel *engine) { DefSQClass <AIEventVehicleLost> SQAIEventVehicleLost("AIEventVehicleLost"); @@ -295,6 +319,8 @@ namespace SQConvert { template <> int Return<AIEventVehicleWaitingInDepot *>(HSQUIRRELVM vm, AIEventVehicleWaitingInDepot *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventVehicleWaitingInDepot", res, NULL, DefSQDestructorCallback<AIEventVehicleWaitingInDepot>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventVehicleWaitingInDepot>() { return "AIEventVehicleWaitingInDepot"; } + void SQAIEventVehicleWaitingInDepot_Register(Squirrel *engine) { DefSQClass <AIEventVehicleWaitingInDepot> SQAIEventVehicleWaitingInDepot("AIEventVehicleWaitingInDepot"); @@ -316,6 +342,8 @@ namespace SQConvert { template <> int Return<AIEventVehicleUnprofitable *>(HSQUIRRELVM vm, AIEventVehicleUnprofitable *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventVehicleUnprofitable", res, NULL, DefSQDestructorCallback<AIEventVehicleUnprofitable>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventVehicleUnprofitable>() { return "AIEventVehicleUnprofitable"; } + void SQAIEventVehicleUnprofitable_Register(Squirrel *engine) { DefSQClass <AIEventVehicleUnprofitable> SQAIEventVehicleUnprofitable("AIEventVehicleUnprofitable"); @@ -337,6 +365,8 @@ namespace SQConvert { template <> int Return<AIEventIndustryOpen *>(HSQUIRRELVM vm, AIEventIndustryOpen *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventIndustryOpen", res, NULL, DefSQDestructorCallback<AIEventIndustryOpen>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventIndustryOpen>() { return "AIEventIndustryOpen"; } + void SQAIEventIndustryOpen_Register(Squirrel *engine) { DefSQClass <AIEventIndustryOpen> SQAIEventIndustryOpen("AIEventIndustryOpen"); @@ -358,6 +388,8 @@ namespace SQConvert { template <> int Return<AIEventIndustryClose *>(HSQUIRRELVM vm, AIEventIndustryClose *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventIndustryClose", res, NULL, DefSQDestructorCallback<AIEventIndustryClose>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventIndustryClose>() { return "AIEventIndustryClose"; } + void SQAIEventIndustryClose_Register(Squirrel *engine) { DefSQClass <AIEventIndustryClose> SQAIEventIndustryClose("AIEventIndustryClose"); @@ -379,6 +411,8 @@ namespace SQConvert { template <> int Return<AIEventEngineAvailable *>(HSQUIRRELVM vm, AIEventEngineAvailable *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventEngineAvailable", res, NULL, DefSQDestructorCallback<AIEventEngineAvailable>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventEngineAvailable>() { return "AIEventEngineAvailable"; } + void SQAIEventEngineAvailable_Register(Squirrel *engine) { DefSQClass <AIEventEngineAvailable> SQAIEventEngineAvailable("AIEventEngineAvailable"); @@ -400,6 +434,8 @@ namespace SQConvert { template <> int Return<AIEventStationFirstVehicle *>(HSQUIRRELVM vm, AIEventStationFirstVehicle *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventStationFirstVehicle", res, NULL, DefSQDestructorCallback<AIEventStationFirstVehicle>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventStationFirstVehicle>() { return "AIEventStationFirstVehicle"; } + void SQAIEventStationFirstVehicle_Register(Squirrel *engine) { DefSQClass <AIEventStationFirstVehicle> SQAIEventStationFirstVehicle("AIEventStationFirstVehicle"); @@ -422,6 +458,8 @@ namespace SQConvert { template <> int Return<AIEventDisasterZeppelinerCrashed *>(HSQUIRRELVM vm, AIEventDisasterZeppelinerCrashed *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventDisasterZeppelinerCrashed", res, NULL, DefSQDestructorCallback<AIEventDisasterZeppelinerCrashed>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventDisasterZeppelinerCrashed>() { return "AIEventDisasterZeppelinerCrashed"; } + void SQAIEventDisasterZeppelinerCrashed_Register(Squirrel *engine) { DefSQClass <AIEventDisasterZeppelinerCrashed> SQAIEventDisasterZeppelinerCrashed("AIEventDisasterZeppelinerCrashed"); @@ -443,6 +481,8 @@ namespace SQConvert { template <> int Return<AIEventDisasterZeppelinerCleared *>(HSQUIRRELVM vm, AIEventDisasterZeppelinerCleared *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventDisasterZeppelinerCleared", res, NULL, DefSQDestructorCallback<AIEventDisasterZeppelinerCleared>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventDisasterZeppelinerCleared>() { return "AIEventDisasterZeppelinerCleared"; } + void SQAIEventDisasterZeppelinerCleared_Register(Squirrel *engine) { DefSQClass <AIEventDisasterZeppelinerCleared> SQAIEventDisasterZeppelinerCleared("AIEventDisasterZeppelinerCleared"); @@ -464,6 +504,8 @@ namespace SQConvert { template <> int Return<AIEventTownFounded *>(HSQUIRRELVM vm, AIEventTownFounded *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventTownFounded", res, NULL, DefSQDestructorCallback<AIEventTownFounded>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIEventTownFounded>() { return "AIEventTownFounded"; } + void SQAIEventTownFounded_Register(Squirrel *engine) { DefSQClass <AIEventTownFounded> SQAIEventTownFounded("AIEventTownFounded"); diff --git a/src/ai/api/ai_execmode.hpp b/src/ai/api/ai_execmode.hpp index 569cc6526..43765f177 100644 --- a/src/ai/api/ai_execmode.hpp +++ b/src/ai/api/ai_execmode.hpp @@ -22,10 +22,6 @@ * In Execute mode all commands you do are executed for real. */ class AIExecMode : public AIObject { -public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIExecMode"; } - private: AIModeProc *last_mode; ///< The previous mode we were in. AIObject *last_instance; ///< The previous instace of the mode. diff --git a/src/ai/api/ai_execmode.hpp.sq b/src/ai/api/ai_execmode.hpp.sq index 1d9d7fbee..a00d0eec6 100644 --- a/src/ai/api/ai_execmode.hpp.sq +++ b/src/ai/api/ai_execmode.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AIExecMode *>(HSQUIRRELVM vm, AIExecMode *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIExecMode", res, NULL, DefSQDestructorCallback<AIExecMode>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIExecMode>() { return "AIExecMode"; } + void SQAIExecMode_Register(Squirrel *engine) { DefSQClass <AIExecMode> SQAIExecMode("AIExecMode"); diff --git a/src/ai/api/ai_gamesettings.hpp b/src/ai/api/ai_gamesettings.hpp index a615a615f..947dc8f99 100644 --- a/src/ai/api/ai_gamesettings.hpp +++ b/src/ai/api/ai_gamesettings.hpp @@ -36,9 +36,6 @@ */ class AIGameSettings : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIGameSettings"; } - /** * Is the given game setting a valid setting for this instance of OpenTTD? * @param setting The setting to check for existence. diff --git a/src/ai/api/ai_gamesettings.hpp.sq b/src/ai/api/ai_gamesettings.hpp.sq index 158f205f6..299ba84bb 100644 --- a/src/ai/api/ai_gamesettings.hpp.sq +++ b/src/ai/api/ai_gamesettings.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AIGameSettings *>(HSQUIRRELVM vm, AIGameSettings *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIGameSettings", res, NULL, DefSQDestructorCallback<AIGameSettings>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIGameSettings>() { return "AIGameSettings"; } + void SQAIGameSettings_Register(Squirrel *engine) { DefSQClass <AIGameSettings> SQAIGameSettings("AIGameSettings"); diff --git a/src/ai/api/ai_group.hpp b/src/ai/api/ai_group.hpp index bff9d8dd4..2e025e013 100644 --- a/src/ai/api/ai_group.hpp +++ b/src/ai/api/ai_group.hpp @@ -19,9 +19,6 @@ */ class AIGroup : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIGroup"; } - /** * The group IDs of some special groups. */ diff --git a/src/ai/api/ai_group.hpp.sq b/src/ai/api/ai_group.hpp.sq index 1eb7d1456..6fe359079 100644 --- a/src/ai/api/ai_group.hpp.sq +++ b/src/ai/api/ai_group.hpp.sq @@ -24,6 +24,8 @@ namespace SQConvert { template <> int Return<AIGroup *>(HSQUIRRELVM vm, AIGroup *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIGroup", res, NULL, DefSQDestructorCallback<AIGroup>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIGroup>() { return "AIGroup"; } + void SQAIGroup_Register(Squirrel *engine) { DefSQClass <AIGroup> SQAIGroup("AIGroup"); diff --git a/src/ai/api/ai_grouplist.hpp b/src/ai/api/ai_grouplist.hpp index 227d3f8e8..1631a1d1d 100644 --- a/src/ai/api/ai_grouplist.hpp +++ b/src/ai/api/ai_grouplist.hpp @@ -21,8 +21,6 @@ */ class AIGroupList : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIGroupList"; } AIGroupList(); }; diff --git a/src/ai/api/ai_grouplist.hpp.sq b/src/ai/api/ai_grouplist.hpp.sq index dea8b5a34..6c9f283af 100644 --- a/src/ai/api/ai_grouplist.hpp.sq +++ b/src/ai/api/ai_grouplist.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AIGroupList *>(HSQUIRRELVM vm, AIGroupList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIGroupList", res, NULL, DefSQDestructorCallback<AIGroupList>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIGroupList>() { return "AIGroupList"; } + void SQAIGroupList_Register(Squirrel *engine) { DefSQClass <AIGroupList> SQAIGroupList("AIGroupList"); diff --git a/src/ai/api/ai_industry.hpp b/src/ai/api/ai_industry.hpp index 85f2a4dee..4ffdf42fc 100644 --- a/src/ai/api/ai_industry.hpp +++ b/src/ai/api/ai_industry.hpp @@ -19,9 +19,6 @@ */ class AIIndustry : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIIndustry"; } - /** Ways for an industry to accept a cargo. */ enum CargoAcceptState { CAS_NOT_ACCEPTED, ///< The CargoID is not accepted by this industry. diff --git a/src/ai/api/ai_industry.hpp.sq b/src/ai/api/ai_industry.hpp.sq index e0ff0ff8c..dc7dcdf4c 100644 --- a/src/ai/api/ai_industry.hpp.sq +++ b/src/ai/api/ai_industry.hpp.sq @@ -24,6 +24,8 @@ namespace SQConvert { template <> int Return<AIIndustry *>(HSQUIRRELVM vm, AIIndustry *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIIndustry", res, NULL, DefSQDestructorCallback<AIIndustry>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIIndustry>() { return "AIIndustry"; } + void SQAIIndustry_Register(Squirrel *engine) { DefSQClass <AIIndustry> SQAIIndustry("AIIndustry"); diff --git a/src/ai/api/ai_industrylist.hpp b/src/ai/api/ai_industrylist.hpp index b7dd7bc9f..255873b82 100644 --- a/src/ai/api/ai_industrylist.hpp +++ b/src/ai/api/ai_industrylist.hpp @@ -20,8 +20,6 @@ */ class AIIndustryList : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIIndustryList"; } AIIndustryList(); }; @@ -31,9 +29,6 @@ public: */ class AIIndustryList_CargoAccepting : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIIndustryList_CargoAccepting"; } - /** * @param cargo_id The cargo this industry should accept. */ @@ -47,9 +42,6 @@ public: */ class AIIndustryList_CargoProducing : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIIndustryList_CargoProducing"; } - /** * @param cargo_id The cargo this industry should produce. */ diff --git a/src/ai/api/ai_industrylist.hpp.sq b/src/ai/api/ai_industrylist.hpp.sq index 00cfdb1ee..825253c1a 100644 --- a/src/ai/api/ai_industrylist.hpp.sq +++ b/src/ai/api/ai_industrylist.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AIIndustryList *>(HSQUIRRELVM vm, AIIndustryList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIIndustryList", res, NULL, DefSQDestructorCallback<AIIndustryList>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIIndustryList>() { return "AIIndustryList"; } + void SQAIIndustryList_Register(Squirrel *engine) { DefSQClass <AIIndustryList> SQAIIndustryList("AIIndustryList"); @@ -38,6 +40,8 @@ namespace SQConvert { template <> int Return<AIIndustryList_CargoAccepting *>(HSQUIRRELVM vm, AIIndustryList_CargoAccepting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIIndustryList_CargoAccepting", res, NULL, DefSQDestructorCallback<AIIndustryList_CargoAccepting>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIIndustryList_CargoAccepting>() { return "AIIndustryList_CargoAccepting"; } + void SQAIIndustryList_CargoAccepting_Register(Squirrel *engine) { DefSQClass <AIIndustryList_CargoAccepting> SQAIIndustryList_CargoAccepting("AIIndustryList_CargoAccepting"); @@ -56,6 +60,8 @@ namespace SQConvert { template <> int Return<AIIndustryList_CargoProducing *>(HSQUIRRELVM vm, AIIndustryList_CargoProducing *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIIndustryList_CargoProducing", res, NULL, DefSQDestructorCallback<AIIndustryList_CargoProducing>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIIndustryList_CargoProducing>() { return "AIIndustryList_CargoProducing"; } + void SQAIIndustryList_CargoProducing_Register(Squirrel *engine) { DefSQClass <AIIndustryList_CargoProducing> SQAIIndustryList_CargoProducing("AIIndustryList_CargoProducing"); diff --git a/src/ai/api/ai_industrytype.hpp b/src/ai/api/ai_industrytype.hpp index 11e1fb9fe..523fad8e3 100644 --- a/src/ai/api/ai_industrytype.hpp +++ b/src/ai/api/ai_industrytype.hpp @@ -19,9 +19,6 @@ */ class AIIndustryType : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIIndustryType"; } - /** * Special IndustryTypes. */ diff --git a/src/ai/api/ai_industrytype.hpp.sq b/src/ai/api/ai_industrytype.hpp.sq index 938477145..a5969b325 100644 --- a/src/ai/api/ai_industrytype.hpp.sq +++ b/src/ai/api/ai_industrytype.hpp.sq @@ -24,6 +24,8 @@ namespace SQConvert { template <> int Return<AIIndustryType *>(HSQUIRRELVM vm, AIIndustryType *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIIndustryType", res, NULL, DefSQDestructorCallback<AIIndustryType>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIIndustryType>() { return "AIIndustryType"; } + void SQAIIndustryType_Register(Squirrel *engine) { DefSQClass <AIIndustryType> SQAIIndustryType("AIIndustryType"); diff --git a/src/ai/api/ai_industrytypelist.hpp b/src/ai/api/ai_industrytypelist.hpp index b29c4b011..90991096a 100644 --- a/src/ai/api/ai_industrytypelist.hpp +++ b/src/ai/api/ai_industrytypelist.hpp @@ -20,8 +20,6 @@ */ class AIIndustryTypeList : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIIndustryTypeList"; } AIIndustryTypeList(); }; diff --git a/src/ai/api/ai_industrytypelist.hpp.sq b/src/ai/api/ai_industrytypelist.hpp.sq index 38dabb7d7..43869ab94 100644 --- a/src/ai/api/ai_industrytypelist.hpp.sq +++ b/src/ai/api/ai_industrytypelist.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AIIndustryTypeList *>(HSQUIRRELVM vm, AIIndustryTypeList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIIndustryTypeList", res, NULL, DefSQDestructorCallback<AIIndustryTypeList>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIIndustryTypeList>() { return "AIIndustryTypeList"; } + void SQAIIndustryTypeList_Register(Squirrel *engine) { DefSQClass <AIIndustryTypeList> SQAIIndustryTypeList("AIIndustryTypeList"); diff --git a/src/ai/api/ai_list.hpp b/src/ai/api/ai_list.hpp index 05f7aeb4c..9087f26c5 100644 --- a/src/ai/api/ai_list.hpp +++ b/src/ai/api/ai_list.hpp @@ -24,9 +24,6 @@ class AIListSorter; */ class AIList : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIList"; } - /** Type of sorter */ enum SorterType { SORT_BY_VALUE, ///< Sort the list based on the value of the item. diff --git a/src/ai/api/ai_list.hpp.sq b/src/ai/api/ai_list.hpp.sq index ca903b693..fdff72c31 100644 --- a/src/ai/api/ai_list.hpp.sq +++ b/src/ai/api/ai_list.hpp.sq @@ -24,6 +24,8 @@ namespace SQConvert { template <> int Return<AIList *>(HSQUIRRELVM vm, AIList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIList", res, NULL, DefSQDestructorCallback<AIList>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIList>() { return "AIList"; } + void SQAIList_Register(Squirrel *engine) { DefSQClass <AIList> SQAIList("AIList"); diff --git a/src/ai/api/ai_log.hpp b/src/ai/api/ai_log.hpp index c14416644..00ada4e3f 100644 --- a/src/ai/api/ai_log.hpp +++ b/src/ai/api/ai_log.hpp @@ -23,9 +23,6 @@ class AILog : public AIObject { friend class AIController; public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AILog"; } - #ifndef EXPORT_SKIP /** * Log levels; The value is also feed to DEBUG() lvl. diff --git a/src/ai/api/ai_log.hpp.sq b/src/ai/api/ai_log.hpp.sq index b943a4ce5..36842ff3a 100644 --- a/src/ai/api/ai_log.hpp.sq +++ b/src/ai/api/ai_log.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AILog *>(HSQUIRRELVM vm, AILog *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AILog", res, NULL, DefSQDestructorCallback<AILog>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AILog>() { return "AILog"; } + void SQAILog_Register(Squirrel *engine) { DefSQClass <AILog> SQAILog("AILog"); diff --git a/src/ai/api/ai_map.hpp b/src/ai/api/ai_map.hpp index 316a3590e..15ff5c337 100644 --- a/src/ai/api/ai_map.hpp +++ b/src/ai/api/ai_map.hpp @@ -22,9 +22,6 @@ class AIMap : public AIObject { public: static const int TILE_INVALID = (int)INVALID_TILE; ///< Invalid TileIndex. - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIMap"; } - /** * Checks whether the given tile is valid. * @param tile The tile to check. diff --git a/src/ai/api/ai_map.hpp.sq b/src/ai/api/ai_map.hpp.sq index 24e96470a..0c4c0dfcb 100644 --- a/src/ai/api/ai_map.hpp.sq +++ b/src/ai/api/ai_map.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AIMap *>(HSQUIRRELVM vm, AIMap *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIMap", res, NULL, DefSQDestructorCallback<AIMap>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIMap>() { return "AIMap"; } + void SQAIMap_Register(Squirrel *engine) { DefSQClass <AIMap> SQAIMap("AIMap"); diff --git a/src/ai/api/ai_marine.hpp b/src/ai/api/ai_marine.hpp index 966ab9e1f..1eb691fe3 100644 --- a/src/ai/api/ai_marine.hpp +++ b/src/ai/api/ai_marine.hpp @@ -19,9 +19,6 @@ */ class AIMarine : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIMarine"; } - /** * All marine related error messages. */ diff --git a/src/ai/api/ai_marine.hpp.sq b/src/ai/api/ai_marine.hpp.sq index 40e153461..e72771d52 100644 --- a/src/ai/api/ai_marine.hpp.sq +++ b/src/ai/api/ai_marine.hpp.sq @@ -26,6 +26,8 @@ namespace SQConvert { template <> int Return<AIMarine *>(HSQUIRRELVM vm, AIMarine *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIMarine", res, NULL, DefSQDestructorCallback<AIMarine>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIMarine>() { return "AIMarine"; } + void SQAIMarine_Register(Squirrel *engine) { DefSQClass <AIMarine> SQAIMarine("AIMarine"); diff --git a/src/ai/api/ai_order.hpp b/src/ai/api/ai_order.hpp index cc2e0cc73..470b6faaf 100644 --- a/src/ai/api/ai_order.hpp +++ b/src/ai/api/ai_order.hpp @@ -19,9 +19,6 @@ */ class AIOrder : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIOrder"; } - /** * All order related error messages. */ diff --git a/src/ai/api/ai_order.hpp.sq b/src/ai/api/ai_order.hpp.sq index 9a289bdf0..1296b3c0a 100644 --- a/src/ai/api/ai_order.hpp.sq +++ b/src/ai/api/ai_order.hpp.sq @@ -34,6 +34,8 @@ namespace SQConvert { template <> int Return<AIOrder *>(HSQUIRRELVM vm, AIOrder *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIOrder", res, NULL, DefSQDestructorCallback<AIOrder>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIOrder>() { return "AIOrder"; } + void SQAIOrder_Register(Squirrel *engine) { DefSQClass <AIOrder> SQAIOrder("AIOrder"); diff --git a/src/ai/api/ai_rail.hpp b/src/ai/api/ai_rail.hpp index 9bb759ea7..0a9f70c5b 100644 --- a/src/ai/api/ai_rail.hpp +++ b/src/ai/api/ai_rail.hpp @@ -19,9 +19,6 @@ */ class AIRail : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIRail"; } - /** * All rail related error messages. */ diff --git a/src/ai/api/ai_rail.hpp.sq b/src/ai/api/ai_rail.hpp.sq index 7be4b7b75..0adceeac6 100644 --- a/src/ai/api/ai_rail.hpp.sq +++ b/src/ai/api/ai_rail.hpp.sq @@ -32,6 +32,8 @@ namespace SQConvert { template <> int Return<AIRail *>(HSQUIRRELVM vm, AIRail *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIRail", res, NULL, DefSQDestructorCallback<AIRail>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIRail>() { return "AIRail"; } + void SQAIRail_Register(Squirrel *engine) { DefSQClass <AIRail> SQAIRail("AIRail"); diff --git a/src/ai/api/ai_railtypelist.hpp b/src/ai/api/ai_railtypelist.hpp index dcf5bbf5b..8162b80f5 100644 --- a/src/ai/api/ai_railtypelist.hpp +++ b/src/ai/api/ai_railtypelist.hpp @@ -20,8 +20,6 @@ */ class AIRailTypeList : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIRailTypeList"; } AIRailTypeList(); }; diff --git a/src/ai/api/ai_railtypelist.hpp.sq b/src/ai/api/ai_railtypelist.hpp.sq index 5ced03aea..44720a74e 100644 --- a/src/ai/api/ai_railtypelist.hpp.sq +++ b/src/ai/api/ai_railtypelist.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AIRailTypeList *>(HSQUIRRELVM vm, AIRailTypeList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIRailTypeList", res, NULL, DefSQDestructorCallback<AIRailTypeList>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIRailTypeList>() { return "AIRailTypeList"; } + void SQAIRailTypeList_Register(Squirrel *engine) { DefSQClass <AIRailTypeList> SQAIRailTypeList("AIRailTypeList"); diff --git a/src/ai/api/ai_road.hpp b/src/ai/api/ai_road.hpp index 90129f7c4..32095799f 100644 --- a/src/ai/api/ai_road.hpp +++ b/src/ai/api/ai_road.hpp @@ -19,9 +19,6 @@ */ class AIRoad : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIRoad"; } - /** * All road related error messages. */ diff --git a/src/ai/api/ai_road.hpp.sq b/src/ai/api/ai_road.hpp.sq index 05d4e0bee..4507e9edc 100644 --- a/src/ai/api/ai_road.hpp.sq +++ b/src/ai/api/ai_road.hpp.sq @@ -30,6 +30,8 @@ namespace SQConvert { template <> int Return<AIRoad *>(HSQUIRRELVM vm, AIRoad *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIRoad", res, NULL, DefSQDestructorCallback<AIRoad>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIRoad>() { return "AIRoad"; } + void SQAIRoad_Register(Squirrel *engine) { DefSQClass <AIRoad> SQAIRoad("AIRoad"); diff --git a/src/ai/api/ai_sign.hpp b/src/ai/api/ai_sign.hpp index c2816d796..afbcf0d77 100644 --- a/src/ai/api/ai_sign.hpp +++ b/src/ai/api/ai_sign.hpp @@ -19,9 +19,6 @@ */ class AISign : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AISign"; } - /** * All sign related error messages. */ diff --git a/src/ai/api/ai_sign.hpp.sq b/src/ai/api/ai_sign.hpp.sq index 35df2636e..b1a27c1c3 100644 --- a/src/ai/api/ai_sign.hpp.sq +++ b/src/ai/api/ai_sign.hpp.sq @@ -24,6 +24,8 @@ namespace SQConvert { template <> int Return<AISign *>(HSQUIRRELVM vm, AISign *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AISign", res, NULL, DefSQDestructorCallback<AISign>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AISign>() { return "AISign"; } + void SQAISign_Register(Squirrel *engine) { DefSQClass <AISign> SQAISign("AISign"); diff --git a/src/ai/api/ai_signlist.hpp b/src/ai/api/ai_signlist.hpp index 088d79052..d96e8c658 100644 --- a/src/ai/api/ai_signlist.hpp +++ b/src/ai/api/ai_signlist.hpp @@ -20,8 +20,6 @@ */ class AISignList : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AISignList"; } AISignList(); }; diff --git a/src/ai/api/ai_signlist.hpp.sq b/src/ai/api/ai_signlist.hpp.sq index 9729ee7fa..083eba561 100644 --- a/src/ai/api/ai_signlist.hpp.sq +++ b/src/ai/api/ai_signlist.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AISignList *>(HSQUIRRELVM vm, AISignList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AISignList", res, NULL, DefSQDestructorCallback<AISignList>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AISignList>() { return "AISignList"; } + void SQAISignList_Register(Squirrel *engine) { DefSQClass <AISignList> SQAISignList("AISignList"); diff --git a/src/ai/api/ai_station.hpp b/src/ai/api/ai_station.hpp index 0faaaf147..66b1690bf 100644 --- a/src/ai/api/ai_station.hpp +++ b/src/ai/api/ai_station.hpp @@ -20,9 +20,6 @@ */ class AIStation : public AIBaseStation { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIStation"; } - /** * All station related error messages. */ diff --git a/src/ai/api/ai_station.hpp.sq b/src/ai/api/ai_station.hpp.sq index bca735132..6d210b271 100644 --- a/src/ai/api/ai_station.hpp.sq +++ b/src/ai/api/ai_station.hpp.sq @@ -26,6 +26,8 @@ namespace SQConvert { template <> int Return<AIStation *>(HSQUIRRELVM vm, AIStation *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIStation", res, NULL, DefSQDestructorCallback<AIStation>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIStation>() { return "AIStation"; } + void SQAIStation_Register(Squirrel *engine) { DefSQClass <AIStation> SQAIStation("AIStation"); diff --git a/src/ai/api/ai_stationlist.hpp b/src/ai/api/ai_stationlist.hpp index 747931598..b066523ab 100644 --- a/src/ai/api/ai_stationlist.hpp +++ b/src/ai/api/ai_stationlist.hpp @@ -21,9 +21,6 @@ */ class AIStationList : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIStationList"; } - /** * @param station_type The type of station to make a list of stations for. */ @@ -36,9 +33,6 @@ public: */ class AIStationList_Vehicle : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIStationList_Vehicle"; } - /** * @param vehicle_id The vehicle to get the list of stations he has in its orders from. */ diff --git a/src/ai/api/ai_stationlist.hpp.sq b/src/ai/api/ai_stationlist.hpp.sq index 104797ec1..b80addbdf 100644 --- a/src/ai/api/ai_stationlist.hpp.sq +++ b/src/ai/api/ai_stationlist.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AIStationList *>(HSQUIRRELVM vm, AIStationList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIStationList", res, NULL, DefSQDestructorCallback<AIStationList>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIStationList>() { return "AIStationList"; } + void SQAIStationList_Register(Squirrel *engine) { DefSQClass <AIStationList> SQAIStationList("AIStationList"); @@ -38,6 +40,8 @@ namespace SQConvert { template <> int Return<AIStationList_Vehicle *>(HSQUIRRELVM vm, AIStationList_Vehicle *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIStationList_Vehicle", res, NULL, DefSQDestructorCallback<AIStationList_Vehicle>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIStationList_Vehicle>() { return "AIStationList_Vehicle"; } + void SQAIStationList_Vehicle_Register(Squirrel *engine) { DefSQClass <AIStationList_Vehicle> SQAIStationList_Vehicle("AIStationList_Vehicle"); diff --git a/src/ai/api/ai_subsidy.hpp b/src/ai/api/ai_subsidy.hpp index b4079e59f..f9f0cf140 100644 --- a/src/ai/api/ai_subsidy.hpp +++ b/src/ai/api/ai_subsidy.hpp @@ -19,9 +19,6 @@ */ class AISubsidy : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AISubsidy"; } - /** * Enumeration for source and destination of a subsidy. * @note The list of values may grow in future. diff --git a/src/ai/api/ai_subsidy.hpp.sq b/src/ai/api/ai_subsidy.hpp.sq index 3b5f00910..fa99166a3 100644 --- a/src/ai/api/ai_subsidy.hpp.sq +++ b/src/ai/api/ai_subsidy.hpp.sq @@ -24,6 +24,8 @@ namespace SQConvert { template <> int Return<AISubsidy *>(HSQUIRRELVM vm, AISubsidy *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AISubsidy", res, NULL, DefSQDestructorCallback<AISubsidy>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AISubsidy>() { return "AISubsidy"; } + void SQAISubsidy_Register(Squirrel *engine) { DefSQClass <AISubsidy> SQAISubsidy("AISubsidy"); diff --git a/src/ai/api/ai_subsidylist.hpp b/src/ai/api/ai_subsidylist.hpp index cfa0ebcf5..786f1377f 100644 --- a/src/ai/api/ai_subsidylist.hpp +++ b/src/ai/api/ai_subsidylist.hpp @@ -20,8 +20,6 @@ */ class AISubsidyList : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AISubsidyList"; } AISubsidyList(); }; diff --git a/src/ai/api/ai_subsidylist.hpp.sq b/src/ai/api/ai_subsidylist.hpp.sq index d36db43d6..7996d9751 100644 --- a/src/ai/api/ai_subsidylist.hpp.sq +++ b/src/ai/api/ai_subsidylist.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AISubsidyList *>(HSQUIRRELVM vm, AISubsidyList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AISubsidyList", res, NULL, DefSQDestructorCallback<AISubsidyList>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AISubsidyList>() { return "AISubsidyList"; } + void SQAISubsidyList_Register(Squirrel *engine) { DefSQClass <AISubsidyList> SQAISubsidyList("AISubsidyList"); diff --git a/src/ai/api/ai_testmode.hpp b/src/ai/api/ai_testmode.hpp index c82ce7891..16964ef28 100644 --- a/src/ai/api/ai_testmode.hpp +++ b/src/ai/api/ai_testmode.hpp @@ -24,10 +24,6 @@ * the cost would be. */ class AITestMode : public AIObject { -public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AITestMode"; } - private: AIModeProc *last_mode; ///< The previous mode we were in. AIObject *last_instance; ///< The previous instace of the mode. diff --git a/src/ai/api/ai_testmode.hpp.sq b/src/ai/api/ai_testmode.hpp.sq index b31b09a92..87f9db643 100644 --- a/src/ai/api/ai_testmode.hpp.sq +++ b/src/ai/api/ai_testmode.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AITestMode *>(HSQUIRRELVM vm, AITestMode *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AITestMode", res, NULL, DefSQDestructorCallback<AITestMode>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AITestMode>() { return "AITestMode"; } + void SQAITestMode_Register(Squirrel *engine) { DefSQClass <AITestMode> SQAITestMode("AITestMode"); diff --git a/src/ai/api/ai_tile.hpp b/src/ai/api/ai_tile.hpp index 037a04d62..f9f5ba367 100644 --- a/src/ai/api/ai_tile.hpp +++ b/src/ai/api/ai_tile.hpp @@ -20,9 +20,6 @@ */ class AITile : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AITile"; } - /** * Error messages related to modifying tiles. */ diff --git a/src/ai/api/ai_tile.hpp.sq b/src/ai/api/ai_tile.hpp.sq index 8c7ba0b86..c08fcbdd8 100644 --- a/src/ai/api/ai_tile.hpp.sq +++ b/src/ai/api/ai_tile.hpp.sq @@ -32,6 +32,8 @@ namespace SQConvert { template <> int Return<AITile *>(HSQUIRRELVM vm, AITile *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AITile", res, NULL, DefSQDestructorCallback<AITile>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AITile>() { return "AITile"; } + void SQAITile_Register(Squirrel *engine) { DefSQClass <AITile> SQAITile("AITile"); diff --git a/src/ai/api/ai_tilelist.hpp b/src/ai/api/ai_tilelist.hpp index ddfcd8eb4..803429a60 100644 --- a/src/ai/api/ai_tilelist.hpp +++ b/src/ai/api/ai_tilelist.hpp @@ -21,9 +21,6 @@ */ class AITileList : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AITileList"; } - /** * Adds the rectangle between tile_from and tile_to to the to-be-evaluated tiles. * @param tile_from One corner of the tiles to add. @@ -64,9 +61,6 @@ public: */ class AITileList_IndustryAccepting : public AITileList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AITileList_IndustryAccepting"; } - /** * @param industry_id The industry to create the AITileList around. * @param radius The radius of the station you will be using. @@ -83,9 +77,6 @@ public: */ class AITileList_IndustryProducing : public AITileList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AITileList_IndustryProducing"; } - /** * @param industry_id The industry to create the AITileList around. * @param radius The radius of the station you will be using. @@ -102,9 +93,6 @@ public: */ class AITileList_StationType : public AITileList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AITileList_StationType"; } - /** * @param station_id The station to create the AITileList for. * @param station_type The StationType to create the AIList for. diff --git a/src/ai/api/ai_tilelist.hpp.sq b/src/ai/api/ai_tilelist.hpp.sq index 22739a2db..1a44c8e42 100644 --- a/src/ai/api/ai_tilelist.hpp.sq +++ b/src/ai/api/ai_tilelist.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AITileList *>(HSQUIRRELVM vm, AITileList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AITileList", res, NULL, DefSQDestructorCallback<AITileList>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AITileList>() { return "AITileList"; } + void SQAITileList_Register(Squirrel *engine) { DefSQClass <AITileList> SQAITileList("AITileList"); @@ -43,6 +45,8 @@ namespace SQConvert { template <> int Return<AITileList_IndustryAccepting *>(HSQUIRRELVM vm, AITileList_IndustryAccepting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AITileList_IndustryAccepting", res, NULL, DefSQDestructorCallback<AITileList_IndustryAccepting>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AITileList_IndustryAccepting>() { return "AITileList_IndustryAccepting"; } + void SQAITileList_IndustryAccepting_Register(Squirrel *engine) { DefSQClass <AITileList_IndustryAccepting> SQAITileList_IndustryAccepting("AITileList_IndustryAccepting"); @@ -61,6 +65,8 @@ namespace SQConvert { template <> int Return<AITileList_IndustryProducing *>(HSQUIRRELVM vm, AITileList_IndustryProducing *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AITileList_IndustryProducing", res, NULL, DefSQDestructorCallback<AITileList_IndustryProducing>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AITileList_IndustryProducing>() { return "AITileList_IndustryProducing"; } + void SQAITileList_IndustryProducing_Register(Squirrel *engine) { DefSQClass <AITileList_IndustryProducing> SQAITileList_IndustryProducing("AITileList_IndustryProducing"); @@ -79,6 +85,8 @@ namespace SQConvert { template <> int Return<AITileList_StationType *>(HSQUIRRELVM vm, AITileList_StationType *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AITileList_StationType", res, NULL, DefSQDestructorCallback<AITileList_StationType>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AITileList_StationType>() { return "AITileList_StationType"; } + void SQAITileList_StationType_Register(Squirrel *engine) { DefSQClass <AITileList_StationType> SQAITileList_StationType("AITileList_StationType"); diff --git a/src/ai/api/ai_town.hpp b/src/ai/api/ai_town.hpp index f74dc70f3..e73abb9cd 100644 --- a/src/ai/api/ai_town.hpp +++ b/src/ai/api/ai_town.hpp @@ -19,9 +19,6 @@ */ class AITown : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AITown"; } - /** * Actions that one can perform on a town. */ diff --git a/src/ai/api/ai_town.hpp.sq b/src/ai/api/ai_town.hpp.sq index b7a33551f..da03de3fc 100644 --- a/src/ai/api/ai_town.hpp.sq +++ b/src/ai/api/ai_town.hpp.sq @@ -28,6 +28,8 @@ namespace SQConvert { template <> int Return<AITown *>(HSQUIRRELVM vm, AITown *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AITown", res, NULL, DefSQDestructorCallback<AITown>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AITown>() { return "AITown"; } + void SQAITown_Register(Squirrel *engine) { DefSQClass <AITown> SQAITown("AITown"); diff --git a/src/ai/api/ai_townlist.hpp b/src/ai/api/ai_townlist.hpp index 1606935cc..f08a116ea 100644 --- a/src/ai/api/ai_townlist.hpp +++ b/src/ai/api/ai_townlist.hpp @@ -20,8 +20,6 @@ */ class AITownList : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AITownList"; } AITownList(); }; diff --git a/src/ai/api/ai_townlist.hpp.sq b/src/ai/api/ai_townlist.hpp.sq index bd05cc329..fe6211af0 100644 --- a/src/ai/api/ai_townlist.hpp.sq +++ b/src/ai/api/ai_townlist.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AITownList *>(HSQUIRRELVM vm, AITownList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AITownList", res, NULL, DefSQDestructorCallback<AITownList>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AITownList>() { return "AITownList"; } + void SQAITownList_Register(Squirrel *engine) { DefSQClass <AITownList> SQAITownList("AITownList"); diff --git a/src/ai/api/ai_tunnel.hpp b/src/ai/api/ai_tunnel.hpp index b788f4511..18f14a03e 100644 --- a/src/ai/api/ai_tunnel.hpp +++ b/src/ai/api/ai_tunnel.hpp @@ -19,9 +19,6 @@ */ class AITunnel : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AITunnel"; } - /** * All tunnel related errors. */ diff --git a/src/ai/api/ai_tunnel.hpp.sq b/src/ai/api/ai_tunnel.hpp.sq index cc1e34feb..af7b2c0aa 100644 --- a/src/ai/api/ai_tunnel.hpp.sq +++ b/src/ai/api/ai_tunnel.hpp.sq @@ -24,6 +24,8 @@ namespace SQConvert { template <> int Return<AITunnel *>(HSQUIRRELVM vm, AITunnel *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AITunnel", res, NULL, DefSQDestructorCallback<AITunnel>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AITunnel>() { return "AITunnel"; } + void SQAITunnel_Register(Squirrel *engine) { DefSQClass <AITunnel> SQAITunnel("AITunnel"); diff --git a/src/ai/api/ai_vehicle.hpp b/src/ai/api/ai_vehicle.hpp index bbcaac8b0..b994c810a 100644 --- a/src/ai/api/ai_vehicle.hpp +++ b/src/ai/api/ai_vehicle.hpp @@ -19,9 +19,6 @@ */ class AIVehicle : public AIObject { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIVehicle"; } - /** * All vehicle related error messages. */ diff --git a/src/ai/api/ai_vehicle.hpp.sq b/src/ai/api/ai_vehicle.hpp.sq index 933233eaf..1d40354a5 100644 --- a/src/ai/api/ai_vehicle.hpp.sq +++ b/src/ai/api/ai_vehicle.hpp.sq @@ -28,6 +28,8 @@ namespace SQConvert { template <> int Return<AIVehicle *>(HSQUIRRELVM vm, AIVehicle *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIVehicle", res, NULL, DefSQDestructorCallback<AIVehicle>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIVehicle>() { return "AIVehicle"; } + void SQAIVehicle_Register(Squirrel *engine) { DefSQClass <AIVehicle> SQAIVehicle("AIVehicle"); diff --git a/src/ai/api/ai_vehiclelist.hpp b/src/ai/api/ai_vehiclelist.hpp index cce400839..e6b01c360 100644 --- a/src/ai/api/ai_vehiclelist.hpp +++ b/src/ai/api/ai_vehiclelist.hpp @@ -21,8 +21,6 @@ */ class AIVehicleList : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIVehicleList"; } AIVehicleList(); }; @@ -32,9 +30,6 @@ public: */ class AIVehicleList_Station : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIVehicleList_Station"; } - /** * @param station_id The station to get the list of vehicles from, which have orders to it. * @pre AIBaseStation::IsValidBaseStation(station_id) @@ -52,9 +47,6 @@ public: */ class AIVehicleList_Depot : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIVehicleList_Depot"; } - /** * @param tile The tile of the depot to get the list of vehicles from, which have orders to it. */ @@ -67,9 +59,6 @@ public: */ class AIVehicleList_SharedOrders : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIVehicleList_SharedOrders"; } - /** * @param vehicle_id The vehicle that the rest shared orders with. */ @@ -82,9 +71,6 @@ public: */ class AIVehicleList_Group : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIVehicleList_Group"; } - /** * @param group_id The ID of the group the vehicles are in. */ @@ -97,9 +83,6 @@ public: */ class AIVehicleList_DefaultGroup : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIVehicleList_DefaultGroup"; } - /** * @param vehicle_type The VehicleType to get the list of vehicles for. */ diff --git a/src/ai/api/ai_vehiclelist.hpp.sq b/src/ai/api/ai_vehiclelist.hpp.sq index bdb46655f..e4b535bad 100644 --- a/src/ai/api/ai_vehiclelist.hpp.sq +++ b/src/ai/api/ai_vehiclelist.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AIVehicleList *>(HSQUIRRELVM vm, AIVehicleList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIVehicleList", res, NULL, DefSQDestructorCallback<AIVehicleList>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIVehicleList>() { return "AIVehicleList"; } + void SQAIVehicleList_Register(Squirrel *engine) { DefSQClass <AIVehicleList> SQAIVehicleList("AIVehicleList"); @@ -38,6 +40,8 @@ namespace SQConvert { template <> int Return<AIVehicleList_Station *>(HSQUIRRELVM vm, AIVehicleList_Station *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIVehicleList_Station", res, NULL, DefSQDestructorCallback<AIVehicleList_Station>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIVehicleList_Station>() { return "AIVehicleList_Station"; } + void SQAIVehicleList_Station_Register(Squirrel *engine) { DefSQClass <AIVehicleList_Station> SQAIVehicleList_Station("AIVehicleList_Station"); @@ -56,6 +60,8 @@ namespace SQConvert { template <> int Return<AIVehicleList_Depot *>(HSQUIRRELVM vm, AIVehicleList_Depot *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIVehicleList_Depot", res, NULL, DefSQDestructorCallback<AIVehicleList_Depot>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIVehicleList_Depot>() { return "AIVehicleList_Depot"; } + void SQAIVehicleList_Depot_Register(Squirrel *engine) { DefSQClass <AIVehicleList_Depot> SQAIVehicleList_Depot("AIVehicleList_Depot"); @@ -74,6 +80,8 @@ namespace SQConvert { template <> int Return<AIVehicleList_SharedOrders *>(HSQUIRRELVM vm, AIVehicleList_SharedOrders *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIVehicleList_SharedOrders", res, NULL, DefSQDestructorCallback<AIVehicleList_SharedOrders>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIVehicleList_SharedOrders>() { return "AIVehicleList_SharedOrders"; } + void SQAIVehicleList_SharedOrders_Register(Squirrel *engine) { DefSQClass <AIVehicleList_SharedOrders> SQAIVehicleList_SharedOrders("AIVehicleList_SharedOrders"); @@ -92,6 +100,8 @@ namespace SQConvert { template <> int Return<AIVehicleList_Group *>(HSQUIRRELVM vm, AIVehicleList_Group *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIVehicleList_Group", res, NULL, DefSQDestructorCallback<AIVehicleList_Group>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIVehicleList_Group>() { return "AIVehicleList_Group"; } + void SQAIVehicleList_Group_Register(Squirrel *engine) { DefSQClass <AIVehicleList_Group> SQAIVehicleList_Group("AIVehicleList_Group"); @@ -110,6 +120,8 @@ namespace SQConvert { template <> int Return<AIVehicleList_DefaultGroup *>(HSQUIRRELVM vm, AIVehicleList_DefaultGroup *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIVehicleList_DefaultGroup", res, NULL, DefSQDestructorCallback<AIVehicleList_DefaultGroup>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIVehicleList_DefaultGroup>() { return "AIVehicleList_DefaultGroup"; } + void SQAIVehicleList_DefaultGroup_Register(Squirrel *engine) { DefSQClass <AIVehicleList_DefaultGroup> SQAIVehicleList_DefaultGroup("AIVehicleList_DefaultGroup"); diff --git a/src/ai/api/ai_waypoint.hpp b/src/ai/api/ai_waypoint.hpp index 6ffcbc64d..413035a46 100644 --- a/src/ai/api/ai_waypoint.hpp +++ b/src/ai/api/ai_waypoint.hpp @@ -19,9 +19,6 @@ */ class AIWaypoint : public AIBaseStation { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIWaypoint"; } - /** * Type of waypoints known in the game. */ diff --git a/src/ai/api/ai_waypoint.hpp.sq b/src/ai/api/ai_waypoint.hpp.sq index 516b5f31e..a3413b13e 100644 --- a/src/ai/api/ai_waypoint.hpp.sq +++ b/src/ai/api/ai_waypoint.hpp.sq @@ -26,6 +26,8 @@ namespace SQConvert { template <> int Return<AIWaypoint *>(HSQUIRRELVM vm, AIWaypoint *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIWaypoint", res, NULL, DefSQDestructorCallback<AIWaypoint>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIWaypoint>() { return "AIWaypoint"; } + void SQAIWaypoint_Register(Squirrel *engine) { DefSQClass <AIWaypoint> SQAIWaypoint("AIWaypoint"); diff --git a/src/ai/api/ai_waypointlist.hpp b/src/ai/api/ai_waypointlist.hpp index 03bcd8e39..83642238f 100644 --- a/src/ai/api/ai_waypointlist.hpp +++ b/src/ai/api/ai_waypointlist.hpp @@ -21,9 +21,6 @@ */ class AIWaypointList : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIWaypointList"; } - /** * @param waypoint_type The type of waypoint to make a list of waypoints for. */ @@ -36,9 +33,6 @@ public: */ class AIWaypointList_Vehicle : public AIList { public: - /** Get the name of this class to identify it towards squirrel. */ - static const char *GetClassName() { return "AIWaypointList_Vehicle"; } - /** * @param vehicle_id The vehicle to get the list of waypoints he has in its orders from. */ diff --git a/src/ai/api/ai_waypointlist.hpp.sq b/src/ai/api/ai_waypointlist.hpp.sq index 1b0b3569b..dc0b18dd0 100644 --- a/src/ai/api/ai_waypointlist.hpp.sq +++ b/src/ai/api/ai_waypointlist.hpp.sq @@ -20,6 +20,8 @@ namespace SQConvert { template <> int Return<AIWaypointList *>(HSQUIRRELVM vm, AIWaypointList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIWaypointList", res, NULL, DefSQDestructorCallback<AIWaypointList>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIWaypointList>() { return "AIWaypointList"; } + void SQAIWaypointList_Register(Squirrel *engine) { DefSQClass <AIWaypointList> SQAIWaypointList("AIWaypointList"); @@ -38,6 +40,8 @@ namespace SQConvert { template <> int Return<AIWaypointList_Vehicle *>(HSQUIRRELVM vm, AIWaypointList_Vehicle *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIWaypointList_Vehicle", res, NULL, DefSQDestructorCallback<AIWaypointList_Vehicle>); return 1; } } // namespace SQConvert +template <> const char *GetClassName<AIWaypointList_Vehicle>() { return "AIWaypointList_Vehicle"; } + void SQAIWaypointList_Vehicle_Register(Squirrel *engine) { DefSQClass <AIWaypointList_Vehicle> SQAIWaypointList_Vehicle("AIWaypointList_Vehicle"); diff --git a/src/ai/api/squirrel_export.awk b/src/ai/api/squirrel_export.awk index 5a817f94d..4d0e4ff13 100644 --- a/src/ai/api/squirrel_export.awk +++ b/src/ai/api/squirrel_export.awk @@ -209,6 +209,9 @@ BEGIN { print "} // namespace SQConvert" print ""; + print "template <> const char *GetClassName<" cls ">() { return \"" cls "\"; }" + print ""; + # Then do the registration functions of the class. */ print "void SQ" cls "_Register(Squirrel *engine)" print "{" @@ -414,7 +417,6 @@ BEGIN { cls_param[1] = len; cls_param[2] = types; } else if (substr(funcname, 0, 1) == "_" && types != "v") { - } else if (funcname == "GetClassName" && types == ".") { } else if (is_static) { static_method_size++ static_methods[static_method_size, 0] = funcname |