changeset 18374:b3d29da5c263 draft

(svn r23210) -Codechange: generate the GetClassName function for the AI classes programmatically
author rubidium <rubidium@openttd.org>
date Sun, 13 Nov 2011 20:52:39 +0000
parents b125af48b1e6
children fc89c01f8b55
files src/ai/ai_scanner.cpp src/ai/api/ai_accounting.hpp src/ai/api/ai_accounting.hpp.sq src/ai/api/ai_airport.hpp src/ai/api/ai_airport.hpp.sq src/ai/api/ai_base.hpp src/ai/api/ai_base.hpp.sq src/ai/api/ai_basestation.hpp src/ai/api/ai_basestation.hpp.sq src/ai/api/ai_bridge.hpp src/ai/api/ai_bridge.hpp.sq src/ai/api/ai_bridgelist.hpp src/ai/api/ai_bridgelist.hpp.sq src/ai/api/ai_cargo.hpp src/ai/api/ai_cargo.hpp.sq src/ai/api/ai_cargolist.hpp src/ai/api/ai_cargolist.hpp.sq src/ai/api/ai_company.hpp src/ai/api/ai_company.hpp.sq src/ai/api/ai_controller.hpp src/ai/api/ai_controller.hpp.sq src/ai/api/ai_date.hpp src/ai/api/ai_date.hpp.sq src/ai/api/ai_depotlist.hpp src/ai/api/ai_depotlist.hpp.sq src/ai/api/ai_engine.hpp src/ai/api/ai_engine.hpp.sq src/ai/api/ai_enginelist.hpp src/ai/api/ai_enginelist.hpp.sq src/ai/api/ai_error.hpp src/ai/api/ai_error.hpp.sq src/ai/api/ai_event.hpp src/ai/api/ai_event.hpp.sq src/ai/api/ai_event_types.hpp src/ai/api/ai_event_types.hpp.sq src/ai/api/ai_execmode.hpp src/ai/api/ai_execmode.hpp.sq src/ai/api/ai_gamesettings.hpp src/ai/api/ai_gamesettings.hpp.sq src/ai/api/ai_group.hpp src/ai/api/ai_group.hpp.sq src/ai/api/ai_grouplist.hpp src/ai/api/ai_grouplist.hpp.sq src/ai/api/ai_industry.hpp src/ai/api/ai_industry.hpp.sq src/ai/api/ai_industrylist.hpp src/ai/api/ai_industrylist.hpp.sq src/ai/api/ai_industrytype.hpp src/ai/api/ai_industrytype.hpp.sq src/ai/api/ai_industrytypelist.hpp src/ai/api/ai_industrytypelist.hpp.sq src/ai/api/ai_list.hpp src/ai/api/ai_list.hpp.sq src/ai/api/ai_log.hpp src/ai/api/ai_log.hpp.sq src/ai/api/ai_map.hpp src/ai/api/ai_map.hpp.sq src/ai/api/ai_marine.hpp src/ai/api/ai_marine.hpp.sq src/ai/api/ai_order.hpp src/ai/api/ai_order.hpp.sq src/ai/api/ai_rail.hpp src/ai/api/ai_rail.hpp.sq src/ai/api/ai_railtypelist.hpp src/ai/api/ai_railtypelist.hpp.sq src/ai/api/ai_road.hpp src/ai/api/ai_road.hpp.sq src/ai/api/ai_sign.hpp src/ai/api/ai_sign.hpp.sq src/ai/api/ai_signlist.hpp src/ai/api/ai_signlist.hpp.sq src/ai/api/ai_station.hpp src/ai/api/ai_station.hpp.sq src/ai/api/ai_stationlist.hpp src/ai/api/ai_stationlist.hpp.sq src/ai/api/ai_subsidy.hpp src/ai/api/ai_subsidy.hpp.sq src/ai/api/ai_subsidylist.hpp src/ai/api/ai_subsidylist.hpp.sq src/ai/api/ai_testmode.hpp src/ai/api/ai_testmode.hpp.sq src/ai/api/ai_tile.hpp src/ai/api/ai_tile.hpp.sq src/ai/api/ai_tilelist.hpp src/ai/api/ai_tilelist.hpp.sq src/ai/api/ai_town.hpp src/ai/api/ai_town.hpp.sq src/ai/api/ai_townlist.hpp src/ai/api/ai_townlist.hpp.sq src/ai/api/ai_tunnel.hpp src/ai/api/ai_tunnel.hpp.sq src/ai/api/ai_vehicle.hpp src/ai/api/ai_vehicle.hpp.sq src/ai/api/ai_vehiclelist.hpp src/ai/api/ai_vehiclelist.hpp.sq src/ai/api/ai_waypoint.hpp src/ai/api/ai_waypoint.hpp.sq src/ai/api/ai_waypointlist.hpp src/ai/api/ai_waypointlist.hpp.sq src/ai/api/squirrel_export.awk src/script/squirrel_helper.hpp
diffstat 101 files changed, 183 insertions(+), 256 deletions(-) [+]
line wrap: on
line diff
--- a/src/ai/ai_scanner.cpp
+++ b/src/ai/ai_scanner.cpp
@@ -28,6 +28,8 @@
 	this->Scan(PATHSEP "library.nut", AI_LIBRARY_DIR);
 }
 
+template <> const char *GetClassName<AIInfo>() { return "AIInfo"; }
+
 AIScanner::AIScanner() :
 	ScriptScanner(),
 	info_dummy(NULL)
--- 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
--- a/src/ai/api/ai_accounting.hpp.sq
+++ b/src/ai/api/ai_accounting.hpp.sq
@@ -20,6 +20,8 @@
 	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");
--- 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.
 	 */
--- a/src/ai/api/ai_airport.hpp.sq
+++ b/src/ai/api/ai_airport.hpp.sq
@@ -26,6 +26,8 @@
 	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");
--- 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).
--- a/src/ai/api/ai_base.hpp.sq
+++ b/src/ai/api/ai_base.hpp.sq
@@ -20,6 +20,8 @@
 	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");
--- 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.
--- a/src/ai/api/ai_basestation.hpp.sq
+++ b/src/ai/api/ai_basestation.hpp.sq
@@ -24,6 +24,8 @@
 	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");
--- a/src/ai/api/ai_bridge.hpp
+++ b/src/ai/api/ai_bridge.hpp
@@ -39,9 +39,6 @@
 		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.
--- a/src/ai/api/ai_bridge.hpp.sq
+++ b/src/ai/api/ai_bridge.hpp.sq
@@ -24,6 +24,8 @@
 	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");
--- 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 @@
  */
 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.
 	 */
--- a/src/ai/api/ai_bridgelist.hpp.sq
+++ b/src/ai/api/ai_bridgelist.hpp.sq
@@ -20,6 +20,8 @@
 	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 @@
 	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");
--- 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).
 	 */
--- a/src/ai/api/ai_cargo.hpp.sq
+++ b/src/ai/api/ai_cargo.hpp.sq
@@ -28,6 +28,8 @@
 	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");
--- 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 @@
  */
 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 @@
  */
 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 @@
  */
 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.
 	 */
--- a/src/ai/api/ai_cargolist.hpp.sq
+++ b/src/ai/api/ai_cargolist.hpp.sq
@@ -20,6 +20,8 @@
 	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 @@
 	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 @@
 	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 @@
 	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");
--- 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.
--- a/src/ai/api/ai_company.hpp.sq
+++ b/src/ai/api/ai_company.hpp.sq
@@ -28,6 +28,8 @@
 	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");
--- a/src/ai/api/ai_controller.hpp
+++ b/src/ai/api/ai_controller.hpp
@@ -24,9 +24,6 @@
 	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.
 	 */
--- 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");
--- 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
--- a/src/ai/api/ai_date.hpp.sq
+++ b/src/ai/api/ai_date.hpp.sq
@@ -20,6 +20,8 @@
 	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");
--- 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.
 	 */
--- a/src/ai/api/ai_depotlist.hpp.sq
+++ b/src/ai/api/ai_depotlist.hpp.sq
@@ -20,6 +20,8 @@
 	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");
--- 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.
--- a/src/ai/api/ai_engine.hpp.sq
+++ b/src/ai/api/ai_engine.hpp.sq
@@ -20,6 +20,8 @@
 	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");
--- 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.
 	 */
--- a/src/ai/api/ai_enginelist.hpp.sq
+++ b/src/ai/api/ai_enginelist.hpp.sq
@@ -20,6 +20,8 @@
 	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");
--- 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.
 	 */
--- a/src/ai/api/ai_error.hpp.sq
+++ b/src/ai/api/ai_error.hpp.sq
@@ -26,6 +26,8 @@
 	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");
--- 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 @@
 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.
 	 */
--- a/src/ai/api/ai_event.hpp.sq
+++ b/src/ai/api/ai_event.hpp.sq
@@ -24,6 +24,8 @@
 	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 @@
 	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");
--- 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 @@
  */
 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 @@
  */
 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 @@
  */
 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 @@
  */
 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 @@
  */
 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 @@
  */
 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 @@
  */
 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 @@
  */
 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 @@
  */
 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 @@
  */
 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 @@
  */
 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 @@
  */
 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 @@
  */
 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 @@
  */
 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 @@
  */
 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 @@
  */
 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 @@
  */
 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 @@
  */
 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 @@
  */
 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 @@
  */
 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.
 	 */
--- a/src/ai/api/ai_event_types.hpp.sq
+++ b/src/ai/api/ai_event_types.hpp.sq
@@ -24,6 +24,8 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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");
--- 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.
--- a/src/ai/api/ai_execmode.hpp.sq
+++ b/src/ai/api/ai_execmode.hpp.sq
@@ -20,6 +20,8 @@
 	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");
--- 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.
--- a/src/ai/api/ai_gamesettings.hpp.sq
+++ b/src/ai/api/ai_gamesettings.hpp.sq
@@ -20,6 +20,8 @@
 	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");
--- 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.
 	 */
--- a/src/ai/api/ai_group.hpp.sq
+++ b/src/ai/api/ai_group.hpp.sq
@@ -24,6 +24,8 @@
 	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");
--- 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();
 };
 
--- a/src/ai/api/ai_grouplist.hpp.sq
+++ b/src/ai/api/ai_grouplist.hpp.sq
@@ -20,6 +20,8 @@
 	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");
--- 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.
--- a/src/ai/api/ai_industry.hpp.sq
+++ b/src/ai/api/ai_industry.hpp.sq
@@ -24,6 +24,8 @@
 	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");
--- 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 @@
  */
 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 @@
  */
 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.
 	 */
--- a/src/ai/api/ai_industrylist.hpp.sq
+++ b/src/ai/api/ai_industrylist.hpp.sq
@@ -20,6 +20,8 @@
 	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 @@
 	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 @@
 	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");
--- 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.
 	 */
--- a/src/ai/api/ai_industrytype.hpp.sq
+++ b/src/ai/api/ai_industrytype.hpp.sq
@@ -24,6 +24,8 @@
 	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");
--- 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();
 };
 
--- a/src/ai/api/ai_industrytypelist.hpp.sq
+++ b/src/ai/api/ai_industrytypelist.hpp.sq
@@ -20,6 +20,8 @@
 	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");
--- a/src/ai/api/ai_list.hpp
+++ b/src/ai/api/ai_list.hpp
@@ -24,9 +24,6 @@
  */
 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.
--- a/src/ai/api/ai_list.hpp.sq
+++ b/src/ai/api/ai_list.hpp.sq
@@ -24,6 +24,8 @@
 	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");
--- a/src/ai/api/ai_log.hpp
+++ b/src/ai/api/ai_log.hpp
@@ -23,9 +23,6 @@
 	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.
--- a/src/ai/api/ai_log.hpp.sq
+++ b/src/ai/api/ai_log.hpp.sq
@@ -20,6 +20,8 @@
 	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");
--- a/src/ai/api/ai_map.hpp
+++ b/src/ai/api/ai_map.hpp
@@ -22,9 +22,6 @@
 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.
--- a/src/ai/api/ai_map.hpp.sq
+++ b/src/ai/api/ai_map.hpp.sq
@@ -20,6 +20,8 @@
 	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");
--- 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.
 	 */
--- a/src/ai/api/ai_marine.hpp.sq
+++ b/src/ai/api/ai_marine.hpp.sq
@@ -26,6 +26,8 @@
 	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");
--- 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.
 	 */
--- a/src/ai/api/ai_order.hpp.sq
+++ b/src/ai/api/ai_order.hpp.sq
@@ -34,6 +34,8 @@
 	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");
--- 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.
 	 */
--- a/src/ai/api/ai_rail.hpp.sq
+++ b/src/ai/api/ai_rail.hpp.sq
@@ -32,6 +32,8 @@
 	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");
--- 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();
 };
 
--- a/src/ai/api/ai_railtypelist.hpp.sq
+++ b/src/ai/api/ai_railtypelist.hpp.sq
@@ -20,6 +20,8 @@
 	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");
--- 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.
 	 */
--- a/src/ai/api/ai_road.hpp.sq
+++ b/src/ai/api/ai_road.hpp.sq
@@ -30,6 +30,8 @@
 	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");
--- 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.
 	 */
--- a/src/ai/api/ai_sign.hpp.sq
+++ b/src/ai/api/ai_sign.hpp.sq
@@ -24,6 +24,8 @@
 	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");
--- 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();
 };
 
--- a/src/ai/api/ai_signlist.hpp.sq
+++ b/src/ai/api/ai_signlist.hpp.sq
@@ -20,6 +20,8 @@
 	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");
--- 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.
 	 */
--- a/src/ai/api/ai_station.hpp.sq
+++ b/src/ai/api/ai_station.hpp.sq
@@ -26,6 +26,8 @@
 	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");
--- 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 @@
  */
 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.
 	 */
--- a/src/ai/api/ai_stationlist.hpp.sq
+++ b/src/ai/api/ai_stationlist.hpp.sq
@@ -20,6 +20,8 @@
 	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 @@
 	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");
--- 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.
--- a/src/ai/api/ai_subsidy.hpp.sq
+++ b/src/ai/api/ai_subsidy.hpp.sq
@@ -24,6 +24,8 @@
 	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");
--- 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();
 };
 
--- a/src/ai/api/ai_subsidylist.hpp.sq
+++ b/src/ai/api/ai_subsidylist.hpp.sq
@@ -20,6 +20,8 @@
 	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");
--- 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.
--- a/src/ai/api/ai_testmode.hpp.sq
+++ b/src/ai/api/ai_testmode.hpp.sq
@@ -20,6 +20,8 @@
 	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");
--- 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.
 	 */
--- a/src/ai/api/ai_tile.hpp.sq
+++ b/src/ai/api/ai_tile.hpp.sq
@@ -32,6 +32,8 @@
 	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");
--- 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 @@
  */
 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 @@
  */
 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 @@
  */
 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.
--- a/src/ai/api/ai_tilelist.hpp.sq
+++ b/src/ai/api/ai_tilelist.hpp.sq
@@ -20,6 +20,8 @@
 	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 @@
 	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 @@
 	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 @@
 	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");
--- 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.
 	 */
--- a/src/ai/api/ai_town.hpp.sq
+++ b/src/ai/api/ai_town.hpp.sq
@@ -28,6 +28,8 @@
 	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");
--- 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();
 };
 
--- a/src/ai/api/ai_townlist.hpp.sq
+++ b/src/ai/api/ai_townlist.hpp.sq
@@ -20,6 +20,8 @@
 	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");
--- 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.
 	 */
--- a/src/ai/api/ai_tunnel.hpp.sq
+++ b/src/ai/api/ai_tunnel.hpp.sq
@@ -24,6 +24,8 @@
 	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");
--- 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.
 	 */
--- a/src/ai/api/ai_vehicle.hpp.sq
+++ b/src/ai/api/ai_vehicle.hpp.sq
@@ -28,6 +28,8 @@
 	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");
--- 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 @@
  */
 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 @@
  */
 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 @@
  */
 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 @@
  */
 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 @@
  */
 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.
 	 */
--- a/src/ai/api/ai_vehiclelist.hpp.sq
+++ b/src/ai/api/ai_vehiclelist.hpp.sq
@@ -20,6 +20,8 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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");
--- 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.
 	 */
--- a/src/ai/api/ai_waypoint.hpp.sq
+++ b/src/ai/api/ai_waypoint.hpp.sq
@@ -26,6 +26,8 @@
 	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");
--- 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 @@
  */
 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.
 	 */
--- a/src/ai/api/ai_waypointlist.hpp.sq
+++ b/src/ai/api/ai_waypointlist.hpp.sq
@@ -20,6 +20,8 @@
 	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 @@
 	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");
--- a/src/ai/api/squirrel_export.awk
+++ b/src/ai/api/squirrel_export.awk
@@ -209,6 +209,9 @@
 	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 @@
 		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
--- a/src/script/squirrel_helper.hpp
+++ b/src/script/squirrel_helper.hpp
@@ -19,6 +19,8 @@
 #include "../string_func.h"
 #include "squirrel_helper_type.hpp"
 
+template <class CL> const char *GetClassName();
+
 /**
  * The Squirrel convert routines
  */
@@ -766,7 +768,8 @@
 
 		/* Protect against calls to a non-static method in a static way */
 		sq_pushroottable(vm);
-		sq_pushstring(vm, OTTD2SQ(Tcls::GetClassName()), -1);
+		const char *className = GetClassName<Tcls>();
+		sq_pushstring(vm, OTTD2SQ(className), -1);
 		sq_get(vm, -2);
 		sq_pushobject(vm, instance);
 		if (sq_instanceof(vm) != SQTrue) return sq_throwerror(vm, _SC("class method is non-static"));
@@ -808,7 +811,8 @@
 
 		/* Protect against calls to a non-static method in a static way */
 		sq_pushroottable(vm);
-		sq_pushstring(vm, OTTD2SQ(Tcls::GetClassName()), -1);
+		const char *className = GetClassName<Tcls>();
+		sq_pushstring(vm, OTTD2SQ(className), -1);
 		sq_get(vm, -2);
 		sq_pushobject(vm, instance);
 		if (sq_instanceof(vm) != SQTrue) return sq_throwerror(vm, _SC("class method is non-static"));