From 7158aaea3100fbae72c75645800592117375f897 Mon Sep 17 00:00:00 2001 From: truebrain Date: Tue, 29 Nov 2011 23:29:20 +0000 Subject: [PATCH] (svn r23373) -Add: move the AI API to script/api/ai, and move the Squirrel C++ glue templates to script/api/template --- src/ai/ai_instance.cpp | 98 ++--- src/script/api/ai/ai_accounting.hpp.sq | 28 ++ .../api => script/api/ai}/ai_airport.hpp.sq | 17 +- src/script/api/ai/ai_base.hpp.sq | 32 ++ src/script/api/ai/ai_basestation.hpp.sq | 35 ++ .../api => script/api/ai}/ai_bridge.hpp.sq | 15 +- src/script/api/ai/ai_bridgelist.hpp.sq | 37 ++ src/script/api/ai/ai_cargo.hpp.sq | 52 +++ src/script/api/ai/ai_cargolist.hpp.sq | 61 +++ .../api => script/api/ai}/ai_company.hpp.sq | 19 +- .../api/ai}/ai_controller.hpp.sq | 2 +- src/script/api/ai/ai_date.hpp.sq | 31 ++ src/script/api/ai/ai_depotlist.hpp.sq | 25 ++ .../api => script/api/ai}/ai_engine.hpp.sq | 11 +- src/script/api/ai/ai_enginelist.hpp.sq | 25 ++ src/{ai/api => script/api/ai}/ai_error.hpp.sq | 17 +- src/{ai/api => script/api/ai}/ai_event.hpp.sq | 23 +- src/script/api/ai/ai_event_types.hpp.sq | 348 ++++++++++++++++++ src/script/api/ai/ai_execmode.hpp.sq | 25 ++ src/script/api/ai/ai_gamesettings.hpp.sq | 29 ++ src/{ai/api => script/api/ai}/ai_group.hpp.sq | 15 +- src/script/api/ai/ai_grouplist.hpp.sq | 25 ++ .../api => script/api/ai}/ai_industry.hpp.sq | 15 +- src/script/api/ai/ai_industrylist.hpp.sq | 49 +++ .../api/ai}/ai_industrytype.hpp.sq | 15 +- src/script/api/ai/ai_industrytypelist.hpp.sq | 25 ++ src/{ai/api => script/api/ai}/ai_list.hpp.sq | 15 +- src/script/api/ai/ai_log.hpp.sq | 29 ++ src/{ai/api => script/api/ai}/ai_map.hpp.sq | 11 +- .../api => script/api/ai}/ai_marine.hpp.sq | 17 +- src/{ai/api => script/api/ai}/ai_order.hpp.sq | 25 +- src/{ai/api => script/api/ai}/ai_rail.hpp.sq | 23 +- src/script/api/ai/ai_railtypelist.hpp.sq | 25 ++ src/{ai/api => script/api/ai}/ai_road.hpp.sq | 21 +- src/script/api/ai/ai_sign.hpp.sq | 39 ++ src/script/api/ai/ai_signlist.hpp.sq | 25 ++ .../api => script/api/ai}/ai_station.hpp.sq | 17 +- src/script/api/ai/ai_stationlist.hpp.sq | 37 ++ src/script/api/ai/ai_subsidy.hpp.sq | 39 ++ src/script/api/ai/ai_subsidylist.hpp.sq | 25 ++ src/script/api/ai/ai_testmode.hpp.sq | 25 ++ src/{ai/api => script/api/ai}/ai_tile.hpp.sq | 23 +- src/script/api/ai/ai_tilelist.hpp.sq | 66 ++++ src/{ai/api => script/api/ai}/ai_town.hpp.sq | 19 +- src/script/api/ai/ai_townlist.hpp.sq | 37 ++ .../api => script/api/ai}/ai_tunnel.hpp.sq | 15 +- .../api => script/api/ai}/ai_vehicle.hpp.sq | 19 +- src/script/api/ai/ai_vehiclelist.hpp.sq | 85 +++++ src/script/api/ai/ai_waypoint.hpp.sq | 42 +++ src/script/api/ai/ai_waypointlist.hpp.sq | 37 ++ src/script/api/squirrel_export.awk | 78 ++-- src/script/api/squirrel_export.sh | 35 +- .../api/template/template_accounting.hpp.sq} | 16 +- .../api/template/template_airport.hpp.sq | 27 ++ .../api/template/template_base.hpp.sq} | 20 +- .../api/template/template_basestation.hpp.sq} | 23 +- .../api/template/template_bridge.hpp.sq | 25 ++ .../api/template/template_bridgelist.hpp.sq} | 24 +- .../api/template/template_cargo.hpp.sq} | 40 +- .../api/template/template_cargolist.hpp.sq} | 46 +-- .../api/template/template_company.hpp.sq | 29 ++ .../api/template/template_date.hpp.sq} | 19 +- .../api/template/template_depotlist.hpp.sq} | 13 +- .../api/template/template_engine.hpp.sq | 21 ++ .../api/template/template_enginelist.hpp.sq} | 13 +- src/script/api/template/template_error.hpp.sq | 27 ++ src/script/api/template/template_event.hpp.sq | 34 ++ .../api/template/template_event_types.hpp.sq} | 316 +--------------- .../api/template/template_execmode.hpp.sq} | 13 +- .../template/template_gamesettings.hpp.sq} | 17 +- src/script/api/template/template_group.hpp.sq | 25 ++ .../api/template/template_grouplist.hpp.sq} | 13 +- .../api/template/template_industry.hpp.sq | 25 ++ .../template/template_industrylist.hpp.sq} | 35 +- .../api/template/template_industrytype.hpp.sq | 25 ++ .../template_industrytypelist.hpp.sq} | 13 +- src/script/api/template/template_list.hpp.sq | 25 ++ .../api/template/template_log.hpp.sq} | 21 +- src/script/api/template/template_map.hpp.sq | 21 ++ .../api/template/template_marine.hpp.sq | 27 ++ src/script/api/template/template_order.hpp.sq | 35 ++ src/script/api/template/template_rail.hpp.sq | 33 ++ .../template/template_railtypelist.hpp.sq} | 13 +- src/script/api/template/template_road.hpp.sq | 31 ++ .../api/template/template_sign.hpp.sq} | 27 +- .../api/template/template_signlist.hpp.sq} | 13 +- .../api/template/template_station.hpp.sq | 27 ++ .../api/template/template_stationlist.hpp.sq} | 24 +- .../api/template/template_subsidy.hpp.sq} | 27 +- .../api/template/template_subsidylist.hpp.sq} | 13 +- .../api/template/template_testmode.hpp.sq} | 13 +- src/script/api/template/template_tile.hpp.sq | 33 ++ .../api/template/template_tilelist.hpp.sq} | 51 +-- src/script/api/template/template_town.hpp.sq | 29 ++ .../api/template/template_townlist.hpp.sq} | 24 +- .../api/template/template_tunnel.hpp.sq | 25 ++ .../api/template/template_vehicle.hpp.sq | 29 ++ .../api/template/template_vehiclelist.hpp.sq} | 68 +--- .../api/template/template_waypoint.hpp.sq} | 30 +- .../template/template_waypointlist.hpp.sq} | 24 +- 100 files changed, 2087 insertions(+), 1338 deletions(-) create mode 100644 src/script/api/ai/ai_accounting.hpp.sq rename src/{ai/api => script/api/ai}/ai_airport.hpp.sq (65%) create mode 100644 src/script/api/ai/ai_base.hpp.sq create mode 100644 src/script/api/ai/ai_basestation.hpp.sq rename src/{ai/api => script/api/ai}/ai_bridge.hpp.sq (64%) create mode 100644 src/script/api/ai/ai_bridgelist.hpp.sq create mode 100644 src/script/api/ai/ai_cargo.hpp.sq create mode 100644 src/script/api/ai/ai_cargolist.hpp.sq rename src/{ai/api => script/api/ai}/ai_company.hpp.sq (67%) rename src/{ai/api => script/api/ai}/ai_controller.hpp.sq (97%) create mode 100644 src/script/api/ai/ai_date.hpp.sq create mode 100644 src/script/api/ai/ai_depotlist.hpp.sq rename src/{ai/api => script/api/ai}/ai_engine.hpp.sq (72%) create mode 100644 src/script/api/ai/ai_enginelist.hpp.sq rename src/{ai/api => script/api/ai}/ai_error.hpp.sq (82%) rename src/{ai/api => script/api/ai}/ai_event.hpp.sq (56%) create mode 100644 src/script/api/ai/ai_event_types.hpp.sq create mode 100644 src/script/api/ai/ai_execmode.hpp.sq create mode 100644 src/script/api/ai/ai_gamesettings.hpp.sq rename src/{ai/api => script/api/ai}/ai_group.hpp.sq (63%) create mode 100644 src/script/api/ai/ai_grouplist.hpp.sq rename src/{ai/api => script/api/ai}/ai_industry.hpp.sq (67%) create mode 100644 src/script/api/ai/ai_industrylist.hpp.sq rename src/{ai/api => script/api/ai}/ai_industrytype.hpp.sq (60%) create mode 100644 src/script/api/ai/ai_industrytypelist.hpp.sq rename src/{ai/api => script/api/ai}/ai_list.hpp.sq (70%) create mode 100644 src/script/api/ai/ai_log.hpp.sq rename src/{ai/api => script/api/ai}/ai_map.hpp.sq (61%) rename src/{ai/api => script/api/ai}/ai_marine.hpp.sq (62%) rename src/{ai/api => script/api/ai}/ai_order.hpp.sq (74%) rename src/{ai/api => script/api/ai}/ai_rail.hpp.sq (72%) create mode 100644 src/script/api/ai/ai_railtypelist.hpp.sq rename src/{ai/api => script/api/ai}/ai_road.hpp.sq (71%) create mode 100644 src/script/api/ai/ai_sign.hpp.sq create mode 100644 src/script/api/ai/ai_signlist.hpp.sq rename src/{ai/api => script/api/ai}/ai_station.hpp.sq (68%) create mode 100644 src/script/api/ai/ai_stationlist.hpp.sq create mode 100644 src/script/api/ai/ai_subsidy.hpp.sq create mode 100644 src/script/api/ai/ai_subsidylist.hpp.sq create mode 100644 src/script/api/ai/ai_testmode.hpp.sq rename src/{ai/api => script/api/ai}/ai_tile.hpp.sq (75%) create mode 100644 src/script/api/ai/ai_tilelist.hpp.sq rename src/{ai/api => script/api/ai}/ai_town.hpp.sq (72%) create mode 100644 src/script/api/ai/ai_townlist.hpp.sq rename src/{ai/api => script/api/ai}/ai_tunnel.hpp.sq (62%) rename src/{ai/api => script/api/ai}/ai_vehicle.hpp.sq (85%) create mode 100644 src/script/api/ai/ai_vehiclelist.hpp.sq create mode 100644 src/script/api/ai/ai_waypoint.hpp.sq create mode 100644 src/script/api/ai/ai_waypointlist.hpp.sq rename src/{ai/api/ai_accounting.hpp.sq => script/api/template/template_accounting.hpp.sq} (77%) create mode 100644 src/script/api/template/template_airport.hpp.sq rename src/{ai/api/ai_base.hpp.sq => script/api/template/template_base.hpp.sq} (68%) rename src/{ai/api/ai_basestation.hpp.sq => script/api/template/template_basestation.hpp.sq} (65%) create mode 100644 src/script/api/template/template_bridge.hpp.sq rename src/{ai/api/ai_bridgelist.hpp.sq => script/api/template/template_bridgelist.hpp.sq} (79%) rename src/{ai/api/ai_cargo.hpp.sq => script/api/template/template_cargo.hpp.sq} (56%) rename src/{ai/api/ai_cargolist.hpp.sq => script/api/template/template_cargolist.hpp.sq} (76%) create mode 100644 src/script/api/template/template_company.hpp.sq rename src/{ai/api/ai_date.hpp.sq => script/api/template/template_date.hpp.sq} (70%) rename src/{ai/api/ai_depotlist.hpp.sq => script/api/template/template_depotlist.hpp.sq} (81%) create mode 100644 src/script/api/template/template_engine.hpp.sq rename src/{ai/api/ai_enginelist.hpp.sq => script/api/template/template_enginelist.hpp.sq} (81%) create mode 100644 src/script/api/template/template_error.hpp.sq create mode 100644 src/script/api/template/template_event.hpp.sq rename src/{ai/api/ai_event_types.hpp.sq => script/api/template/template_event_types.hpp.sq} (68%) rename src/{ai/api/ai_execmode.hpp.sq => script/api/template/template_execmode.hpp.sq} (83%) rename src/{ai/api/ai_gamesettings.hpp.sq => script/api/template/template_gamesettings.hpp.sq} (71%) create mode 100644 src/script/api/template/template_group.hpp.sq rename src/{ai/api/ai_grouplist.hpp.sq => script/api/template/template_grouplist.hpp.sq} (82%) create mode 100644 src/script/api/template/template_industry.hpp.sq rename src/{ai/api/ai_industrylist.hpp.sq => script/api/template/template_industrylist.hpp.sq} (77%) create mode 100644 src/script/api/template/template_industrytype.hpp.sq rename src/{ai/api/ai_industrytypelist.hpp.sq => script/api/template/template_industrytypelist.hpp.sq} (81%) create mode 100644 src/script/api/template/template_list.hpp.sq rename src/{ai/api/ai_log.hpp.sq => script/api/template/template_log.hpp.sq} (76%) create mode 100644 src/script/api/template/template_map.hpp.sq create mode 100644 src/script/api/template/template_marine.hpp.sq create mode 100644 src/script/api/template/template_order.hpp.sq create mode 100644 src/script/api/template/template_rail.hpp.sq rename src/{ai/api/ai_railtypelist.hpp.sq => script/api/template/template_railtypelist.hpp.sq} (82%) create mode 100644 src/script/api/template/template_road.hpp.sq rename src/{ai/api/ai_sign.hpp.sq => script/api/template/template_sign.hpp.sq} (65%) rename src/{ai/api/ai_signlist.hpp.sq => script/api/template/template_signlist.hpp.sq} (83%) create mode 100644 src/script/api/template/template_station.hpp.sq rename src/{ai/api/ai_stationlist.hpp.sq => script/api/template/template_stationlist.hpp.sq} (78%) rename src/{ai/api/ai_subsidy.hpp.sq => script/api/template/template_subsidy.hpp.sq} (60%) rename src/{ai/api/ai_subsidylist.hpp.sq => script/api/template/template_subsidylist.hpp.sq} (82%) rename src/{ai/api/ai_testmode.hpp.sq => script/api/template/template_testmode.hpp.sq} (83%) create mode 100644 src/script/api/template/template_tile.hpp.sq rename src/{ai/api/ai_tilelist.hpp.sq => script/api/template/template_tilelist.hpp.sq} (73%) create mode 100644 src/script/api/template/template_town.hpp.sq rename src/{ai/api/ai_townlist.hpp.sq => script/api/template/template_townlist.hpp.sq} (80%) create mode 100644 src/script/api/template/template_tunnel.hpp.sq create mode 100644 src/script/api/template/template_vehicle.hpp.sq rename src/{ai/api/ai_vehiclelist.hpp.sq => script/api/template/template_vehiclelist.hpp.sq} (76%) rename src/{ai/api/ai_waypoint.hpp.sq => script/api/template/template_waypoint.hpp.sq} (58%) rename src/{ai/api/ai_waypointlist.hpp.sq => script/api/template/template_waypointlist.hpp.sq} (78%) diff --git a/src/ai/ai_instance.cpp b/src/ai/ai_instance.cpp index d7459005da..e3375a0bab 100644 --- a/src/ai/ai_instance.cpp +++ b/src/ai/ai_instance.cpp @@ -28,55 +28,55 @@ /* Convert all AI related classes to Squirrel data. * Note: this line is a marker in squirrel_export.sh. Do not change! */ -#include "api/ai_accounting.hpp.sq" -#include "api/ai_airport.hpp.sq" -#include "api/ai_base.hpp.sq" -#include "api/ai_basestation.hpp.sq" -#include "api/ai_bridge.hpp.sq" -#include "api/ai_bridgelist.hpp.sq" -#include "api/ai_cargo.hpp.sq" -#include "api/ai_cargolist.hpp.sq" -#include "api/ai_company.hpp.sq" -#include "api/ai_controller.hpp.sq" -#include "api/ai_date.hpp.sq" -#include "api/ai_depotlist.hpp.sq" -#include "api/ai_engine.hpp.sq" -#include "api/ai_enginelist.hpp.sq" -#include "api/ai_error.hpp.sq" -#include "api/ai_event.hpp.sq" -#include "api/ai_event_types.hpp.sq" -#include "api/ai_execmode.hpp.sq" -#include "api/ai_gamesettings.hpp.sq" -#include "api/ai_group.hpp.sq" -#include "api/ai_grouplist.hpp.sq" -#include "api/ai_industry.hpp.sq" -#include "api/ai_industrylist.hpp.sq" -#include "api/ai_industrytype.hpp.sq" -#include "api/ai_industrytypelist.hpp.sq" -#include "api/ai_list.hpp.sq" -#include "api/ai_log.hpp.sq" -#include "api/ai_map.hpp.sq" -#include "api/ai_marine.hpp.sq" -#include "api/ai_order.hpp.sq" -#include "api/ai_rail.hpp.sq" -#include "api/ai_railtypelist.hpp.sq" -#include "api/ai_road.hpp.sq" -#include "api/ai_sign.hpp.sq" -#include "api/ai_signlist.hpp.sq" -#include "api/ai_station.hpp.sq" -#include "api/ai_stationlist.hpp.sq" -#include "api/ai_subsidy.hpp.sq" -#include "api/ai_subsidylist.hpp.sq" -#include "api/ai_testmode.hpp.sq" -#include "api/ai_tile.hpp.sq" -#include "api/ai_tilelist.hpp.sq" -#include "api/ai_town.hpp.sq" -#include "api/ai_townlist.hpp.sq" -#include "api/ai_tunnel.hpp.sq" -#include "api/ai_vehicle.hpp.sq" -#include "api/ai_vehiclelist.hpp.sq" -#include "api/ai_waypoint.hpp.sq" -#include "api/ai_waypointlist.hpp.sq" +#include "../script/api/ai/ai_accounting.hpp.sq" +#include "../script/api/ai/ai_airport.hpp.sq" +#include "../script/api/ai/ai_base.hpp.sq" +#include "../script/api/ai/ai_basestation.hpp.sq" +#include "../script/api/ai/ai_bridge.hpp.sq" +#include "../script/api/ai/ai_bridgelist.hpp.sq" +#include "../script/api/ai/ai_cargo.hpp.sq" +#include "../script/api/ai/ai_cargolist.hpp.sq" +#include "../script/api/ai/ai_company.hpp.sq" +#include "../script/api/ai/ai_controller.hpp.sq" +#include "../script/api/ai/ai_date.hpp.sq" +#include "../script/api/ai/ai_depotlist.hpp.sq" +#include "../script/api/ai/ai_engine.hpp.sq" +#include "../script/api/ai/ai_enginelist.hpp.sq" +#include "../script/api/ai/ai_error.hpp.sq" +#include "../script/api/ai/ai_event.hpp.sq" +#include "../script/api/ai/ai_event_types.hpp.sq" +#include "../script/api/ai/ai_execmode.hpp.sq" +#include "../script/api/ai/ai_gamesettings.hpp.sq" +#include "../script/api/ai/ai_group.hpp.sq" +#include "../script/api/ai/ai_grouplist.hpp.sq" +#include "../script/api/ai/ai_industry.hpp.sq" +#include "../script/api/ai/ai_industrylist.hpp.sq" +#include "../script/api/ai/ai_industrytype.hpp.sq" +#include "../script/api/ai/ai_industrytypelist.hpp.sq" +#include "../script/api/ai/ai_list.hpp.sq" +#include "../script/api/ai/ai_log.hpp.sq" +#include "../script/api/ai/ai_map.hpp.sq" +#include "../script/api/ai/ai_marine.hpp.sq" +#include "../script/api/ai/ai_order.hpp.sq" +#include "../script/api/ai/ai_rail.hpp.sq" +#include "../script/api/ai/ai_railtypelist.hpp.sq" +#include "../script/api/ai/ai_road.hpp.sq" +#include "../script/api/ai/ai_sign.hpp.sq" +#include "../script/api/ai/ai_signlist.hpp.sq" +#include "../script/api/ai/ai_station.hpp.sq" +#include "../script/api/ai/ai_stationlist.hpp.sq" +#include "../script/api/ai/ai_subsidy.hpp.sq" +#include "../script/api/ai/ai_subsidylist.hpp.sq" +#include "../script/api/ai/ai_testmode.hpp.sq" +#include "../script/api/ai/ai_tile.hpp.sq" +#include "../script/api/ai/ai_tilelist.hpp.sq" +#include "../script/api/ai/ai_town.hpp.sq" +#include "../script/api/ai/ai_townlist.hpp.sq" +#include "../script/api/ai/ai_tunnel.hpp.sq" +#include "../script/api/ai/ai_vehicle.hpp.sq" +#include "../script/api/ai/ai_vehiclelist.hpp.sq" +#include "../script/api/ai/ai_waypoint.hpp.sq" +#include "../script/api/ai/ai_waypointlist.hpp.sq" #include "../company_base.h" #include "../company_func.h" diff --git a/src/script/api/ai/ai_accounting.hpp.sq b/src/script/api/ai/ai_accounting.hpp.sq new file mode 100644 index 0000000000..fd68e4e7e7 --- /dev/null +++ b/src/script/api/ai/ai_accounting.hpp.sq @@ -0,0 +1,28 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_accounting.hpp" +#include "../template/template_accounting.hpp.sq" + + +template <> const char *GetClassName() { return "AIAccounting"; } + +void SQAIAccounting_Register(Squirrel *engine) +{ + DefSQClass SQAIAccounting("AIAccounting"); + SQAIAccounting.PreRegister(engine); + SQAIAccounting.AddConstructor(engine, "x"); + + SQAIAccounting.DefSQMethod(engine, &ScriptAccounting::GetCosts, "GetCosts", 1, "x"); + SQAIAccounting.DefSQMethod(engine, &ScriptAccounting::ResetCosts, "ResetCosts", 1, "x"); + + SQAIAccounting.PostRegister(engine); +} diff --git a/src/ai/api/ai_airport.hpp.sq b/src/script/api/ai/ai_airport.hpp.sq similarity index 65% rename from src/ai/api/ai_airport.hpp.sq rename to src/script/api/ai/ai_airport.hpp.sq index 413244d30d..961d3cdebb 100644 --- a/src/ai/api/ai_airport.hpp.sq +++ b/src/script/api/ai/ai_airport.hpp.sq @@ -9,22 +9,9 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_airport.hpp" +#include "../script_airport.hpp" +#include "../template/template_airport.hpp.sq" -namespace SQConvert { - /* Allow enums to be used as Squirrel parameters */ - template <> inline ScriptAirport::AirportType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptAirport::AirportType)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptAirport::AirportType res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptAirport::PlaneType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptAirport::PlaneType)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptAirport::PlaneType res) { sq_pushinteger(vm, (int32)res); return 1; } - - /* Allow ScriptAirport to be used as Squirrel parameter */ - template <> inline ScriptAirport *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptAirport *)instance; } - template <> inline ScriptAirport &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptAirport *)instance; } - template <> inline const ScriptAirport *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptAirport *)instance; } - template <> inline const ScriptAirport &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptAirport *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptAirport *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Airport", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AIAirport"; } diff --git a/src/script/api/ai/ai_base.hpp.sq b/src/script/api/ai/ai_base.hpp.sq new file mode 100644 index 0000000000..68cc4a58e2 --- /dev/null +++ b/src/script/api/ai/ai_base.hpp.sq @@ -0,0 +1,32 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_base.hpp" +#include "../template/template_base.hpp.sq" + + +template <> const char *GetClassName() { return "AIBase"; } + +void SQAIBase_Register(Squirrel *engine) +{ + DefSQClass SQAIBase("AIBase"); + SQAIBase.PreRegister(engine); + SQAIBase.AddConstructor(engine, "x"); + + SQAIBase.DefSQStaticMethod(engine, &ScriptBase::Rand, "Rand", 1, "."); + SQAIBase.DefSQStaticMethod(engine, &ScriptBase::RandItem, "RandItem", 2, ".i"); + SQAIBase.DefSQStaticMethod(engine, &ScriptBase::RandRange, "RandRange", 2, ".i"); + SQAIBase.DefSQStaticMethod(engine, &ScriptBase::RandRangeItem, "RandRangeItem", 3, ".ii"); + SQAIBase.DefSQStaticMethod(engine, &ScriptBase::Chance, "Chance", 3, ".ii"); + SQAIBase.DefSQStaticMethod(engine, &ScriptBase::ChanceItem, "ChanceItem", 4, ".iii"); + + SQAIBase.PostRegister(engine); +} diff --git a/src/script/api/ai/ai_basestation.hpp.sq b/src/script/api/ai/ai_basestation.hpp.sq new file mode 100644 index 0000000000..42cc184609 --- /dev/null +++ b/src/script/api/ai/ai_basestation.hpp.sq @@ -0,0 +1,35 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_basestation.hpp" +#include "../template/template_basestation.hpp.sq" + + +template <> const char *GetClassName() { return "AIBaseStation"; } + +void SQAIBaseStation_Register(Squirrel *engine) +{ + DefSQClass SQAIBaseStation("AIBaseStation"); + SQAIBaseStation.PreRegister(engine); + SQAIBaseStation.AddConstructor(engine, "x"); + + SQAIBaseStation.DefSQConst(engine, ScriptBaseStation::STATION_NEW, "STATION_NEW"); + SQAIBaseStation.DefSQConst(engine, ScriptBaseStation::STATION_JOIN_ADJACENT, "STATION_JOIN_ADJACENT"); + SQAIBaseStation.DefSQConst(engine, ScriptBaseStation::STATION_INVALID, "STATION_INVALID"); + + SQAIBaseStation.DefSQStaticMethod(engine, &ScriptBaseStation::IsValidBaseStation, "IsValidBaseStation", 2, ".i"); + SQAIBaseStation.DefSQStaticMethod(engine, &ScriptBaseStation::GetName, "GetName", 2, ".i"); + SQAIBaseStation.DefSQStaticMethod(engine, &ScriptBaseStation::SetName, "SetName", 3, ".i."); + SQAIBaseStation.DefSQStaticMethod(engine, &ScriptBaseStation::GetLocation, "GetLocation", 2, ".i"); + SQAIBaseStation.DefSQStaticMethod(engine, &ScriptBaseStation::GetConstructionDate, "GetConstructionDate", 2, ".i"); + + SQAIBaseStation.PostRegister(engine); +} diff --git a/src/ai/api/ai_bridge.hpp.sq b/src/script/api/ai/ai_bridge.hpp.sq similarity index 64% rename from src/ai/api/ai_bridge.hpp.sq rename to src/script/api/ai/ai_bridge.hpp.sq index 00aa16a378..d09f56421b 100644 --- a/src/ai/api/ai_bridge.hpp.sq +++ b/src/script/api/ai/ai_bridge.hpp.sq @@ -9,20 +9,9 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_bridge.hpp" +#include "../script_bridge.hpp" +#include "../template/template_bridge.hpp.sq" -namespace SQConvert { - /* Allow enums to be used as Squirrel parameters */ - template <> inline ScriptBridge::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptBridge::ErrorMessages)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptBridge::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } - - /* Allow ScriptBridge to be used as Squirrel parameter */ - template <> inline ScriptBridge *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptBridge *)instance; } - template <> inline ScriptBridge &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptBridge *)instance; } - template <> inline const ScriptBridge *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptBridge *)instance; } - template <> inline const ScriptBridge &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptBridge *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptBridge *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Bridge", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AIBridge"; } diff --git a/src/script/api/ai/ai_bridgelist.hpp.sq b/src/script/api/ai/ai_bridgelist.hpp.sq new file mode 100644 index 0000000000..b5618e3337 --- /dev/null +++ b/src/script/api/ai/ai_bridgelist.hpp.sq @@ -0,0 +1,37 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_bridgelist.hpp" +#include "../template/template_bridgelist.hpp.sq" + + +template <> const char *GetClassName() { return "AIBridgeList"; } + +void SQAIBridgeList_Register(Squirrel *engine) +{ + DefSQClass SQAIBridgeList("AIBridgeList"); + SQAIBridgeList.PreRegister(engine, "AIList"); + SQAIBridgeList.AddConstructor(engine, "x"); + + SQAIBridgeList.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIBridgeList_Length"; } + +void SQAIBridgeList_Length_Register(Squirrel *engine) +{ + DefSQClass SQAIBridgeList_Length("AIBridgeList_Length"); + SQAIBridgeList_Length.PreRegister(engine, "AIList"); + SQAIBridgeList_Length.AddConstructor(engine, "xi"); + + SQAIBridgeList_Length.PostRegister(engine); +} diff --git a/src/script/api/ai/ai_cargo.hpp.sq b/src/script/api/ai/ai_cargo.hpp.sq new file mode 100644 index 0000000000..c658721264 --- /dev/null +++ b/src/script/api/ai/ai_cargo.hpp.sq @@ -0,0 +1,52 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_cargo.hpp" +#include "../template/template_cargo.hpp.sq" + + +template <> const char *GetClassName() { return "AICargo"; } + +void SQAICargo_Register(Squirrel *engine) +{ + DefSQClass SQAICargo("AICargo"); + SQAICargo.PreRegister(engine); + SQAICargo.AddConstructor(engine, "x"); + + SQAICargo.DefSQConst(engine, ScriptCargo::CC_PASSENGERS, "CC_PASSENGERS"); + SQAICargo.DefSQConst(engine, ScriptCargo::CC_MAIL, "CC_MAIL"); + SQAICargo.DefSQConst(engine, ScriptCargo::CC_EXPRESS, "CC_EXPRESS"); + SQAICargo.DefSQConst(engine, ScriptCargo::CC_ARMOURED, "CC_ARMOURED"); + SQAICargo.DefSQConst(engine, ScriptCargo::CC_BULK, "CC_BULK"); + SQAICargo.DefSQConst(engine, ScriptCargo::CC_PIECE_GOODS, "CC_PIECE_GOODS"); + SQAICargo.DefSQConst(engine, ScriptCargo::CC_LIQUID, "CC_LIQUID"); + SQAICargo.DefSQConst(engine, ScriptCargo::CC_REFRIGERATED, "CC_REFRIGERATED"); + SQAICargo.DefSQConst(engine, ScriptCargo::CC_HAZARDOUS, "CC_HAZARDOUS"); + SQAICargo.DefSQConst(engine, ScriptCargo::CC_COVERED, "CC_COVERED"); + SQAICargo.DefSQConst(engine, ScriptCargo::TE_NONE, "TE_NONE"); + SQAICargo.DefSQConst(engine, ScriptCargo::TE_PASSENGERS, "TE_PASSENGERS"); + SQAICargo.DefSQConst(engine, ScriptCargo::TE_MAIL, "TE_MAIL"); + SQAICargo.DefSQConst(engine, ScriptCargo::TE_GOODS, "TE_GOODS"); + SQAICargo.DefSQConst(engine, ScriptCargo::TE_WATER, "TE_WATER"); + SQAICargo.DefSQConst(engine, ScriptCargo::TE_FOOD, "TE_FOOD"); + SQAICargo.DefSQConst(engine, ScriptCargo::CT_AUTO_REFIT, "CT_AUTO_REFIT"); + SQAICargo.DefSQConst(engine, ScriptCargo::CT_NO_REFIT, "CT_NO_REFIT"); + + SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::IsValidCargo, "IsValidCargo", 2, ".i"); + SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::IsValidTownEffect, "IsValidTownEffect", 2, ".i"); + SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::GetCargoLabel, "GetCargoLabel", 2, ".i"); + SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::IsFreight, "IsFreight", 2, ".i"); + SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::HasCargoClass, "HasCargoClass", 3, ".ii"); + SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::GetTownEffect, "GetTownEffect", 2, ".i"); + SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::GetCargoIncome, "GetCargoIncome", 4, ".iii"); + + SQAICargo.PostRegister(engine); +} diff --git a/src/script/api/ai/ai_cargolist.hpp.sq b/src/script/api/ai/ai_cargolist.hpp.sq new file mode 100644 index 0000000000..cc1bbc6a28 --- /dev/null +++ b/src/script/api/ai/ai_cargolist.hpp.sq @@ -0,0 +1,61 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_cargolist.hpp" +#include "../template/template_cargolist.hpp.sq" + + +template <> const char *GetClassName() { return "AICargoList"; } + +void SQAICargoList_Register(Squirrel *engine) +{ + DefSQClass SQAICargoList("AICargoList"); + SQAICargoList.PreRegister(engine, "AIList"); + SQAICargoList.AddConstructor(engine, "x"); + + SQAICargoList.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AICargoList_IndustryAccepting"; } + +void SQAICargoList_IndustryAccepting_Register(Squirrel *engine) +{ + DefSQClass SQAICargoList_IndustryAccepting("AICargoList_IndustryAccepting"); + SQAICargoList_IndustryAccepting.PreRegister(engine, "AIList"); + SQAICargoList_IndustryAccepting.AddConstructor(engine, "xi"); + + SQAICargoList_IndustryAccepting.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AICargoList_IndustryProducing"; } + +void SQAICargoList_IndustryProducing_Register(Squirrel *engine) +{ + DefSQClass SQAICargoList_IndustryProducing("AICargoList_IndustryProducing"); + SQAICargoList_IndustryProducing.PreRegister(engine, "AIList"); + SQAICargoList_IndustryProducing.AddConstructor(engine, "xi"); + + SQAICargoList_IndustryProducing.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AICargoList_StationAccepting"; } + +void SQAICargoList_StationAccepting_Register(Squirrel *engine) +{ + DefSQClass SQAICargoList_StationAccepting("AICargoList_StationAccepting"); + SQAICargoList_StationAccepting.PreRegister(engine, "AIList"); + SQAICargoList_StationAccepting.AddConstructor(engine, "xi"); + + SQAICargoList_StationAccepting.PostRegister(engine); +} diff --git a/src/ai/api/ai_company.hpp.sq b/src/script/api/ai/ai_company.hpp.sq similarity index 67% rename from src/ai/api/ai_company.hpp.sq rename to src/script/api/ai/ai_company.hpp.sq index ffc1fc7bb3..a68cf5d7f2 100644 --- a/src/ai/api/ai_company.hpp.sq +++ b/src/script/api/ai/ai_company.hpp.sq @@ -9,24 +9,9 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_company.hpp" +#include "../script_company.hpp" +#include "../template/template_company.hpp.sq" -namespace SQConvert { - /* Allow enums to be used as Squirrel parameters */ - template <> inline ScriptCompany::Quarter GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptCompany::Quarter)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptCompany::Quarter res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptCompany::CompanyID GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptCompany::CompanyID)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptCompany::CompanyID res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptCompany::Gender GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptCompany::Gender)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptCompany::Gender res) { sq_pushinteger(vm, (int32)res); return 1; } - - /* Allow ScriptCompany to be used as Squirrel parameter */ - template <> inline ScriptCompany *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptCompany *)instance; } - template <> inline ScriptCompany &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptCompany *)instance; } - template <> inline const ScriptCompany *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptCompany *)instance; } - template <> inline const ScriptCompany &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptCompany *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptCompany *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Company", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AICompany"; } diff --git a/src/ai/api/ai_controller.hpp.sq b/src/script/api/ai/ai_controller.hpp.sq similarity index 97% rename from src/ai/api/ai_controller.hpp.sq rename to src/script/api/ai/ai_controller.hpp.sq index a250f541f2..57f8e7b602 100644 --- a/src/ai/api/ai_controller.hpp.sq +++ b/src/script/api/ai/ai_controller.hpp.sq @@ -7,7 +7,7 @@ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . */ -#include "../../script/api/script_controller.hpp" +#include "../script_controller.hpp" template <> const char *GetClassName() { return "AIController"; } diff --git a/src/script/api/ai/ai_date.hpp.sq b/src/script/api/ai/ai_date.hpp.sq new file mode 100644 index 0000000000..3210a6950f --- /dev/null +++ b/src/script/api/ai/ai_date.hpp.sq @@ -0,0 +1,31 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_date.hpp" +#include "../template/template_date.hpp.sq" + + +template <> const char *GetClassName() { return "AIDate"; } + +void SQAIDate_Register(Squirrel *engine) +{ + DefSQClass SQAIDate("AIDate"); + SQAIDate.PreRegister(engine); + SQAIDate.AddConstructor(engine, "x"); + + SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetCurrentDate, "GetCurrentDate", 1, "."); + SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetYear, "GetYear", 2, ".i"); + SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetMonth, "GetMonth", 2, ".i"); + SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetDayOfMonth, "GetDayOfMonth", 2, ".i"); + SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetDate, "GetDate", 4, ".iii"); + + SQAIDate.PostRegister(engine); +} diff --git a/src/script/api/ai/ai_depotlist.hpp.sq b/src/script/api/ai/ai_depotlist.hpp.sq new file mode 100644 index 0000000000..528683ce37 --- /dev/null +++ b/src/script/api/ai/ai_depotlist.hpp.sq @@ -0,0 +1,25 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_depotlist.hpp" +#include "../template/template_depotlist.hpp.sq" + + +template <> const char *GetClassName() { return "AIDepotList"; } + +void SQAIDepotList_Register(Squirrel *engine) +{ + DefSQClass SQAIDepotList("AIDepotList"); + SQAIDepotList.PreRegister(engine, "AIList"); + SQAIDepotList.AddConstructor(engine, "xi"); + + SQAIDepotList.PostRegister(engine); +} diff --git a/src/ai/api/ai_engine.hpp.sq b/src/script/api/ai/ai_engine.hpp.sq similarity index 72% rename from src/ai/api/ai_engine.hpp.sq rename to src/script/api/ai/ai_engine.hpp.sq index 7fc612323b..676435852a 100644 --- a/src/ai/api/ai_engine.hpp.sq +++ b/src/script/api/ai/ai_engine.hpp.sq @@ -9,16 +9,9 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_engine.hpp" +#include "../script_engine.hpp" +#include "../template/template_engine.hpp.sq" -namespace SQConvert { - /* Allow ScriptEngine to be used as Squirrel parameter */ - template <> inline ScriptEngine *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEngine *)instance; } - template <> inline ScriptEngine &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEngine *)instance; } - template <> inline const ScriptEngine *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEngine *)instance; } - template <> inline const ScriptEngine &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEngine *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptEngine *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Engine", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AIEngine"; } diff --git a/src/script/api/ai/ai_enginelist.hpp.sq b/src/script/api/ai/ai_enginelist.hpp.sq new file mode 100644 index 0000000000..8ddc2e7ad1 --- /dev/null +++ b/src/script/api/ai/ai_enginelist.hpp.sq @@ -0,0 +1,25 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_enginelist.hpp" +#include "../template/template_enginelist.hpp.sq" + + +template <> const char *GetClassName() { return "AIEngineList"; } + +void SQAIEngineList_Register(Squirrel *engine) +{ + DefSQClass SQAIEngineList("AIEngineList"); + SQAIEngineList.PreRegister(engine, "AIList"); + SQAIEngineList.AddConstructor(engine, "xi"); + + SQAIEngineList.PostRegister(engine); +} diff --git a/src/ai/api/ai_error.hpp.sq b/src/script/api/ai/ai_error.hpp.sq similarity index 82% rename from src/ai/api/ai_error.hpp.sq rename to src/script/api/ai/ai_error.hpp.sq index a1b35956ab..b0f48033a7 100644 --- a/src/ai/api/ai_error.hpp.sq +++ b/src/script/api/ai/ai_error.hpp.sq @@ -9,22 +9,9 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_error.hpp" +#include "../script_error.hpp" +#include "../template/template_error.hpp.sq" -namespace SQConvert { - /* Allow enums to be used as Squirrel parameters */ - template <> inline ScriptError::ErrorCategories GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptError::ErrorCategories)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptError::ErrorCategories res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptError::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptError::ErrorMessages)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptError::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } - - /* Allow ScriptError to be used as Squirrel parameter */ - template <> inline ScriptError *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptError *)instance; } - template <> inline ScriptError &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptError *)instance; } - template <> inline const ScriptError *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptError *)instance; } - template <> inline const ScriptError &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptError *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptError *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Error", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AIError"; } diff --git a/src/ai/api/ai_event.hpp.sq b/src/script/api/ai/ai_event.hpp.sq similarity index 56% rename from src/ai/api/ai_event.hpp.sq rename to src/script/api/ai/ai_event.hpp.sq index 1859ff30ba..b30e38e194 100644 --- a/src/ai/api/ai_event.hpp.sq +++ b/src/script/api/ai/ai_event.hpp.sq @@ -9,20 +9,9 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_event.hpp" +#include "../script_event.hpp" +#include "../template/template_event.hpp.sq" -namespace SQConvert { - /* Allow enums to be used as Squirrel parameters */ - template <> inline ScriptEvent::ScriptEventType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptEvent::ScriptEventType)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptEvent::ScriptEventType res) { sq_pushinteger(vm, (int32)res); return 1; } - - /* Allow ScriptEvent to be used as Squirrel parameter */ - template <> inline ScriptEvent *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEvent *)instance; } - template <> inline ScriptEvent &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEvent *)instance; } - template <> inline const ScriptEvent *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEvent *)instance; } - template <> inline const ScriptEvent &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEvent *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptEvent *res) { if (res == NULL) { sq_pushnull(vm); return 1; } Squirrel::CreateClassInstanceVM(vm, "Event", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AIEvent"; } @@ -61,14 +50,6 @@ void SQAIEvent_Register(Squirrel *engine) SQAIEvent.PostRegister(engine); } -namespace SQConvert { - /* Allow ScriptEventController to be used as Squirrel parameter */ - template <> inline ScriptEventController *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventController *)instance; } - template <> inline ScriptEventController &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventController *)instance; } - template <> inline const ScriptEventController *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventController *)instance; } - template <> inline const ScriptEventController &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventController *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptEventController *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventController", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AIEventController"; } diff --git a/src/script/api/ai/ai_event_types.hpp.sq b/src/script/api/ai/ai_event_types.hpp.sq new file mode 100644 index 0000000000..5bdbaccf1c --- /dev/null +++ b/src/script/api/ai/ai_event_types.hpp.sq @@ -0,0 +1,348 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_event_types.hpp" +#include "../template/template_event_types.hpp.sq" + + +template <> const char *GetClassName() { return "AIEventVehicleCrashed"; } + +void SQAIEventVehicleCrashed_Register(Squirrel *engine) +{ + DefSQClass SQAIEventVehicleCrashed("AIEventVehicleCrashed"); + SQAIEventVehicleCrashed.PreRegister(engine, "AIEvent"); + + SQAIEventVehicleCrashed.DefSQConst(engine, ScriptEventVehicleCrashed::CRASH_TRAIN, "CRASH_TRAIN"); + SQAIEventVehicleCrashed.DefSQConst(engine, ScriptEventVehicleCrashed::CRASH_RV_LEVEL_CROSSING, "CRASH_RV_LEVEL_CROSSING"); + SQAIEventVehicleCrashed.DefSQConst(engine, ScriptEventVehicleCrashed::CRASH_RV_UFO, "CRASH_RV_UFO"); + SQAIEventVehicleCrashed.DefSQConst(engine, ScriptEventVehicleCrashed::CRASH_PLANE_LANDING, "CRASH_PLANE_LANDING"); + SQAIEventVehicleCrashed.DefSQConst(engine, ScriptEventVehicleCrashed::CRASH_AIRCRAFT_NO_AIRPORT, "CRASH_AIRCRAFT_NO_AIRPORT"); + SQAIEventVehicleCrashed.DefSQConst(engine, ScriptEventVehicleCrashed::CRASH_FLOODED, "CRASH_FLOODED"); + + SQAIEventVehicleCrashed.DefSQStaticMethod(engine, &ScriptEventVehicleCrashed::Convert, "Convert", 2, ".x"); + + SQAIEventVehicleCrashed.DefSQMethod(engine, &ScriptEventVehicleCrashed::GetVehicleID, "GetVehicleID", 1, "x"); + SQAIEventVehicleCrashed.DefSQMethod(engine, &ScriptEventVehicleCrashed::GetCrashSite, "GetCrashSite", 1, "x"); + SQAIEventVehicleCrashed.DefSQMethod(engine, &ScriptEventVehicleCrashed::GetCrashReason, "GetCrashReason", 1, "x"); + + SQAIEventVehicleCrashed.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIEventSubsidyOffer"; } + +void SQAIEventSubsidyOffer_Register(Squirrel *engine) +{ + DefSQClass SQAIEventSubsidyOffer("AIEventSubsidyOffer"); + SQAIEventSubsidyOffer.PreRegister(engine, "AIEvent"); + + SQAIEventSubsidyOffer.DefSQStaticMethod(engine, &ScriptEventSubsidyOffer::Convert, "Convert", 2, ".x"); + + SQAIEventSubsidyOffer.DefSQMethod(engine, &ScriptEventSubsidyOffer::GetSubsidyID, "GetSubsidyID", 1, "x"); + + SQAIEventSubsidyOffer.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIEventSubsidyOfferExpired"; } + +void SQAIEventSubsidyOfferExpired_Register(Squirrel *engine) +{ + DefSQClass SQAIEventSubsidyOfferExpired("AIEventSubsidyOfferExpired"); + SQAIEventSubsidyOfferExpired.PreRegister(engine, "AIEvent"); + + SQAIEventSubsidyOfferExpired.DefSQStaticMethod(engine, &ScriptEventSubsidyOfferExpired::Convert, "Convert", 2, ".x"); + + SQAIEventSubsidyOfferExpired.DefSQMethod(engine, &ScriptEventSubsidyOfferExpired::GetSubsidyID, "GetSubsidyID", 1, "x"); + + SQAIEventSubsidyOfferExpired.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIEventSubsidyAwarded"; } + +void SQAIEventSubsidyAwarded_Register(Squirrel *engine) +{ + DefSQClass SQAIEventSubsidyAwarded("AIEventSubsidyAwarded"); + SQAIEventSubsidyAwarded.PreRegister(engine, "AIEvent"); + + SQAIEventSubsidyAwarded.DefSQStaticMethod(engine, &ScriptEventSubsidyAwarded::Convert, "Convert", 2, ".x"); + + SQAIEventSubsidyAwarded.DefSQMethod(engine, &ScriptEventSubsidyAwarded::GetSubsidyID, "GetSubsidyID", 1, "x"); + + SQAIEventSubsidyAwarded.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIEventSubsidyExpired"; } + +void SQAIEventSubsidyExpired_Register(Squirrel *engine) +{ + DefSQClass SQAIEventSubsidyExpired("AIEventSubsidyExpired"); + SQAIEventSubsidyExpired.PreRegister(engine, "AIEvent"); + + SQAIEventSubsidyExpired.DefSQStaticMethod(engine, &ScriptEventSubsidyExpired::Convert, "Convert", 2, ".x"); + + SQAIEventSubsidyExpired.DefSQMethod(engine, &ScriptEventSubsidyExpired::GetSubsidyID, "GetSubsidyID", 1, "x"); + + SQAIEventSubsidyExpired.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIEventEnginePreview"; } + +void SQAIEventEnginePreview_Register(Squirrel *engine) +{ + DefSQClass SQAIEventEnginePreview("AIEventEnginePreview"); + SQAIEventEnginePreview.PreRegister(engine, "AIEvent"); + + SQAIEventEnginePreview.DefSQStaticMethod(engine, &ScriptEventEnginePreview::Convert, "Convert", 2, ".x"); + + SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetName, "GetName", 1, "x"); + SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetCargoType, "GetCargoType", 1, "x"); + SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetCapacity, "GetCapacity", 1, "x"); + SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetMaxSpeed, "GetMaxSpeed", 1, "x"); + SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetPrice, "GetPrice", 1, "x"); + SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetRunningCost, "GetRunningCost", 1, "x"); + SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetVehicleType, "GetVehicleType", 1, "x"); + SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::AcceptPreview, "AcceptPreview", 1, "x"); + + SQAIEventEnginePreview.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIEventCompanyNew"; } + +void SQAIEventCompanyNew_Register(Squirrel *engine) +{ + DefSQClass SQAIEventCompanyNew("AIEventCompanyNew"); + SQAIEventCompanyNew.PreRegister(engine, "AIEvent"); + + SQAIEventCompanyNew.DefSQStaticMethod(engine, &ScriptEventCompanyNew::Convert, "Convert", 2, ".x"); + + SQAIEventCompanyNew.DefSQMethod(engine, &ScriptEventCompanyNew::GetCompanyID, "GetCompanyID", 1, "x"); + + SQAIEventCompanyNew.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIEventCompanyInTrouble"; } + +void SQAIEventCompanyInTrouble_Register(Squirrel *engine) +{ + DefSQClass SQAIEventCompanyInTrouble("AIEventCompanyInTrouble"); + SQAIEventCompanyInTrouble.PreRegister(engine, "AIEvent"); + + SQAIEventCompanyInTrouble.DefSQStaticMethod(engine, &ScriptEventCompanyInTrouble::Convert, "Convert", 2, ".x"); + + SQAIEventCompanyInTrouble.DefSQMethod(engine, &ScriptEventCompanyInTrouble::GetCompanyID, "GetCompanyID", 1, "x"); + + SQAIEventCompanyInTrouble.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIEventCompanyAskMerger"; } + +void SQAIEventCompanyAskMerger_Register(Squirrel *engine) +{ + DefSQClass SQAIEventCompanyAskMerger("AIEventCompanyAskMerger"); + SQAIEventCompanyAskMerger.PreRegister(engine, "AIEvent"); + + SQAIEventCompanyAskMerger.DefSQStaticMethod(engine, &ScriptEventCompanyAskMerger::Convert, "Convert", 2, ".x"); + + SQAIEventCompanyAskMerger.DefSQMethod(engine, &ScriptEventCompanyAskMerger::GetCompanyID, "GetCompanyID", 1, "x"); + SQAIEventCompanyAskMerger.DefSQMethod(engine, &ScriptEventCompanyAskMerger::GetValue, "GetValue", 1, "x"); + SQAIEventCompanyAskMerger.DefSQMethod(engine, &ScriptEventCompanyAskMerger::AcceptMerger, "AcceptMerger", 1, "x"); + + SQAIEventCompanyAskMerger.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIEventCompanyMerger"; } + +void SQAIEventCompanyMerger_Register(Squirrel *engine) +{ + DefSQClass SQAIEventCompanyMerger("AIEventCompanyMerger"); + SQAIEventCompanyMerger.PreRegister(engine, "AIEvent"); + + SQAIEventCompanyMerger.DefSQStaticMethod(engine, &ScriptEventCompanyMerger::Convert, "Convert", 2, ".x"); + + SQAIEventCompanyMerger.DefSQMethod(engine, &ScriptEventCompanyMerger::GetOldCompanyID, "GetOldCompanyID", 1, "x"); + SQAIEventCompanyMerger.DefSQMethod(engine, &ScriptEventCompanyMerger::GetNewCompanyID, "GetNewCompanyID", 1, "x"); + + SQAIEventCompanyMerger.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIEventCompanyBankrupt"; } + +void SQAIEventCompanyBankrupt_Register(Squirrel *engine) +{ + DefSQClass SQAIEventCompanyBankrupt("AIEventCompanyBankrupt"); + SQAIEventCompanyBankrupt.PreRegister(engine, "AIEvent"); + + SQAIEventCompanyBankrupt.DefSQStaticMethod(engine, &ScriptEventCompanyBankrupt::Convert, "Convert", 2, ".x"); + + SQAIEventCompanyBankrupt.DefSQMethod(engine, &ScriptEventCompanyBankrupt::GetCompanyID, "GetCompanyID", 1, "x"); + + SQAIEventCompanyBankrupt.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIEventVehicleLost"; } + +void SQAIEventVehicleLost_Register(Squirrel *engine) +{ + DefSQClass SQAIEventVehicleLost("AIEventVehicleLost"); + SQAIEventVehicleLost.PreRegister(engine, "AIEvent"); + + SQAIEventVehicleLost.DefSQStaticMethod(engine, &ScriptEventVehicleLost::Convert, "Convert", 2, ".x"); + + SQAIEventVehicleLost.DefSQMethod(engine, &ScriptEventVehicleLost::GetVehicleID, "GetVehicleID", 1, "x"); + + SQAIEventVehicleLost.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIEventVehicleWaitingInDepot"; } + +void SQAIEventVehicleWaitingInDepot_Register(Squirrel *engine) +{ + DefSQClass SQAIEventVehicleWaitingInDepot("AIEventVehicleWaitingInDepot"); + SQAIEventVehicleWaitingInDepot.PreRegister(engine, "AIEvent"); + + SQAIEventVehicleWaitingInDepot.DefSQStaticMethod(engine, &ScriptEventVehicleWaitingInDepot::Convert, "Convert", 2, ".x"); + + SQAIEventVehicleWaitingInDepot.DefSQMethod(engine, &ScriptEventVehicleWaitingInDepot::GetVehicleID, "GetVehicleID", 1, "x"); + + SQAIEventVehicleWaitingInDepot.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIEventVehicleUnprofitable"; } + +void SQAIEventVehicleUnprofitable_Register(Squirrel *engine) +{ + DefSQClass SQAIEventVehicleUnprofitable("AIEventVehicleUnprofitable"); + SQAIEventVehicleUnprofitable.PreRegister(engine, "AIEvent"); + + SQAIEventVehicleUnprofitable.DefSQStaticMethod(engine, &ScriptEventVehicleUnprofitable::Convert, "Convert", 2, ".x"); + + SQAIEventVehicleUnprofitable.DefSQMethod(engine, &ScriptEventVehicleUnprofitable::GetVehicleID, "GetVehicleID", 1, "x"); + + SQAIEventVehicleUnprofitable.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIEventIndustryOpen"; } + +void SQAIEventIndustryOpen_Register(Squirrel *engine) +{ + DefSQClass SQAIEventIndustryOpen("AIEventIndustryOpen"); + SQAIEventIndustryOpen.PreRegister(engine, "AIEvent"); + + SQAIEventIndustryOpen.DefSQStaticMethod(engine, &ScriptEventIndustryOpen::Convert, "Convert", 2, ".x"); + + SQAIEventIndustryOpen.DefSQMethod(engine, &ScriptEventIndustryOpen::GetIndustryID, "GetIndustryID", 1, "x"); + + SQAIEventIndustryOpen.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIEventIndustryClose"; } + +void SQAIEventIndustryClose_Register(Squirrel *engine) +{ + DefSQClass SQAIEventIndustryClose("AIEventIndustryClose"); + SQAIEventIndustryClose.PreRegister(engine, "AIEvent"); + + SQAIEventIndustryClose.DefSQStaticMethod(engine, &ScriptEventIndustryClose::Convert, "Convert", 2, ".x"); + + SQAIEventIndustryClose.DefSQMethod(engine, &ScriptEventIndustryClose::GetIndustryID, "GetIndustryID", 1, "x"); + + SQAIEventIndustryClose.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIEventEngineAvailable"; } + +void SQAIEventEngineAvailable_Register(Squirrel *engine) +{ + DefSQClass SQAIEventEngineAvailable("AIEventEngineAvailable"); + SQAIEventEngineAvailable.PreRegister(engine, "AIEvent"); + + SQAIEventEngineAvailable.DefSQStaticMethod(engine, &ScriptEventEngineAvailable::Convert, "Convert", 2, ".x"); + + SQAIEventEngineAvailable.DefSQMethod(engine, &ScriptEventEngineAvailable::GetEngineID, "GetEngineID", 1, "x"); + + SQAIEventEngineAvailable.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIEventStationFirstVehicle"; } + +void SQAIEventStationFirstVehicle_Register(Squirrel *engine) +{ + DefSQClass SQAIEventStationFirstVehicle("AIEventStationFirstVehicle"); + SQAIEventStationFirstVehicle.PreRegister(engine, "AIEvent"); + + SQAIEventStationFirstVehicle.DefSQStaticMethod(engine, &ScriptEventStationFirstVehicle::Convert, "Convert", 2, ".x"); + + SQAIEventStationFirstVehicle.DefSQMethod(engine, &ScriptEventStationFirstVehicle::GetStationID, "GetStationID", 1, "x"); + SQAIEventStationFirstVehicle.DefSQMethod(engine, &ScriptEventStationFirstVehicle::GetVehicleID, "GetVehicleID", 1, "x"); + + SQAIEventStationFirstVehicle.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIEventDisasterZeppelinerCrashed"; } + +void SQAIEventDisasterZeppelinerCrashed_Register(Squirrel *engine) +{ + DefSQClass SQAIEventDisasterZeppelinerCrashed("AIEventDisasterZeppelinerCrashed"); + SQAIEventDisasterZeppelinerCrashed.PreRegister(engine, "AIEvent"); + + SQAIEventDisasterZeppelinerCrashed.DefSQStaticMethod(engine, &ScriptEventDisasterZeppelinerCrashed::Convert, "Convert", 2, ".x"); + + SQAIEventDisasterZeppelinerCrashed.DefSQMethod(engine, &ScriptEventDisasterZeppelinerCrashed::GetStationID, "GetStationID", 1, "x"); + + SQAIEventDisasterZeppelinerCrashed.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIEventDisasterZeppelinerCleared"; } + +void SQAIEventDisasterZeppelinerCleared_Register(Squirrel *engine) +{ + DefSQClass SQAIEventDisasterZeppelinerCleared("AIEventDisasterZeppelinerCleared"); + SQAIEventDisasterZeppelinerCleared.PreRegister(engine, "AIEvent"); + + SQAIEventDisasterZeppelinerCleared.DefSQStaticMethod(engine, &ScriptEventDisasterZeppelinerCleared::Convert, "Convert", 2, ".x"); + + SQAIEventDisasterZeppelinerCleared.DefSQMethod(engine, &ScriptEventDisasterZeppelinerCleared::GetStationID, "GetStationID", 1, "x"); + + SQAIEventDisasterZeppelinerCleared.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIEventTownFounded"; } + +void SQAIEventTownFounded_Register(Squirrel *engine) +{ + DefSQClass SQAIEventTownFounded("AIEventTownFounded"); + SQAIEventTownFounded.PreRegister(engine, "AIEvent"); + + SQAIEventTownFounded.DefSQStaticMethod(engine, &ScriptEventTownFounded::Convert, "Convert", 2, ".x"); + + SQAIEventTownFounded.DefSQMethod(engine, &ScriptEventTownFounded::GetTownID, "GetTownID", 1, "x"); + + SQAIEventTownFounded.PostRegister(engine); +} diff --git a/src/script/api/ai/ai_execmode.hpp.sq b/src/script/api/ai/ai_execmode.hpp.sq new file mode 100644 index 0000000000..869f3fe932 --- /dev/null +++ b/src/script/api/ai/ai_execmode.hpp.sq @@ -0,0 +1,25 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_execmode.hpp" +#include "../template/template_execmode.hpp.sq" + + +template <> const char *GetClassName() { return "AIExecMode"; } + +void SQAIExecMode_Register(Squirrel *engine) +{ + DefSQClass SQAIExecMode("AIExecMode"); + SQAIExecMode.PreRegister(engine); + SQAIExecMode.AddConstructor(engine, "x"); + + SQAIExecMode.PostRegister(engine); +} diff --git a/src/script/api/ai/ai_gamesettings.hpp.sq b/src/script/api/ai/ai_gamesettings.hpp.sq new file mode 100644 index 0000000000..1459b031d7 --- /dev/null +++ b/src/script/api/ai/ai_gamesettings.hpp.sq @@ -0,0 +1,29 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_gamesettings.hpp" +#include "../template/template_gamesettings.hpp.sq" + + +template <> const char *GetClassName() { return "AIGameSettings"; } + +void SQAIGameSettings_Register(Squirrel *engine) +{ + DefSQClass SQAIGameSettings("AIGameSettings"); + SQAIGameSettings.PreRegister(engine); + SQAIGameSettings.AddConstructor(engine, "x"); + + SQAIGameSettings.DefSQStaticMethod(engine, &ScriptGameSettings::IsValid, "IsValid", 2, ".."); + SQAIGameSettings.DefSQStaticMethod(engine, &ScriptGameSettings::GetValue, "GetValue", 2, ".."); + SQAIGameSettings.DefSQStaticMethod(engine, &ScriptGameSettings::IsDisabledVehicleType, "IsDisabledVehicleType", 2, ".i"); + + SQAIGameSettings.PostRegister(engine); +} diff --git a/src/ai/api/ai_group.hpp.sq b/src/script/api/ai/ai_group.hpp.sq similarity index 63% rename from src/ai/api/ai_group.hpp.sq rename to src/script/api/ai/ai_group.hpp.sq index d4e696d5d2..52ade08d56 100644 --- a/src/ai/api/ai_group.hpp.sq +++ b/src/script/api/ai/ai_group.hpp.sq @@ -9,20 +9,9 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_group.hpp" +#include "../script_group.hpp" +#include "../template/template_group.hpp.sq" -namespace SQConvert { - /* Allow enums to be used as Squirrel parameters */ - template <> inline ScriptGroup::GroupID GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptGroup::GroupID)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptGroup::GroupID res) { sq_pushinteger(vm, (int32)res); return 1; } - - /* Allow ScriptGroup to be used as Squirrel parameter */ - template <> inline ScriptGroup *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptGroup *)instance; } - template <> inline ScriptGroup &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptGroup *)instance; } - template <> inline const ScriptGroup *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptGroup *)instance; } - template <> inline const ScriptGroup &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptGroup *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptGroup *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Group", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AIGroup"; } diff --git a/src/script/api/ai/ai_grouplist.hpp.sq b/src/script/api/ai/ai_grouplist.hpp.sq new file mode 100644 index 0000000000..9f9f2dab25 --- /dev/null +++ b/src/script/api/ai/ai_grouplist.hpp.sq @@ -0,0 +1,25 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_grouplist.hpp" +#include "../template/template_grouplist.hpp.sq" + + +template <> const char *GetClassName() { return "AIGroupList"; } + +void SQAIGroupList_Register(Squirrel *engine) +{ + DefSQClass SQAIGroupList("AIGroupList"); + SQAIGroupList.PreRegister(engine, "AIList"); + SQAIGroupList.AddConstructor(engine, "x"); + + SQAIGroupList.PostRegister(engine); +} diff --git a/src/ai/api/ai_industry.hpp.sq b/src/script/api/ai/ai_industry.hpp.sq similarity index 67% rename from src/ai/api/ai_industry.hpp.sq rename to src/script/api/ai/ai_industry.hpp.sq index 11db2f6fb7..4de03f1dab 100644 --- a/src/ai/api/ai_industry.hpp.sq +++ b/src/script/api/ai/ai_industry.hpp.sq @@ -9,20 +9,9 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_industry.hpp" +#include "../script_industry.hpp" +#include "../template/template_industry.hpp.sq" -namespace SQConvert { - /* Allow enums to be used as Squirrel parameters */ - template <> inline ScriptIndustry::CargoAcceptState GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptIndustry::CargoAcceptState)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptIndustry::CargoAcceptState res) { sq_pushinteger(vm, (int32)res); return 1; } - - /* Allow ScriptIndustry to be used as Squirrel parameter */ - template <> inline ScriptIndustry *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptIndustry *)instance; } - template <> inline ScriptIndustry &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustry *)instance; } - template <> inline const ScriptIndustry *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptIndustry *)instance; } - template <> inline const ScriptIndustry &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustry *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptIndustry *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Industry", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AIIndustry"; } diff --git a/src/script/api/ai/ai_industrylist.hpp.sq b/src/script/api/ai/ai_industrylist.hpp.sq new file mode 100644 index 0000000000..0ae7e97799 --- /dev/null +++ b/src/script/api/ai/ai_industrylist.hpp.sq @@ -0,0 +1,49 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_industrylist.hpp" +#include "../template/template_industrylist.hpp.sq" + + +template <> const char *GetClassName() { return "AIIndustryList"; } + +void SQAIIndustryList_Register(Squirrel *engine) +{ + DefSQClass SQAIIndustryList("AIIndustryList"); + SQAIIndustryList.PreRegister(engine, "AIList"); + SQAIIndustryList.AddConstructor(engine, "x"); + + SQAIIndustryList.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIIndustryList_CargoAccepting"; } + +void SQAIIndustryList_CargoAccepting_Register(Squirrel *engine) +{ + DefSQClass SQAIIndustryList_CargoAccepting("AIIndustryList_CargoAccepting"); + SQAIIndustryList_CargoAccepting.PreRegister(engine, "AIList"); + SQAIIndustryList_CargoAccepting.AddConstructor(engine, "xi"); + + SQAIIndustryList_CargoAccepting.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIIndustryList_CargoProducing"; } + +void SQAIIndustryList_CargoProducing_Register(Squirrel *engine) +{ + DefSQClass SQAIIndustryList_CargoProducing("AIIndustryList_CargoProducing"); + SQAIIndustryList_CargoProducing.PreRegister(engine, "AIList"); + SQAIIndustryList_CargoProducing.AddConstructor(engine, "xi"); + + SQAIIndustryList_CargoProducing.PostRegister(engine); +} diff --git a/src/ai/api/ai_industrytype.hpp.sq b/src/script/api/ai/ai_industrytype.hpp.sq similarity index 60% rename from src/ai/api/ai_industrytype.hpp.sq rename to src/script/api/ai/ai_industrytype.hpp.sq index 468b3d829b..fe84b70f96 100644 --- a/src/ai/api/ai_industrytype.hpp.sq +++ b/src/script/api/ai/ai_industrytype.hpp.sq @@ -9,20 +9,9 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_industrytype.hpp" +#include "../script_industrytype.hpp" +#include "../template/template_industrytype.hpp.sq" -namespace SQConvert { - /* Allow enums to be used as Squirrel parameters */ - template <> inline ScriptIndustryType::SpecialIndustryType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptIndustryType::SpecialIndustryType)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptIndustryType::SpecialIndustryType res) { sq_pushinteger(vm, (int32)res); return 1; } - - /* Allow ScriptIndustryType to be used as Squirrel parameter */ - template <> inline ScriptIndustryType *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptIndustryType *)instance; } - template <> inline ScriptIndustryType &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustryType *)instance; } - template <> inline const ScriptIndustryType *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptIndustryType *)instance; } - template <> inline const ScriptIndustryType &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustryType *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptIndustryType *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "IndustryType", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AIIndustryType"; } diff --git a/src/script/api/ai/ai_industrytypelist.hpp.sq b/src/script/api/ai/ai_industrytypelist.hpp.sq new file mode 100644 index 0000000000..6ac836b390 --- /dev/null +++ b/src/script/api/ai/ai_industrytypelist.hpp.sq @@ -0,0 +1,25 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_industrytypelist.hpp" +#include "../template/template_industrytypelist.hpp.sq" + + +template <> const char *GetClassName() { return "AIIndustryTypeList"; } + +void SQAIIndustryTypeList_Register(Squirrel *engine) +{ + DefSQClass SQAIIndustryTypeList("AIIndustryTypeList"); + SQAIIndustryTypeList.PreRegister(engine, "AIList"); + SQAIIndustryTypeList.AddConstructor(engine, "x"); + + SQAIIndustryTypeList.PostRegister(engine); +} diff --git a/src/ai/api/ai_list.hpp.sq b/src/script/api/ai/ai_list.hpp.sq similarity index 70% rename from src/ai/api/ai_list.hpp.sq rename to src/script/api/ai/ai_list.hpp.sq index a44a71293c..db724da831 100644 --- a/src/ai/api/ai_list.hpp.sq +++ b/src/script/api/ai/ai_list.hpp.sq @@ -9,20 +9,9 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_list.hpp" +#include "../script_list.hpp" +#include "../template/template_list.hpp.sq" -namespace SQConvert { - /* Allow enums to be used as Squirrel parameters */ - template <> inline ScriptList::SorterType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptList::SorterType)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptList::SorterType res) { sq_pushinteger(vm, (int32)res); return 1; } - - /* Allow ScriptList to be used as Squirrel parameter */ - template <> inline ScriptList *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptList *)instance; } - template <> inline ScriptList &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptList *)instance; } - template <> inline const ScriptList *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptList *)instance; } - template <> inline const ScriptList &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptList *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "List", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AIList"; } diff --git a/src/script/api/ai/ai_log.hpp.sq b/src/script/api/ai/ai_log.hpp.sq new file mode 100644 index 0000000000..174ac2b929 --- /dev/null +++ b/src/script/api/ai/ai_log.hpp.sq @@ -0,0 +1,29 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_log.hpp" +#include "../template/template_log.hpp.sq" + + +template <> const char *GetClassName() { return "AILog"; } + +void SQAILog_Register(Squirrel *engine) +{ + DefSQClass SQAILog("AILog"); + SQAILog.PreRegister(engine); + SQAILog.AddConstructor(engine, "x"); + + SQAILog.DefSQStaticMethod(engine, &ScriptLog::Info, "Info", 2, ".."); + SQAILog.DefSQStaticMethod(engine, &ScriptLog::Warning, "Warning", 2, ".."); + SQAILog.DefSQStaticMethod(engine, &ScriptLog::Error, "Error", 2, ".."); + + SQAILog.PostRegister(engine); +} diff --git a/src/ai/api/ai_map.hpp.sq b/src/script/api/ai/ai_map.hpp.sq similarity index 61% rename from src/ai/api/ai_map.hpp.sq rename to src/script/api/ai/ai_map.hpp.sq index 098c24773f..f0f1cbed0c 100644 --- a/src/ai/api/ai_map.hpp.sq +++ b/src/script/api/ai/ai_map.hpp.sq @@ -9,16 +9,9 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_map.hpp" +#include "../script_map.hpp" +#include "../template/template_map.hpp.sq" -namespace SQConvert { - /* Allow ScriptMap to be used as Squirrel parameter */ - template <> inline ScriptMap *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptMap *)instance; } - template <> inline ScriptMap &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptMap *)instance; } - template <> inline const ScriptMap *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptMap *)instance; } - template <> inline const ScriptMap &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptMap *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptMap *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Map", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AIMap"; } diff --git a/src/ai/api/ai_marine.hpp.sq b/src/script/api/ai/ai_marine.hpp.sq similarity index 62% rename from src/ai/api/ai_marine.hpp.sq rename to src/script/api/ai/ai_marine.hpp.sq index 9313764552..843c3d8746 100644 --- a/src/ai/api/ai_marine.hpp.sq +++ b/src/script/api/ai/ai_marine.hpp.sq @@ -9,22 +9,9 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_marine.hpp" +#include "../script_marine.hpp" +#include "../template/template_marine.hpp.sq" -namespace SQConvert { - /* Allow enums to be used as Squirrel parameters */ - template <> inline ScriptMarine::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptMarine::ErrorMessages)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptMarine::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptMarine::BuildType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptMarine::BuildType)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptMarine::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; } - - /* Allow ScriptMarine to be used as Squirrel parameter */ - template <> inline ScriptMarine *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptMarine *)instance; } - template <> inline ScriptMarine &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptMarine *)instance; } - template <> inline const ScriptMarine *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptMarine *)instance; } - template <> inline const ScriptMarine &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptMarine *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptMarine *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Marine", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AIMarine"; } diff --git a/src/ai/api/ai_order.hpp.sq b/src/script/api/ai/ai_order.hpp.sq similarity index 74% rename from src/ai/api/ai_order.hpp.sq rename to src/script/api/ai/ai_order.hpp.sq index c9a5ce6a00..006424572d 100644 --- a/src/ai/api/ai_order.hpp.sq +++ b/src/script/api/ai/ai_order.hpp.sq @@ -9,30 +9,9 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_order.hpp" +#include "../script_order.hpp" +#include "../template/template_order.hpp.sq" -namespace SQConvert { - /* Allow enums to be used as Squirrel parameters */ - template <> inline ScriptOrder::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptOrder::ErrorMessages)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptOrder::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptOrder::ScriptOrderFlags GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptOrder::ScriptOrderFlags)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptOrder::ScriptOrderFlags res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptOrder::OrderCondition GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptOrder::OrderCondition)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptOrder::OrderCondition res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptOrder::CompareFunction GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptOrder::CompareFunction)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptOrder::CompareFunction res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptOrder::OrderPosition GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptOrder::OrderPosition)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptOrder::OrderPosition res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptOrder::StopLocation GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptOrder::StopLocation)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptOrder::StopLocation res) { sq_pushinteger(vm, (int32)res); return 1; } - - /* Allow ScriptOrder to be used as Squirrel parameter */ - template <> inline ScriptOrder *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptOrder *)instance; } - template <> inline ScriptOrder &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptOrder *)instance; } - template <> inline const ScriptOrder *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptOrder *)instance; } - template <> inline const ScriptOrder &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptOrder *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptOrder *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Order", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AIOrder"; } diff --git a/src/ai/api/ai_rail.hpp.sq b/src/script/api/ai/ai_rail.hpp.sq similarity index 72% rename from src/ai/api/ai_rail.hpp.sq rename to src/script/api/ai/ai_rail.hpp.sq index 84df36e104..85d15f0ff4 100644 --- a/src/ai/api/ai_rail.hpp.sq +++ b/src/script/api/ai/ai_rail.hpp.sq @@ -9,28 +9,9 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_rail.hpp" +#include "../script_rail.hpp" +#include "../template/template_rail.hpp.sq" -namespace SQConvert { - /* Allow enums to be used as Squirrel parameters */ - template <> inline ScriptRail::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRail::ErrorMessages)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptRail::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptRail::RailType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRail::RailType)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptRail::RailType res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptRail::RailTrack GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRail::RailTrack)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptRail::RailTrack res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptRail::SignalType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRail::SignalType)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptRail::SignalType res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptRail::BuildType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRail::BuildType)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptRail::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; } - - /* Allow ScriptRail to be used as Squirrel parameter */ - template <> inline ScriptRail *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptRail *)instance; } - template <> inline ScriptRail &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptRail *)instance; } - template <> inline const ScriptRail *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptRail *)instance; } - template <> inline const ScriptRail &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptRail *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptRail *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Rail", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AIRail"; } diff --git a/src/script/api/ai/ai_railtypelist.hpp.sq b/src/script/api/ai/ai_railtypelist.hpp.sq new file mode 100644 index 0000000000..0f05df239a --- /dev/null +++ b/src/script/api/ai/ai_railtypelist.hpp.sq @@ -0,0 +1,25 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_railtypelist.hpp" +#include "../template/template_railtypelist.hpp.sq" + + +template <> const char *GetClassName() { return "AIRailTypeList"; } + +void SQAIRailTypeList_Register(Squirrel *engine) +{ + DefSQClass SQAIRailTypeList("AIRailTypeList"); + SQAIRailTypeList.PreRegister(engine, "AIList"); + SQAIRailTypeList.AddConstructor(engine, "x"); + + SQAIRailTypeList.PostRegister(engine); +} diff --git a/src/ai/api/ai_road.hpp.sq b/src/script/api/ai/ai_road.hpp.sq similarity index 71% rename from src/ai/api/ai_road.hpp.sq rename to src/script/api/ai/ai_road.hpp.sq index 17cb53ff12..2e8b681001 100644 --- a/src/ai/api/ai_road.hpp.sq +++ b/src/script/api/ai/ai_road.hpp.sq @@ -9,26 +9,9 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_road.hpp" +#include "../script_road.hpp" +#include "../template/template_road.hpp.sq" -namespace SQConvert { - /* Allow enums to be used as Squirrel parameters */ - template <> inline ScriptRoad::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRoad::ErrorMessages)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptRoad::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptRoad::RoadType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRoad::RoadType)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptRoad::RoadType res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptRoad::RoadVehicleType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRoad::RoadVehicleType)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptRoad::RoadVehicleType res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptRoad::BuildType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRoad::BuildType)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptRoad::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; } - - /* Allow ScriptRoad to be used as Squirrel parameter */ - template <> inline ScriptRoad *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptRoad *)instance; } - template <> inline ScriptRoad &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptRoad *)instance; } - template <> inline const ScriptRoad *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptRoad *)instance; } - template <> inline const ScriptRoad &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptRoad *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptRoad *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Road", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AIRoad"; } diff --git a/src/script/api/ai/ai_sign.hpp.sq b/src/script/api/ai/ai_sign.hpp.sq new file mode 100644 index 0000000000..e3c9005e76 --- /dev/null +++ b/src/script/api/ai/ai_sign.hpp.sq @@ -0,0 +1,39 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_sign.hpp" +#include "../template/template_sign.hpp.sq" + + +template <> const char *GetClassName() { return "AISign"; } + +void SQAISign_Register(Squirrel *engine) +{ + DefSQClass SQAISign("AISign"); + SQAISign.PreRegister(engine); + SQAISign.AddConstructor(engine, "x"); + + SQAISign.DefSQConst(engine, ScriptSign::ERR_SIGN_BASE, "ERR_SIGN_BASE"); + SQAISign.DefSQConst(engine, ScriptSign::ERR_SIGN_TOO_MANY_SIGNS, "ERR_SIGN_TOO_MANY_SIGNS"); + + ScriptError::RegisterErrorMap(STR_ERROR_TOO_MANY_SIGNS, ScriptSign::ERR_SIGN_TOO_MANY_SIGNS); + + ScriptError::RegisterErrorMapString(ScriptSign::ERR_SIGN_TOO_MANY_SIGNS, "ERR_SIGN_TOO_MANY_SIGNS"); + + SQAISign.DefSQStaticMethod(engine, &ScriptSign::IsValidSign, "IsValidSign", 2, ".i"); + SQAISign.DefSQStaticMethod(engine, &ScriptSign::SetName, "SetName", 3, ".i."); + SQAISign.DefSQStaticMethod(engine, &ScriptSign::GetName, "GetName", 2, ".i"); + SQAISign.DefSQStaticMethod(engine, &ScriptSign::GetLocation, "GetLocation", 2, ".i"); + SQAISign.DefSQStaticMethod(engine, &ScriptSign::BuildSign, "BuildSign", 3, ".i."); + SQAISign.DefSQStaticMethod(engine, &ScriptSign::RemoveSign, "RemoveSign", 2, ".i"); + + SQAISign.PostRegister(engine); +} diff --git a/src/script/api/ai/ai_signlist.hpp.sq b/src/script/api/ai/ai_signlist.hpp.sq new file mode 100644 index 0000000000..8f4f97c0c8 --- /dev/null +++ b/src/script/api/ai/ai_signlist.hpp.sq @@ -0,0 +1,25 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_signlist.hpp" +#include "../template/template_signlist.hpp.sq" + + +template <> const char *GetClassName() { return "AISignList"; } + +void SQAISignList_Register(Squirrel *engine) +{ + DefSQClass SQAISignList("AISignList"); + SQAISignList.PreRegister(engine, "AIList"); + SQAISignList.AddConstructor(engine, "x"); + + SQAISignList.PostRegister(engine); +} diff --git a/src/ai/api/ai_station.hpp.sq b/src/script/api/ai/ai_station.hpp.sq similarity index 68% rename from src/ai/api/ai_station.hpp.sq rename to src/script/api/ai/ai_station.hpp.sq index d98a417f24..de499d4669 100644 --- a/src/ai/api/ai_station.hpp.sq +++ b/src/script/api/ai/ai_station.hpp.sq @@ -9,22 +9,9 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_station.hpp" +#include "../script_station.hpp" +#include "../template/template_station.hpp.sq" -namespace SQConvert { - /* Allow enums to be used as Squirrel parameters */ - template <> inline ScriptStation::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptStation::ErrorMessages)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptStation::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptStation::StationType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptStation::StationType)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptStation::StationType res) { sq_pushinteger(vm, (int32)res); return 1; } - - /* Allow ScriptStation to be used as Squirrel parameter */ - template <> inline ScriptStation *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStation *)instance; } - template <> inline ScriptStation &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStation *)instance; } - template <> inline const ScriptStation *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStation *)instance; } - template <> inline const ScriptStation &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStation *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptStation *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Station", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AIStation"; } diff --git a/src/script/api/ai/ai_stationlist.hpp.sq b/src/script/api/ai/ai_stationlist.hpp.sq new file mode 100644 index 0000000000..998e89cc1e --- /dev/null +++ b/src/script/api/ai/ai_stationlist.hpp.sq @@ -0,0 +1,37 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_stationlist.hpp" +#include "../template/template_stationlist.hpp.sq" + + +template <> const char *GetClassName() { return "AIStationList"; } + +void SQAIStationList_Register(Squirrel *engine) +{ + DefSQClass SQAIStationList("AIStationList"); + SQAIStationList.PreRegister(engine, "AIList"); + SQAIStationList.AddConstructor(engine, "xi"); + + SQAIStationList.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIStationList_Vehicle"; } + +void SQAIStationList_Vehicle_Register(Squirrel *engine) +{ + DefSQClass SQAIStationList_Vehicle("AIStationList_Vehicle"); + SQAIStationList_Vehicle.PreRegister(engine, "AIList"); + SQAIStationList_Vehicle.AddConstructor(engine, "xi"); + + SQAIStationList_Vehicle.PostRegister(engine); +} diff --git a/src/script/api/ai/ai_subsidy.hpp.sq b/src/script/api/ai/ai_subsidy.hpp.sq new file mode 100644 index 0000000000..ea9743dace --- /dev/null +++ b/src/script/api/ai/ai_subsidy.hpp.sq @@ -0,0 +1,39 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_subsidy.hpp" +#include "../template/template_subsidy.hpp.sq" + + +template <> const char *GetClassName() { return "AISubsidy"; } + +void SQAISubsidy_Register(Squirrel *engine) +{ + DefSQClass SQAISubsidy("AISubsidy"); + SQAISubsidy.PreRegister(engine); + SQAISubsidy.AddConstructor(engine, "x"); + + SQAISubsidy.DefSQConst(engine, ScriptSubsidy::SPT_INDUSTRY, "SPT_INDUSTRY"); + SQAISubsidy.DefSQConst(engine, ScriptSubsidy::SPT_TOWN, "SPT_TOWN"); + SQAISubsidy.DefSQConst(engine, ScriptSubsidy::SPT_INVALID, "SPT_INVALID"); + + SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::IsValidSubsidy, "IsValidSubsidy", 2, ".i"); + SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::IsAwarded, "IsAwarded", 2, ".i"); + SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetAwardedTo, "GetAwardedTo", 2, ".i"); + SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetExpireDate, "GetExpireDate", 2, ".i"); + SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetCargoType, "GetCargoType", 2, ".i"); + SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetSourceType, "GetSourceType", 2, ".i"); + SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetSourceIndex, "GetSourceIndex", 2, ".i"); + SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetDestinationType, "GetDestinationType", 2, ".i"); + SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetDestinationIndex, "GetDestinationIndex", 2, ".i"); + + SQAISubsidy.PostRegister(engine); +} diff --git a/src/script/api/ai/ai_subsidylist.hpp.sq b/src/script/api/ai/ai_subsidylist.hpp.sq new file mode 100644 index 0000000000..f58165f556 --- /dev/null +++ b/src/script/api/ai/ai_subsidylist.hpp.sq @@ -0,0 +1,25 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_subsidylist.hpp" +#include "../template/template_subsidylist.hpp.sq" + + +template <> const char *GetClassName() { return "AISubsidyList"; } + +void SQAISubsidyList_Register(Squirrel *engine) +{ + DefSQClass SQAISubsidyList("AISubsidyList"); + SQAISubsidyList.PreRegister(engine, "AIList"); + SQAISubsidyList.AddConstructor(engine, "x"); + + SQAISubsidyList.PostRegister(engine); +} diff --git a/src/script/api/ai/ai_testmode.hpp.sq b/src/script/api/ai/ai_testmode.hpp.sq new file mode 100644 index 0000000000..6072706f73 --- /dev/null +++ b/src/script/api/ai/ai_testmode.hpp.sq @@ -0,0 +1,25 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_testmode.hpp" +#include "../template/template_testmode.hpp.sq" + + +template <> const char *GetClassName() { return "AITestMode"; } + +void SQAITestMode_Register(Squirrel *engine) +{ + DefSQClass SQAITestMode("AITestMode"); + SQAITestMode.PreRegister(engine); + SQAITestMode.AddConstructor(engine, "x"); + + SQAITestMode.PostRegister(engine); +} diff --git a/src/ai/api/ai_tile.hpp.sq b/src/script/api/ai/ai_tile.hpp.sq similarity index 75% rename from src/ai/api/ai_tile.hpp.sq rename to src/script/api/ai/ai_tile.hpp.sq index 798e148253..44d5e326c1 100644 --- a/src/ai/api/ai_tile.hpp.sq +++ b/src/script/api/ai/ai_tile.hpp.sq @@ -9,28 +9,9 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_tile.hpp" +#include "../script_tile.hpp" +#include "../template/template_tile.hpp.sq" -namespace SQConvert { - /* Allow enums to be used as Squirrel parameters */ - template <> inline ScriptTile::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTile::ErrorMessages)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptTile::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptTile::Corner GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTile::Corner)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptTile::Corner res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptTile::Slope GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTile::Slope)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptTile::Slope res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptTile::TransportType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTile::TransportType)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptTile::TransportType res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptTile::BuildType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTile::BuildType)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptTile::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; } - - /* Allow ScriptTile to be used as Squirrel parameter */ - template <> inline ScriptTile *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptTile *)instance; } - template <> inline ScriptTile &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTile *)instance; } - template <> inline const ScriptTile *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptTile *)instance; } - template <> inline const ScriptTile &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTile *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptTile *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Tile", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AITile"; } diff --git a/src/script/api/ai/ai_tilelist.hpp.sq b/src/script/api/ai/ai_tilelist.hpp.sq new file mode 100644 index 0000000000..4675e98fe9 --- /dev/null +++ b/src/script/api/ai/ai_tilelist.hpp.sq @@ -0,0 +1,66 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_tilelist.hpp" +#include "../template/template_tilelist.hpp.sq" + + +template <> const char *GetClassName() { return "AITileList"; } + +void SQAITileList_Register(Squirrel *engine) +{ + DefSQClass SQAITileList("AITileList"); + SQAITileList.PreRegister(engine, "AIList"); + SQAITileList.AddConstructor(engine, "x"); + + SQAITileList.DefSQMethod(engine, &ScriptTileList::AddRectangle, "AddRectangle", 3, "xii"); + SQAITileList.DefSQMethod(engine, &ScriptTileList::AddTile, "AddTile", 2, "xi"); + SQAITileList.DefSQMethod(engine, &ScriptTileList::RemoveRectangle, "RemoveRectangle", 3, "xii"); + SQAITileList.DefSQMethod(engine, &ScriptTileList::RemoveTile, "RemoveTile", 2, "xi"); + + SQAITileList.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AITileList_IndustryAccepting"; } + +void SQAITileList_IndustryAccepting_Register(Squirrel *engine) +{ + DefSQClass SQAITileList_IndustryAccepting("AITileList_IndustryAccepting"); + SQAITileList_IndustryAccepting.PreRegister(engine, "AITileList"); + SQAITileList_IndustryAccepting.AddConstructor(engine, "xii"); + + SQAITileList_IndustryAccepting.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AITileList_IndustryProducing"; } + +void SQAITileList_IndustryProducing_Register(Squirrel *engine) +{ + DefSQClass SQAITileList_IndustryProducing("AITileList_IndustryProducing"); + SQAITileList_IndustryProducing.PreRegister(engine, "AITileList"); + SQAITileList_IndustryProducing.AddConstructor(engine, "xii"); + + SQAITileList_IndustryProducing.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AITileList_StationType"; } + +void SQAITileList_StationType_Register(Squirrel *engine) +{ + DefSQClass SQAITileList_StationType("AITileList_StationType"); + SQAITileList_StationType.PreRegister(engine, "AITileList"); + SQAITileList_StationType.AddConstructor(engine, "xii"); + + SQAITileList_StationType.PostRegister(engine); +} diff --git a/src/ai/api/ai_town.hpp.sq b/src/script/api/ai/ai_town.hpp.sq similarity index 72% rename from src/ai/api/ai_town.hpp.sq rename to src/script/api/ai/ai_town.hpp.sq index 24bb45a0fa..70e3e994eb 100644 --- a/src/ai/api/ai_town.hpp.sq +++ b/src/script/api/ai/ai_town.hpp.sq @@ -9,24 +9,9 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_town.hpp" +#include "../script_town.hpp" +#include "../template/template_town.hpp.sq" -namespace SQConvert { - /* Allow enums to be used as Squirrel parameters */ - template <> inline ScriptTown::TownAction GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTown::TownAction)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptTown::TownAction res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptTown::TownRating GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTown::TownRating)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptTown::TownRating res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptTown::RoadLayout GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTown::RoadLayout)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptTown::RoadLayout res) { sq_pushinteger(vm, (int32)res); return 1; } - - /* Allow ScriptTown to be used as Squirrel parameter */ - template <> inline ScriptTown *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptTown *)instance; } - template <> inline ScriptTown &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTown *)instance; } - template <> inline const ScriptTown *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptTown *)instance; } - template <> inline const ScriptTown &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTown *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptTown *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Town", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AITown"; } diff --git a/src/script/api/ai/ai_townlist.hpp.sq b/src/script/api/ai/ai_townlist.hpp.sq new file mode 100644 index 0000000000..74af6f45bb --- /dev/null +++ b/src/script/api/ai/ai_townlist.hpp.sq @@ -0,0 +1,37 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_townlist.hpp" +#include "../template/template_townlist.hpp.sq" + + +template <> const char *GetClassName() { return "AITownList"; } + +void SQAITownList_Register(Squirrel *engine) +{ + DefSQClass SQAITownList("AITownList"); + SQAITownList.PreRegister(engine, "AIList"); + SQAITownList.AddConstructor(engine, "x"); + + SQAITownList.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AITownEffectList"; } + +void SQAITownEffectList_Register(Squirrel *engine) +{ + DefSQClass SQAITownEffectList("AITownEffectList"); + SQAITownEffectList.PreRegister(engine, "AIList"); + SQAITownEffectList.AddConstructor(engine, "x"); + + SQAITownEffectList.PostRegister(engine); +} diff --git a/src/ai/api/ai_tunnel.hpp.sq b/src/script/api/ai/ai_tunnel.hpp.sq similarity index 62% rename from src/ai/api/ai_tunnel.hpp.sq rename to src/script/api/ai/ai_tunnel.hpp.sq index e7073fabca..91eb432a05 100644 --- a/src/ai/api/ai_tunnel.hpp.sq +++ b/src/script/api/ai/ai_tunnel.hpp.sq @@ -9,20 +9,9 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_tunnel.hpp" +#include "../script_tunnel.hpp" +#include "../template/template_tunnel.hpp.sq" -namespace SQConvert { - /* Allow enums to be used as Squirrel parameters */ - template <> inline ScriptTunnel::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTunnel::ErrorMessages)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptTunnel::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } - - /* Allow ScriptTunnel to be used as Squirrel parameter */ - template <> inline ScriptTunnel *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptTunnel *)instance; } - template <> inline ScriptTunnel &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTunnel *)instance; } - template <> inline const ScriptTunnel *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptTunnel *)instance; } - template <> inline const ScriptTunnel &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTunnel *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptTunnel *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Tunnel", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AITunnel"; } diff --git a/src/ai/api/ai_vehicle.hpp.sq b/src/script/api/ai/ai_vehicle.hpp.sq similarity index 85% rename from src/ai/api/ai_vehicle.hpp.sq rename to src/script/api/ai/ai_vehicle.hpp.sq index e0a0f0ee02..f409a2770b 100644 --- a/src/ai/api/ai_vehicle.hpp.sq +++ b/src/script/api/ai/ai_vehicle.hpp.sq @@ -9,24 +9,9 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_vehicle.hpp" +#include "../script_vehicle.hpp" +#include "../template/template_vehicle.hpp.sq" -namespace SQConvert { - /* Allow enums to be used as Squirrel parameters */ - template <> inline ScriptVehicle::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptVehicle::ErrorMessages)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptVehicle::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptVehicle::VehicleType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptVehicle::VehicleType)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptVehicle::VehicleType res) { sq_pushinteger(vm, (int32)res); return 1; } - template <> inline ScriptVehicle::VehicleState GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptVehicle::VehicleState)tmp; } - template <> inline int Return(HSQUIRRELVM vm, ScriptVehicle::VehicleState res) { sq_pushinteger(vm, (int32)res); return 1; } - - /* Allow ScriptVehicle to be used as Squirrel parameter */ - template <> inline ScriptVehicle *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptVehicle *)instance; } - template <> inline ScriptVehicle &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptVehicle *)instance; } - template <> inline const ScriptVehicle *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptVehicle *)instance; } - template <> inline const ScriptVehicle &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptVehicle *)instance; } - template <> inline int Return(HSQUIRRELVM vm, ScriptVehicle *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Vehicle", res, NULL, DefSQDestructorCallback, true); return 1; } -} // namespace SQConvert template <> const char *GetClassName() { return "AIVehicle"; } diff --git a/src/script/api/ai/ai_vehiclelist.hpp.sq b/src/script/api/ai/ai_vehiclelist.hpp.sq new file mode 100644 index 0000000000..39e5cb4598 --- /dev/null +++ b/src/script/api/ai/ai_vehiclelist.hpp.sq @@ -0,0 +1,85 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_vehiclelist.hpp" +#include "../template/template_vehiclelist.hpp.sq" + + +template <> const char *GetClassName() { return "AIVehicleList"; } + +void SQAIVehicleList_Register(Squirrel *engine) +{ + DefSQClass SQAIVehicleList("AIVehicleList"); + SQAIVehicleList.PreRegister(engine, "AIList"); + SQAIVehicleList.AddConstructor(engine, "x"); + + SQAIVehicleList.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIVehicleList_Station"; } + +void SQAIVehicleList_Station_Register(Squirrel *engine) +{ + DefSQClass SQAIVehicleList_Station("AIVehicleList_Station"); + SQAIVehicleList_Station.PreRegister(engine, "AIList"); + SQAIVehicleList_Station.AddConstructor(engine, "xi"); + + SQAIVehicleList_Station.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIVehicleList_Depot"; } + +void SQAIVehicleList_Depot_Register(Squirrel *engine) +{ + DefSQClass SQAIVehicleList_Depot("AIVehicleList_Depot"); + SQAIVehicleList_Depot.PreRegister(engine, "AIList"); + SQAIVehicleList_Depot.AddConstructor(engine, "xi"); + + SQAIVehicleList_Depot.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIVehicleList_SharedOrders"; } + +void SQAIVehicleList_SharedOrders_Register(Squirrel *engine) +{ + DefSQClass SQAIVehicleList_SharedOrders("AIVehicleList_SharedOrders"); + SQAIVehicleList_SharedOrders.PreRegister(engine, "AIList"); + SQAIVehicleList_SharedOrders.AddConstructor(engine, "xi"); + + SQAIVehicleList_SharedOrders.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIVehicleList_Group"; } + +void SQAIVehicleList_Group_Register(Squirrel *engine) +{ + DefSQClass SQAIVehicleList_Group("AIVehicleList_Group"); + SQAIVehicleList_Group.PreRegister(engine, "AIList"); + SQAIVehicleList_Group.AddConstructor(engine, "xi"); + + SQAIVehicleList_Group.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIVehicleList_DefaultGroup"; } + +void SQAIVehicleList_DefaultGroup_Register(Squirrel *engine) +{ + DefSQClass SQAIVehicleList_DefaultGroup("AIVehicleList_DefaultGroup"); + SQAIVehicleList_DefaultGroup.PreRegister(engine, "AIList"); + SQAIVehicleList_DefaultGroup.AddConstructor(engine, "xi"); + + SQAIVehicleList_DefaultGroup.PostRegister(engine); +} diff --git a/src/script/api/ai/ai_waypoint.hpp.sq b/src/script/api/ai/ai_waypoint.hpp.sq new file mode 100644 index 0000000000..e5b6101c34 --- /dev/null +++ b/src/script/api/ai/ai_waypoint.hpp.sq @@ -0,0 +1,42 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_waypoint.hpp" +#include "../template/template_waypoint.hpp.sq" + + +template <> const char *GetClassName() { return "AIWaypoint"; } + +void SQAIWaypoint_Register(Squirrel *engine) +{ + DefSQClass SQAIWaypoint("AIWaypoint"); + SQAIWaypoint.PreRegister(engine, "AIBaseStation"); + SQAIWaypoint.AddConstructor(engine, "x"); + + SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::WAYPOINT_RAIL, "WAYPOINT_RAIL"); + SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::WAYPOINT_BUOY, "WAYPOINT_BUOY"); + SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::WAYPOINT_ANY, "WAYPOINT_ANY"); + SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::ERR_WAYPOINT_BASE, "ERR_WAYPOINT_BASE"); + SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT, "ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT"); + SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS, "ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS"); + + ScriptError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_WAYPOINT, ScriptWaypoint::ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT); + ScriptError::RegisterErrorMap(STR_ERROR_WAYPOINT_ADJOINS_MORE_THAN_ONE_EXISTING, ScriptWaypoint::ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS); + + ScriptError::RegisterErrorMapString(ScriptWaypoint::ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT, "ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT"); + ScriptError::RegisterErrorMapString(ScriptWaypoint::ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS, "ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS"); + + SQAIWaypoint.DefSQStaticMethod(engine, &ScriptWaypoint::IsValidWaypoint, "IsValidWaypoint", 2, ".i"); + SQAIWaypoint.DefSQStaticMethod(engine, &ScriptWaypoint::GetWaypointID, "GetWaypointID", 2, ".i"); + SQAIWaypoint.DefSQStaticMethod(engine, &ScriptWaypoint::HasWaypointType, "HasWaypointType", 3, ".ii"); + + SQAIWaypoint.PostRegister(engine); +} diff --git a/src/script/api/ai/ai_waypointlist.hpp.sq b/src/script/api/ai/ai_waypointlist.hpp.sq new file mode 100644 index 0000000000..464c07071f --- /dev/null +++ b/src/script/api/ai/ai_waypointlist.hpp.sq @@ -0,0 +1,37 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_waypointlist.hpp" +#include "../template/template_waypointlist.hpp.sq" + + +template <> const char *GetClassName() { return "AIWaypointList"; } + +void SQAIWaypointList_Register(Squirrel *engine) +{ + DefSQClass SQAIWaypointList("AIWaypointList"); + SQAIWaypointList.PreRegister(engine, "AIList"); + SQAIWaypointList.AddConstructor(engine, "xi"); + + SQAIWaypointList.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "AIWaypointList_Vehicle"; } + +void SQAIWaypointList_Vehicle_Register(Squirrel *engine) +{ + DefSQClass SQAIWaypointList_Vehicle("AIWaypointList_Vehicle"); + SQAIWaypointList_Vehicle.PreRegister(engine, "AIList"); + SQAIWaypointList_Vehicle.AddConstructor(engine, "xi"); + + SQAIWaypointList_Vehicle.PostRegister(engine); +} diff --git a/src/script/api/squirrel_export.awk b/src/script/api/squirrel_export.awk index 56d5ee1b32..781c452d5e 100644 --- a/src/script/api/squirrel_export.awk +++ b/src/script/api/squirrel_export.awk @@ -54,7 +54,11 @@ function dump_fileheader() print "" print "/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */" print "" - print "#include \"../../script/api/" filename "\"" + print "#include \"../" filename "\"" + if (api != "Template") { + gsub("script_", "template_", filename) + print "#include \"../template/" filename ".sq\"" + } } function reset_reader() @@ -99,6 +103,11 @@ BEGIN { } /^([ ]*)\* @api/ { + if (api == "Template") { + api_selected = "true" + next + } + # By default, classes are not selected if (cls_level == 0) api_selected = "false" @@ -114,6 +123,8 @@ BEGIN { } else if (match($0, tolower(api))) { api_selected = "true" } + + next } # Remove the old squirrel stuff @@ -259,43 +270,48 @@ BEGIN { print "" - # First check whether we have enums to print - if (enum_size != 0) { + if (api == "Template") { + # First check whether we have enums to print + if (enum_size != 0) { + if (namespace_opened == "false") { + print "namespace SQConvert {" + namespace_opened = "true" + } + print " /* Allow enums to be used as Squirrel parameters */" + for (i = 1; i <= enum_size; i++) { + print " template <> inline " enums[i] " GetParam(ForceType<" enums[i] ">, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (" enums[i] ")tmp; }" + print " template <> inline int Return<" enums[i] ">(HSQUIRRELVM vm, " enums[i] " res) { sq_pushinteger(vm, (int32)res); return 1; }" + delete enums[i] + } + } + + # Then check whether we have structs/classes to print + if (struct_size != 0) { + if (namespace_opened == "false") { + print "namespace SQConvert {" + namespace_opened = "true" + } + print " /* Allow inner classes/structs to be used as Squirrel parameters */" + for (i = 1; i <= struct_size; i++) { + dump_class_templates(structs[i]) + delete structs[i] + } + } + if (namespace_opened == "false") { print "namespace SQConvert {" namespace_opened = "true" + } else { + print "" } - print " /* Allow enums to be used as Squirrel parameters */" - for (i = 1; i <= enum_size; i++) { - print " template <> inline " enums[i] " GetParam(ForceType<" enums[i] ">, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (" enums[i] ")tmp; }" - print " template <> inline int Return<" enums[i] ">(HSQUIRRELVM vm, " enums[i] " res) { sq_pushinteger(vm, (int32)res); return 1; }" - delete enums[i] - } - } + print " /* Allow " cls " to be used as Squirrel parameter */" + dump_class_templates(cls) - # Then check whether we have structs/classes to print - if (struct_size != 0) { - if (namespace_opened == "false") { - print "namespace SQConvert {" - namespace_opened = "true" - } - print " /* Allow inner classes/structs to be used as Squirrel parameters */" - for (i = 1; i <= struct_size; i++) { - dump_class_templates(structs[i]) - delete structs[i] - } - } + print "} // namespace SQConvert" - if (namespace_opened == "false") { - print "namespace SQConvert {" - namespace_opened = "true" - } else { - print "" + reset_reader() + next } - print " /* Allow " cls " to be used as Squirrel parameter */" - dump_class_templates(cls) - - print "} // namespace SQConvert" print ""; print "template <> const char *GetClassName<" cls ", ST_" toupper(api) ">() { return \"" api_cls "\"; }" diff --git a/src/script/api/squirrel_export.sh b/src/script/api/squirrel_export.sh index b29727a7d4..bf54526e82 100755 --- a/src/script/api/squirrel_export.sh +++ b/src/script/api/squirrel_export.sh @@ -23,14 +23,32 @@ fi # This must be called from within a src/???/api directory. scriptdir=`dirname $0` apilc=`pwd | sed "s@/api@@;s@.*/@@"` -apiuc=`echo ${apilc} | tr [a-z] [A-Z]` + +# Check if we are in the root directory of the API, as then we generate all APIs +if [ "$apilc" = "script" ]; then + for api in `find -type d | cut -b3-`; do + if [ -z "$api" ]; then continue; fi + echo "Generating for API '$api' ..." + cd $api + sh $scriptdir/../`basename $0` + cd .. + done + exit 0 +fi + +case $apilc in + template) apiuc="Template" ;; + ai) apiuc="AI" ;; + *) echo "Unknown API type."; exit 1 ;; +esac if [ -z "$1" ]; then - for f in `ls ../../script/api/*.hpp`; do - bf=`basename ${f} | sed s/script/${apilc}/` + for f in `ls ../*.hpp`; do + bf=`basename ${f} | sed s@script_@${apilc}_@` # ScriptController has custom code, and should not be generated if [ "`basename ${f}`" = "script_controller.hpp" ]; then continue; fi + if [ "`basename ${f}`" = "script_object.hpp" ]; then continue; fi ${AWK} -v api=${apiuc} -f ${scriptdir}/squirrel_export.awk ${f} > ${bf}.tmp @@ -71,22 +89,23 @@ fi # Remove .hpp.sq if .hpp doesn't exist anymore for f in `ls *.hpp.sq`; do - f=`echo ${f} | sed "s/.hpp.sq$/.hpp/;s/${apilc}/script/"` - if [ ! -f ../../script/api/${f} ];then + f=`echo ${f} | sed "s/.hpp.sq$/.hpp/;s@${apilc}_@script_@"` + if [ ! -f ../${f} ];then echo "Deleted: ${f}.sq" svn del --force ${f}.sq > /dev/null 2>&1 fi done +if [ "$apilc" = "template" ]; then exit 0; fi + # Add stuff to ${apilc}_instance.cpp -f="../${apilc}_instance.cpp" +f="../../../${apilc}/${apilc}_instance.cpp" functions=`` echo " { } /.hpp.sq/ { next } -/squirrel_register_std/ { next } /SQ${apiuc}Controller_Register/ { print \$0; next } /SQ${apiuc}.*_Register/ { next } @@ -96,7 +115,7 @@ echo " split(\"`grep '^void SQ'${apiuc}'.*_Register(Squirrel \*engine)$' *.hpp.sq | sed 's/:.*$//' | sort | uniq | tr -d '\r' | tr '\n' ' '`\", files, \" \") for (i = 1; files[i] != \"\"; i++) { - print \"#include \\\"api/\" files[i] \"\\\"\" \$0 + print \"#include \\\"../script/api/${apilc}/\" files[i] \"\\\"\" \$0 } next; diff --git a/src/ai/api/ai_accounting.hpp.sq b/src/script/api/template/template_accounting.hpp.sq similarity index 77% rename from src/ai/api/ai_accounting.hpp.sq rename to src/script/api/template/template_accounting.hpp.sq index 0e0aba3b8c..298217a22f 100644 --- a/src/ai/api/ai_accounting.hpp.sq +++ b/src/script/api/template/template_accounting.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_accounting.hpp" +#include "../script_accounting.hpp" namespace SQConvert { /* Allow ScriptAccounting to be used as Squirrel parameter */ @@ -19,17 +19,3 @@ namespace SQConvert { template <> inline const ScriptAccounting &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptAccounting *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptAccounting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Accounting", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AIAccounting"; } - -void SQAIAccounting_Register(Squirrel *engine) -{ - DefSQClass SQAIAccounting("AIAccounting"); - SQAIAccounting.PreRegister(engine); - SQAIAccounting.AddConstructor(engine, "x"); - - SQAIAccounting.DefSQMethod(engine, &ScriptAccounting::GetCosts, "GetCosts", 1, "x"); - SQAIAccounting.DefSQMethod(engine, &ScriptAccounting::ResetCosts, "ResetCosts", 1, "x"); - - SQAIAccounting.PostRegister(engine); -} diff --git a/src/script/api/template/template_airport.hpp.sq b/src/script/api/template/template_airport.hpp.sq new file mode 100644 index 0000000000..402eea076d --- /dev/null +++ b/src/script/api/template/template_airport.hpp.sq @@ -0,0 +1,27 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_airport.hpp" + +namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptAirport::AirportType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptAirport::AirportType)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptAirport::AirportType res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptAirport::PlaneType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptAirport::PlaneType)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptAirport::PlaneType res) { sq_pushinteger(vm, (int32)res); return 1; } + + /* Allow ScriptAirport to be used as Squirrel parameter */ + template <> inline ScriptAirport *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptAirport *)instance; } + template <> inline ScriptAirport &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptAirport *)instance; } + template <> inline const ScriptAirport *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptAirport *)instance; } + template <> inline const ScriptAirport &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptAirport *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptAirport *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Airport", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert diff --git a/src/ai/api/ai_base.hpp.sq b/src/script/api/template/template_base.hpp.sq similarity index 68% rename from src/ai/api/ai_base.hpp.sq rename to src/script/api/template/template_base.hpp.sq index ef5d5ab743..0ff19bcb89 100644 --- a/src/ai/api/ai_base.hpp.sq +++ b/src/script/api/template/template_base.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_base.hpp" +#include "../script_base.hpp" namespace SQConvert { /* Allow ScriptBase to be used as Squirrel parameter */ @@ -19,21 +19,3 @@ namespace SQConvert { template <> inline const ScriptBase &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptBase *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptBase *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Base", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AIBase"; } - -void SQAIBase_Register(Squirrel *engine) -{ - DefSQClass SQAIBase("AIBase"); - SQAIBase.PreRegister(engine); - SQAIBase.AddConstructor(engine, "x"); - - SQAIBase.DefSQStaticMethod(engine, &ScriptBase::Rand, "Rand", 1, "."); - SQAIBase.DefSQStaticMethod(engine, &ScriptBase::RandItem, "RandItem", 2, ".i"); - SQAIBase.DefSQStaticMethod(engine, &ScriptBase::RandRange, "RandRange", 2, ".i"); - SQAIBase.DefSQStaticMethod(engine, &ScriptBase::RandRangeItem, "RandRangeItem", 3, ".ii"); - SQAIBase.DefSQStaticMethod(engine, &ScriptBase::Chance, "Chance", 3, ".ii"); - SQAIBase.DefSQStaticMethod(engine, &ScriptBase::ChanceItem, "ChanceItem", 4, ".iii"); - - SQAIBase.PostRegister(engine); -} diff --git a/src/ai/api/ai_basestation.hpp.sq b/src/script/api/template/template_basestation.hpp.sq similarity index 65% rename from src/ai/api/ai_basestation.hpp.sq rename to src/script/api/template/template_basestation.hpp.sq index 842570f805..c11a7745e4 100644 --- a/src/ai/api/ai_basestation.hpp.sq +++ b/src/script/api/template/template_basestation.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_basestation.hpp" +#include "../script_basestation.hpp" namespace SQConvert { /* Allow enums to be used as Squirrel parameters */ @@ -23,24 +23,3 @@ namespace SQConvert { template <> inline const ScriptBaseStation &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptBaseStation *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptBaseStation *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "BaseStation", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AIBaseStation"; } - -void SQAIBaseStation_Register(Squirrel *engine) -{ - DefSQClass SQAIBaseStation("AIBaseStation"); - SQAIBaseStation.PreRegister(engine); - SQAIBaseStation.AddConstructor(engine, "x"); - - SQAIBaseStation.DefSQConst(engine, ScriptBaseStation::STATION_NEW, "STATION_NEW"); - SQAIBaseStation.DefSQConst(engine, ScriptBaseStation::STATION_JOIN_ADJACENT, "STATION_JOIN_ADJACENT"); - SQAIBaseStation.DefSQConst(engine, ScriptBaseStation::STATION_INVALID, "STATION_INVALID"); - - SQAIBaseStation.DefSQStaticMethod(engine, &ScriptBaseStation::IsValidBaseStation, "IsValidBaseStation", 2, ".i"); - SQAIBaseStation.DefSQStaticMethod(engine, &ScriptBaseStation::GetName, "GetName", 2, ".i"); - SQAIBaseStation.DefSQStaticMethod(engine, &ScriptBaseStation::SetName, "SetName", 3, ".i."); - SQAIBaseStation.DefSQStaticMethod(engine, &ScriptBaseStation::GetLocation, "GetLocation", 2, ".i"); - SQAIBaseStation.DefSQStaticMethod(engine, &ScriptBaseStation::GetConstructionDate, "GetConstructionDate", 2, ".i"); - - SQAIBaseStation.PostRegister(engine); -} diff --git a/src/script/api/template/template_bridge.hpp.sq b/src/script/api/template/template_bridge.hpp.sq new file mode 100644 index 0000000000..f627155119 --- /dev/null +++ b/src/script/api/template/template_bridge.hpp.sq @@ -0,0 +1,25 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_bridge.hpp" + +namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptBridge::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptBridge::ErrorMessages)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptBridge::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } + + /* Allow ScriptBridge to be used as Squirrel parameter */ + template <> inline ScriptBridge *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptBridge *)instance; } + template <> inline ScriptBridge &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptBridge *)instance; } + template <> inline const ScriptBridge *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptBridge *)instance; } + template <> inline const ScriptBridge &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptBridge *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptBridge *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Bridge", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert diff --git a/src/ai/api/ai_bridgelist.hpp.sq b/src/script/api/template/template_bridgelist.hpp.sq similarity index 79% rename from src/ai/api/ai_bridgelist.hpp.sq rename to src/script/api/template/template_bridgelist.hpp.sq index 4af4aee9b7..1f78a78742 100644 --- a/src/ai/api/ai_bridgelist.hpp.sq +++ b/src/script/api/template/template_bridgelist.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_bridgelist.hpp" +#include "../script_bridgelist.hpp" namespace SQConvert { /* Allow ScriptBridgeList to be used as Squirrel parameter */ @@ -20,17 +20,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptBridgeList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "BridgeList", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIBridgeList"; } - -void SQAIBridgeList_Register(Squirrel *engine) -{ - DefSQClass SQAIBridgeList("AIBridgeList"); - SQAIBridgeList.PreRegister(engine, "AIList"); - SQAIBridgeList.AddConstructor(engine, "x"); - - SQAIBridgeList.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptBridgeList_Length to be used as Squirrel parameter */ template <> inline ScriptBridgeList_Length *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptBridgeList_Length *)instance; } @@ -39,14 +28,3 @@ namespace SQConvert { template <> inline const ScriptBridgeList_Length &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptBridgeList_Length *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptBridgeList_Length *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "BridgeList_Length", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AIBridgeList_Length"; } - -void SQAIBridgeList_Length_Register(Squirrel *engine) -{ - DefSQClass SQAIBridgeList_Length("AIBridgeList_Length"); - SQAIBridgeList_Length.PreRegister(engine, "AIList"); - SQAIBridgeList_Length.AddConstructor(engine, "xi"); - - SQAIBridgeList_Length.PostRegister(engine); -} diff --git a/src/ai/api/ai_cargo.hpp.sq b/src/script/api/template/template_cargo.hpp.sq similarity index 56% rename from src/ai/api/ai_cargo.hpp.sq rename to src/script/api/template/template_cargo.hpp.sq index d4240dbbb7..0a80aa7050 100644 --- a/src/ai/api/ai_cargo.hpp.sq +++ b/src/script/api/template/template_cargo.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_cargo.hpp" +#include "../script_cargo.hpp" namespace SQConvert { /* Allow enums to be used as Squirrel parameters */ @@ -27,41 +27,3 @@ namespace SQConvert { template <> inline const ScriptCargo &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptCargo *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptCargo *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Cargo", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AICargo"; } - -void SQAICargo_Register(Squirrel *engine) -{ - DefSQClass SQAICargo("AICargo"); - SQAICargo.PreRegister(engine); - SQAICargo.AddConstructor(engine, "x"); - - SQAICargo.DefSQConst(engine, ScriptCargo::CC_PASSENGERS, "CC_PASSENGERS"); - SQAICargo.DefSQConst(engine, ScriptCargo::CC_MAIL, "CC_MAIL"); - SQAICargo.DefSQConst(engine, ScriptCargo::CC_EXPRESS, "CC_EXPRESS"); - SQAICargo.DefSQConst(engine, ScriptCargo::CC_ARMOURED, "CC_ARMOURED"); - SQAICargo.DefSQConst(engine, ScriptCargo::CC_BULK, "CC_BULK"); - SQAICargo.DefSQConst(engine, ScriptCargo::CC_PIECE_GOODS, "CC_PIECE_GOODS"); - SQAICargo.DefSQConst(engine, ScriptCargo::CC_LIQUID, "CC_LIQUID"); - SQAICargo.DefSQConst(engine, ScriptCargo::CC_REFRIGERATED, "CC_REFRIGERATED"); - SQAICargo.DefSQConst(engine, ScriptCargo::CC_HAZARDOUS, "CC_HAZARDOUS"); - SQAICargo.DefSQConst(engine, ScriptCargo::CC_COVERED, "CC_COVERED"); - SQAICargo.DefSQConst(engine, ScriptCargo::TE_NONE, "TE_NONE"); - SQAICargo.DefSQConst(engine, ScriptCargo::TE_PASSENGERS, "TE_PASSENGERS"); - SQAICargo.DefSQConst(engine, ScriptCargo::TE_MAIL, "TE_MAIL"); - SQAICargo.DefSQConst(engine, ScriptCargo::TE_GOODS, "TE_GOODS"); - SQAICargo.DefSQConst(engine, ScriptCargo::TE_WATER, "TE_WATER"); - SQAICargo.DefSQConst(engine, ScriptCargo::TE_FOOD, "TE_FOOD"); - SQAICargo.DefSQConst(engine, ScriptCargo::CT_AUTO_REFIT, "CT_AUTO_REFIT"); - SQAICargo.DefSQConst(engine, ScriptCargo::CT_NO_REFIT, "CT_NO_REFIT"); - - SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::IsValidCargo, "IsValidCargo", 2, ".i"); - SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::IsValidTownEffect, "IsValidTownEffect", 2, ".i"); - SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::GetCargoLabel, "GetCargoLabel", 2, ".i"); - SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::IsFreight, "IsFreight", 2, ".i"); - SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::HasCargoClass, "HasCargoClass", 3, ".ii"); - SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::GetTownEffect, "GetTownEffect", 2, ".i"); - SQAICargo.DefSQStaticMethod(engine, &ScriptCargo::GetCargoIncome, "GetCargoIncome", 4, ".iii"); - - SQAICargo.PostRegister(engine); -} diff --git a/src/ai/api/ai_cargolist.hpp.sq b/src/script/api/template/template_cargolist.hpp.sq similarity index 76% rename from src/ai/api/ai_cargolist.hpp.sq rename to src/script/api/template/template_cargolist.hpp.sq index 35b77d97ce..5b39aa66d8 100644 --- a/src/ai/api/ai_cargolist.hpp.sq +++ b/src/script/api/template/template_cargolist.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_cargolist.hpp" +#include "../script_cargolist.hpp" namespace SQConvert { /* Allow ScriptCargoList to be used as Squirrel parameter */ @@ -20,17 +20,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptCargoList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "CargoList", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AICargoList"; } - -void SQAICargoList_Register(Squirrel *engine) -{ - DefSQClass SQAICargoList("AICargoList"); - SQAICargoList.PreRegister(engine, "AIList"); - SQAICargoList.AddConstructor(engine, "x"); - - SQAICargoList.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptCargoList_IndustryAccepting to be used as Squirrel parameter */ template <> inline ScriptCargoList_IndustryAccepting *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptCargoList_IndustryAccepting *)instance; } @@ -40,17 +29,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptCargoList_IndustryAccepting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "CargoList_IndustryAccepting", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AICargoList_IndustryAccepting"; } - -void SQAICargoList_IndustryAccepting_Register(Squirrel *engine) -{ - DefSQClass SQAICargoList_IndustryAccepting("AICargoList_IndustryAccepting"); - SQAICargoList_IndustryAccepting.PreRegister(engine, "AIList"); - SQAICargoList_IndustryAccepting.AddConstructor(engine, "xi"); - - SQAICargoList_IndustryAccepting.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptCargoList_IndustryProducing to be used as Squirrel parameter */ template <> inline ScriptCargoList_IndustryProducing *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptCargoList_IndustryProducing *)instance; } @@ -60,17 +38,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptCargoList_IndustryProducing *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "CargoList_IndustryProducing", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AICargoList_IndustryProducing"; } - -void SQAICargoList_IndustryProducing_Register(Squirrel *engine) -{ - DefSQClass SQAICargoList_IndustryProducing("AICargoList_IndustryProducing"); - SQAICargoList_IndustryProducing.PreRegister(engine, "AIList"); - SQAICargoList_IndustryProducing.AddConstructor(engine, "xi"); - - SQAICargoList_IndustryProducing.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptCargoList_StationAccepting to be used as Squirrel parameter */ template <> inline ScriptCargoList_StationAccepting *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptCargoList_StationAccepting *)instance; } @@ -79,14 +46,3 @@ namespace SQConvert { template <> inline const ScriptCargoList_StationAccepting &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptCargoList_StationAccepting *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptCargoList_StationAccepting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "CargoList_StationAccepting", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AICargoList_StationAccepting"; } - -void SQAICargoList_StationAccepting_Register(Squirrel *engine) -{ - DefSQClass SQAICargoList_StationAccepting("AICargoList_StationAccepting"); - SQAICargoList_StationAccepting.PreRegister(engine, "AIList"); - SQAICargoList_StationAccepting.AddConstructor(engine, "xi"); - - SQAICargoList_StationAccepting.PostRegister(engine); -} diff --git a/src/script/api/template/template_company.hpp.sq b/src/script/api/template/template_company.hpp.sq new file mode 100644 index 0000000000..5668e893e7 --- /dev/null +++ b/src/script/api/template/template_company.hpp.sq @@ -0,0 +1,29 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_company.hpp" + +namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptCompany::Quarter GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptCompany::Quarter)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptCompany::Quarter res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptCompany::CompanyID GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptCompany::CompanyID)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptCompany::CompanyID res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptCompany::Gender GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptCompany::Gender)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptCompany::Gender res) { sq_pushinteger(vm, (int32)res); return 1; } + + /* Allow ScriptCompany to be used as Squirrel parameter */ + template <> inline ScriptCompany *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptCompany *)instance; } + template <> inline ScriptCompany &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptCompany *)instance; } + template <> inline const ScriptCompany *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptCompany *)instance; } + template <> inline const ScriptCompany &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptCompany *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptCompany *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Company", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert diff --git a/src/ai/api/ai_date.hpp.sq b/src/script/api/template/template_date.hpp.sq similarity index 70% rename from src/ai/api/ai_date.hpp.sq rename to src/script/api/template/template_date.hpp.sq index 2b0297e114..976ddb7a50 100644 --- a/src/ai/api/ai_date.hpp.sq +++ b/src/script/api/template/template_date.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_date.hpp" +#include "../script_date.hpp" namespace SQConvert { /* Allow ScriptDate to be used as Squirrel parameter */ @@ -19,20 +19,3 @@ namespace SQConvert { template <> inline const ScriptDate &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptDate *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptDate *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Date", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AIDate"; } - -void SQAIDate_Register(Squirrel *engine) -{ - DefSQClass SQAIDate("AIDate"); - SQAIDate.PreRegister(engine); - SQAIDate.AddConstructor(engine, "x"); - - SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetCurrentDate, "GetCurrentDate", 1, "."); - SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetYear, "GetYear", 2, ".i"); - SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetMonth, "GetMonth", 2, ".i"); - SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetDayOfMonth, "GetDayOfMonth", 2, ".i"); - SQAIDate.DefSQStaticMethod(engine, &ScriptDate::GetDate, "GetDate", 4, ".iii"); - - SQAIDate.PostRegister(engine); -} diff --git a/src/ai/api/ai_depotlist.hpp.sq b/src/script/api/template/template_depotlist.hpp.sq similarity index 81% rename from src/ai/api/ai_depotlist.hpp.sq rename to src/script/api/template/template_depotlist.hpp.sq index cf2edd45ba..f5fcbcf544 100644 --- a/src/ai/api/ai_depotlist.hpp.sq +++ b/src/script/api/template/template_depotlist.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_depotlist.hpp" +#include "../script_depotlist.hpp" namespace SQConvert { /* Allow ScriptDepotList to be used as Squirrel parameter */ @@ -19,14 +19,3 @@ namespace SQConvert { template <> inline const ScriptDepotList &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptDepotList *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptDepotList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "DepotList", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AIDepotList"; } - -void SQAIDepotList_Register(Squirrel *engine) -{ - DefSQClass SQAIDepotList("AIDepotList"); - SQAIDepotList.PreRegister(engine, "AIList"); - SQAIDepotList.AddConstructor(engine, "xi"); - - SQAIDepotList.PostRegister(engine); -} diff --git a/src/script/api/template/template_engine.hpp.sq b/src/script/api/template/template_engine.hpp.sq new file mode 100644 index 0000000000..3d652df9e8 --- /dev/null +++ b/src/script/api/template/template_engine.hpp.sq @@ -0,0 +1,21 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_engine.hpp" + +namespace SQConvert { + /* Allow ScriptEngine to be used as Squirrel parameter */ + template <> inline ScriptEngine *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEngine *)instance; } + template <> inline ScriptEngine &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEngine *)instance; } + template <> inline const ScriptEngine *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEngine *)instance; } + template <> inline const ScriptEngine &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEngine *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptEngine *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Engine", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert diff --git a/src/ai/api/ai_enginelist.hpp.sq b/src/script/api/template/template_enginelist.hpp.sq similarity index 81% rename from src/ai/api/ai_enginelist.hpp.sq rename to src/script/api/template/template_enginelist.hpp.sq index 984e58df19..f17c244eb6 100644 --- a/src/ai/api/ai_enginelist.hpp.sq +++ b/src/script/api/template/template_enginelist.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_enginelist.hpp" +#include "../script_enginelist.hpp" namespace SQConvert { /* Allow ScriptEngineList to be used as Squirrel parameter */ @@ -19,14 +19,3 @@ namespace SQConvert { template <> inline const ScriptEngineList &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEngineList *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptEngineList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EngineList", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AIEngineList"; } - -void SQAIEngineList_Register(Squirrel *engine) -{ - DefSQClass SQAIEngineList("AIEngineList"); - SQAIEngineList.PreRegister(engine, "AIList"); - SQAIEngineList.AddConstructor(engine, "xi"); - - SQAIEngineList.PostRegister(engine); -} diff --git a/src/script/api/template/template_error.hpp.sq b/src/script/api/template/template_error.hpp.sq new file mode 100644 index 0000000000..8e61f08103 --- /dev/null +++ b/src/script/api/template/template_error.hpp.sq @@ -0,0 +1,27 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_error.hpp" + +namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptError::ErrorCategories GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptError::ErrorCategories)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptError::ErrorCategories res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptError::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptError::ErrorMessages)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptError::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } + + /* Allow ScriptError to be used as Squirrel parameter */ + template <> inline ScriptError *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptError *)instance; } + template <> inline ScriptError &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptError *)instance; } + template <> inline const ScriptError *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptError *)instance; } + template <> inline const ScriptError &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptError *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptError *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Error", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert diff --git a/src/script/api/template/template_event.hpp.sq b/src/script/api/template/template_event.hpp.sq new file mode 100644 index 0000000000..c0a8afdc93 --- /dev/null +++ b/src/script/api/template/template_event.hpp.sq @@ -0,0 +1,34 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_event.hpp" + +namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptEvent::ScriptEventType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptEvent::ScriptEventType)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptEvent::ScriptEventType res) { sq_pushinteger(vm, (int32)res); return 1; } + + /* Allow ScriptEvent to be used as Squirrel parameter */ + template <> inline ScriptEvent *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEvent *)instance; } + template <> inline ScriptEvent &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEvent *)instance; } + template <> inline const ScriptEvent *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEvent *)instance; } + template <> inline const ScriptEvent &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEvent *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptEvent *res) { if (res == NULL) { sq_pushnull(vm); return 1; } Squirrel::CreateClassInstanceVM(vm, "Event", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert + +namespace SQConvert { + /* Allow ScriptEventController to be used as Squirrel parameter */ + template <> inline ScriptEventController *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventController *)instance; } + template <> inline ScriptEventController &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventController *)instance; } + template <> inline const ScriptEventController *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventController *)instance; } + template <> inline const ScriptEventController &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventController *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptEventController *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventController", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert diff --git a/src/ai/api/ai_event_types.hpp.sq b/src/script/api/template/template_event_types.hpp.sq similarity index 68% rename from src/ai/api/ai_event_types.hpp.sq rename to src/script/api/template/template_event_types.hpp.sq index 0d68c31d13..3efecb68a9 100644 --- a/src/ai/api/ai_event_types.hpp.sq +++ b/src/script/api/template/template_event_types.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_event_types.hpp" +#include "../script_event_types.hpp" namespace SQConvert { /* Allow enums to be used as Squirrel parameters */ @@ -24,29 +24,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptEventVehicleCrashed *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventVehicleCrashed", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIEventVehicleCrashed"; } - -void SQAIEventVehicleCrashed_Register(Squirrel *engine) -{ - DefSQClass SQAIEventVehicleCrashed("AIEventVehicleCrashed"); - SQAIEventVehicleCrashed.PreRegister(engine, "AIEvent"); - - SQAIEventVehicleCrashed.DefSQConst(engine, ScriptEventVehicleCrashed::CRASH_TRAIN, "CRASH_TRAIN"); - SQAIEventVehicleCrashed.DefSQConst(engine, ScriptEventVehicleCrashed::CRASH_RV_LEVEL_CROSSING, "CRASH_RV_LEVEL_CROSSING"); - SQAIEventVehicleCrashed.DefSQConst(engine, ScriptEventVehicleCrashed::CRASH_RV_UFO, "CRASH_RV_UFO"); - SQAIEventVehicleCrashed.DefSQConst(engine, ScriptEventVehicleCrashed::CRASH_PLANE_LANDING, "CRASH_PLANE_LANDING"); - SQAIEventVehicleCrashed.DefSQConst(engine, ScriptEventVehicleCrashed::CRASH_AIRCRAFT_NO_AIRPORT, "CRASH_AIRCRAFT_NO_AIRPORT"); - SQAIEventVehicleCrashed.DefSQConst(engine, ScriptEventVehicleCrashed::CRASH_FLOODED, "CRASH_FLOODED"); - - SQAIEventVehicleCrashed.DefSQStaticMethod(engine, &ScriptEventVehicleCrashed::Convert, "Convert", 2, ".x"); - - SQAIEventVehicleCrashed.DefSQMethod(engine, &ScriptEventVehicleCrashed::GetVehicleID, "GetVehicleID", 1, "x"); - SQAIEventVehicleCrashed.DefSQMethod(engine, &ScriptEventVehicleCrashed::GetCrashSite, "GetCrashSite", 1, "x"); - SQAIEventVehicleCrashed.DefSQMethod(engine, &ScriptEventVehicleCrashed::GetCrashReason, "GetCrashReason", 1, "x"); - - SQAIEventVehicleCrashed.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptEventSubsidyOffer to be used as Squirrel parameter */ template <> inline ScriptEventSubsidyOffer *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventSubsidyOffer *)instance; } @@ -56,20 +33,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptEventSubsidyOffer *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventSubsidyOffer", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIEventSubsidyOffer"; } - -void SQAIEventSubsidyOffer_Register(Squirrel *engine) -{ - DefSQClass SQAIEventSubsidyOffer("AIEventSubsidyOffer"); - SQAIEventSubsidyOffer.PreRegister(engine, "AIEvent"); - - SQAIEventSubsidyOffer.DefSQStaticMethod(engine, &ScriptEventSubsidyOffer::Convert, "Convert", 2, ".x"); - - SQAIEventSubsidyOffer.DefSQMethod(engine, &ScriptEventSubsidyOffer::GetSubsidyID, "GetSubsidyID", 1, "x"); - - SQAIEventSubsidyOffer.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptEventSubsidyOfferExpired to be used as Squirrel parameter */ template <> inline ScriptEventSubsidyOfferExpired *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventSubsidyOfferExpired *)instance; } @@ -79,20 +42,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptEventSubsidyOfferExpired *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventSubsidyOfferExpired", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIEventSubsidyOfferExpired"; } - -void SQAIEventSubsidyOfferExpired_Register(Squirrel *engine) -{ - DefSQClass SQAIEventSubsidyOfferExpired("AIEventSubsidyOfferExpired"); - SQAIEventSubsidyOfferExpired.PreRegister(engine, "AIEvent"); - - SQAIEventSubsidyOfferExpired.DefSQStaticMethod(engine, &ScriptEventSubsidyOfferExpired::Convert, "Convert", 2, ".x"); - - SQAIEventSubsidyOfferExpired.DefSQMethod(engine, &ScriptEventSubsidyOfferExpired::GetSubsidyID, "GetSubsidyID", 1, "x"); - - SQAIEventSubsidyOfferExpired.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptEventSubsidyAwarded to be used as Squirrel parameter */ template <> inline ScriptEventSubsidyAwarded *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventSubsidyAwarded *)instance; } @@ -102,20 +51,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptEventSubsidyAwarded *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventSubsidyAwarded", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIEventSubsidyAwarded"; } - -void SQAIEventSubsidyAwarded_Register(Squirrel *engine) -{ - DefSQClass SQAIEventSubsidyAwarded("AIEventSubsidyAwarded"); - SQAIEventSubsidyAwarded.PreRegister(engine, "AIEvent"); - - SQAIEventSubsidyAwarded.DefSQStaticMethod(engine, &ScriptEventSubsidyAwarded::Convert, "Convert", 2, ".x"); - - SQAIEventSubsidyAwarded.DefSQMethod(engine, &ScriptEventSubsidyAwarded::GetSubsidyID, "GetSubsidyID", 1, "x"); - - SQAIEventSubsidyAwarded.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptEventSubsidyExpired to be used as Squirrel parameter */ template <> inline ScriptEventSubsidyExpired *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventSubsidyExpired *)instance; } @@ -125,20 +60,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptEventSubsidyExpired *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventSubsidyExpired", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIEventSubsidyExpired"; } - -void SQAIEventSubsidyExpired_Register(Squirrel *engine) -{ - DefSQClass SQAIEventSubsidyExpired("AIEventSubsidyExpired"); - SQAIEventSubsidyExpired.PreRegister(engine, "AIEvent"); - - SQAIEventSubsidyExpired.DefSQStaticMethod(engine, &ScriptEventSubsidyExpired::Convert, "Convert", 2, ".x"); - - SQAIEventSubsidyExpired.DefSQMethod(engine, &ScriptEventSubsidyExpired::GetSubsidyID, "GetSubsidyID", 1, "x"); - - SQAIEventSubsidyExpired.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptEventEnginePreview to be used as Squirrel parameter */ template <> inline ScriptEventEnginePreview *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventEnginePreview *)instance; } @@ -148,27 +69,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptEventEnginePreview *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventEnginePreview", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIEventEnginePreview"; } - -void SQAIEventEnginePreview_Register(Squirrel *engine) -{ - DefSQClass SQAIEventEnginePreview("AIEventEnginePreview"); - SQAIEventEnginePreview.PreRegister(engine, "AIEvent"); - - SQAIEventEnginePreview.DefSQStaticMethod(engine, &ScriptEventEnginePreview::Convert, "Convert", 2, ".x"); - - SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetName, "GetName", 1, "x"); - SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetCargoType, "GetCargoType", 1, "x"); - SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetCapacity, "GetCapacity", 1, "x"); - SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetMaxSpeed, "GetMaxSpeed", 1, "x"); - SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetPrice, "GetPrice", 1, "x"); - SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetRunningCost, "GetRunningCost", 1, "x"); - SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::GetVehicleType, "GetVehicleType", 1, "x"); - SQAIEventEnginePreview.DefSQMethod(engine, &ScriptEventEnginePreview::AcceptPreview, "AcceptPreview", 1, "x"); - - SQAIEventEnginePreview.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptEventCompanyNew to be used as Squirrel parameter */ template <> inline ScriptEventCompanyNew *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventCompanyNew *)instance; } @@ -178,20 +78,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptEventCompanyNew *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventCompanyNew", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIEventCompanyNew"; } - -void SQAIEventCompanyNew_Register(Squirrel *engine) -{ - DefSQClass SQAIEventCompanyNew("AIEventCompanyNew"); - SQAIEventCompanyNew.PreRegister(engine, "AIEvent"); - - SQAIEventCompanyNew.DefSQStaticMethod(engine, &ScriptEventCompanyNew::Convert, "Convert", 2, ".x"); - - SQAIEventCompanyNew.DefSQMethod(engine, &ScriptEventCompanyNew::GetCompanyID, "GetCompanyID", 1, "x"); - - SQAIEventCompanyNew.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptEventCompanyInTrouble to be used as Squirrel parameter */ template <> inline ScriptEventCompanyInTrouble *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventCompanyInTrouble *)instance; } @@ -201,20 +87,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptEventCompanyInTrouble *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventCompanyInTrouble", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIEventCompanyInTrouble"; } - -void SQAIEventCompanyInTrouble_Register(Squirrel *engine) -{ - DefSQClass SQAIEventCompanyInTrouble("AIEventCompanyInTrouble"); - SQAIEventCompanyInTrouble.PreRegister(engine, "AIEvent"); - - SQAIEventCompanyInTrouble.DefSQStaticMethod(engine, &ScriptEventCompanyInTrouble::Convert, "Convert", 2, ".x"); - - SQAIEventCompanyInTrouble.DefSQMethod(engine, &ScriptEventCompanyInTrouble::GetCompanyID, "GetCompanyID", 1, "x"); - - SQAIEventCompanyInTrouble.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptEventCompanyAskMerger to be used as Squirrel parameter */ template <> inline ScriptEventCompanyAskMerger *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventCompanyAskMerger *)instance; } @@ -224,22 +96,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptEventCompanyAskMerger *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventCompanyAskMerger", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIEventCompanyAskMerger"; } - -void SQAIEventCompanyAskMerger_Register(Squirrel *engine) -{ - DefSQClass SQAIEventCompanyAskMerger("AIEventCompanyAskMerger"); - SQAIEventCompanyAskMerger.PreRegister(engine, "AIEvent"); - - SQAIEventCompanyAskMerger.DefSQStaticMethod(engine, &ScriptEventCompanyAskMerger::Convert, "Convert", 2, ".x"); - - SQAIEventCompanyAskMerger.DefSQMethod(engine, &ScriptEventCompanyAskMerger::GetCompanyID, "GetCompanyID", 1, "x"); - SQAIEventCompanyAskMerger.DefSQMethod(engine, &ScriptEventCompanyAskMerger::GetValue, "GetValue", 1, "x"); - SQAIEventCompanyAskMerger.DefSQMethod(engine, &ScriptEventCompanyAskMerger::AcceptMerger, "AcceptMerger", 1, "x"); - - SQAIEventCompanyAskMerger.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptEventCompanyMerger to be used as Squirrel parameter */ template <> inline ScriptEventCompanyMerger *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventCompanyMerger *)instance; } @@ -249,21 +105,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptEventCompanyMerger *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventCompanyMerger", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIEventCompanyMerger"; } - -void SQAIEventCompanyMerger_Register(Squirrel *engine) -{ - DefSQClass SQAIEventCompanyMerger("AIEventCompanyMerger"); - SQAIEventCompanyMerger.PreRegister(engine, "AIEvent"); - - SQAIEventCompanyMerger.DefSQStaticMethod(engine, &ScriptEventCompanyMerger::Convert, "Convert", 2, ".x"); - - SQAIEventCompanyMerger.DefSQMethod(engine, &ScriptEventCompanyMerger::GetOldCompanyID, "GetOldCompanyID", 1, "x"); - SQAIEventCompanyMerger.DefSQMethod(engine, &ScriptEventCompanyMerger::GetNewCompanyID, "GetNewCompanyID", 1, "x"); - - SQAIEventCompanyMerger.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptEventCompanyBankrupt to be used as Squirrel parameter */ template <> inline ScriptEventCompanyBankrupt *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventCompanyBankrupt *)instance; } @@ -273,20 +114,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptEventCompanyBankrupt *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventCompanyBankrupt", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIEventCompanyBankrupt"; } - -void SQAIEventCompanyBankrupt_Register(Squirrel *engine) -{ - DefSQClass SQAIEventCompanyBankrupt("AIEventCompanyBankrupt"); - SQAIEventCompanyBankrupt.PreRegister(engine, "AIEvent"); - - SQAIEventCompanyBankrupt.DefSQStaticMethod(engine, &ScriptEventCompanyBankrupt::Convert, "Convert", 2, ".x"); - - SQAIEventCompanyBankrupt.DefSQMethod(engine, &ScriptEventCompanyBankrupt::GetCompanyID, "GetCompanyID", 1, "x"); - - SQAIEventCompanyBankrupt.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptEventVehicleLost to be used as Squirrel parameter */ template <> inline ScriptEventVehicleLost *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventVehicleLost *)instance; } @@ -296,20 +123,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptEventVehicleLost *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventVehicleLost", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIEventVehicleLost"; } - -void SQAIEventVehicleLost_Register(Squirrel *engine) -{ - DefSQClass SQAIEventVehicleLost("AIEventVehicleLost"); - SQAIEventVehicleLost.PreRegister(engine, "AIEvent"); - - SQAIEventVehicleLost.DefSQStaticMethod(engine, &ScriptEventVehicleLost::Convert, "Convert", 2, ".x"); - - SQAIEventVehicleLost.DefSQMethod(engine, &ScriptEventVehicleLost::GetVehicleID, "GetVehicleID", 1, "x"); - - SQAIEventVehicleLost.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptEventVehicleWaitingInDepot to be used as Squirrel parameter */ template <> inline ScriptEventVehicleWaitingInDepot *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventVehicleWaitingInDepot *)instance; } @@ -319,20 +132,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptEventVehicleWaitingInDepot *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventVehicleWaitingInDepot", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIEventVehicleWaitingInDepot"; } - -void SQAIEventVehicleWaitingInDepot_Register(Squirrel *engine) -{ - DefSQClass SQAIEventVehicleWaitingInDepot("AIEventVehicleWaitingInDepot"); - SQAIEventVehicleWaitingInDepot.PreRegister(engine, "AIEvent"); - - SQAIEventVehicleWaitingInDepot.DefSQStaticMethod(engine, &ScriptEventVehicleWaitingInDepot::Convert, "Convert", 2, ".x"); - - SQAIEventVehicleWaitingInDepot.DefSQMethod(engine, &ScriptEventVehicleWaitingInDepot::GetVehicleID, "GetVehicleID", 1, "x"); - - SQAIEventVehicleWaitingInDepot.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptEventVehicleUnprofitable to be used as Squirrel parameter */ template <> inline ScriptEventVehicleUnprofitable *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventVehicleUnprofitable *)instance; } @@ -342,20 +141,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptEventVehicleUnprofitable *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventVehicleUnprofitable", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIEventVehicleUnprofitable"; } - -void SQAIEventVehicleUnprofitable_Register(Squirrel *engine) -{ - DefSQClass SQAIEventVehicleUnprofitable("AIEventVehicleUnprofitable"); - SQAIEventVehicleUnprofitable.PreRegister(engine, "AIEvent"); - - SQAIEventVehicleUnprofitable.DefSQStaticMethod(engine, &ScriptEventVehicleUnprofitable::Convert, "Convert", 2, ".x"); - - SQAIEventVehicleUnprofitable.DefSQMethod(engine, &ScriptEventVehicleUnprofitable::GetVehicleID, "GetVehicleID", 1, "x"); - - SQAIEventVehicleUnprofitable.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptEventIndustryOpen to be used as Squirrel parameter */ template <> inline ScriptEventIndustryOpen *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventIndustryOpen *)instance; } @@ -365,20 +150,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptEventIndustryOpen *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventIndustryOpen", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIEventIndustryOpen"; } - -void SQAIEventIndustryOpen_Register(Squirrel *engine) -{ - DefSQClass SQAIEventIndustryOpen("AIEventIndustryOpen"); - SQAIEventIndustryOpen.PreRegister(engine, "AIEvent"); - - SQAIEventIndustryOpen.DefSQStaticMethod(engine, &ScriptEventIndustryOpen::Convert, "Convert", 2, ".x"); - - SQAIEventIndustryOpen.DefSQMethod(engine, &ScriptEventIndustryOpen::GetIndustryID, "GetIndustryID", 1, "x"); - - SQAIEventIndustryOpen.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptEventIndustryClose to be used as Squirrel parameter */ template <> inline ScriptEventIndustryClose *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventIndustryClose *)instance; } @@ -388,20 +159,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptEventIndustryClose *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventIndustryClose", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIEventIndustryClose"; } - -void SQAIEventIndustryClose_Register(Squirrel *engine) -{ - DefSQClass SQAIEventIndustryClose("AIEventIndustryClose"); - SQAIEventIndustryClose.PreRegister(engine, "AIEvent"); - - SQAIEventIndustryClose.DefSQStaticMethod(engine, &ScriptEventIndustryClose::Convert, "Convert", 2, ".x"); - - SQAIEventIndustryClose.DefSQMethod(engine, &ScriptEventIndustryClose::GetIndustryID, "GetIndustryID", 1, "x"); - - SQAIEventIndustryClose.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptEventEngineAvailable to be used as Squirrel parameter */ template <> inline ScriptEventEngineAvailable *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventEngineAvailable *)instance; } @@ -411,20 +168,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptEventEngineAvailable *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventEngineAvailable", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIEventEngineAvailable"; } - -void SQAIEventEngineAvailable_Register(Squirrel *engine) -{ - DefSQClass SQAIEventEngineAvailable("AIEventEngineAvailable"); - SQAIEventEngineAvailable.PreRegister(engine, "AIEvent"); - - SQAIEventEngineAvailable.DefSQStaticMethod(engine, &ScriptEventEngineAvailable::Convert, "Convert", 2, ".x"); - - SQAIEventEngineAvailable.DefSQMethod(engine, &ScriptEventEngineAvailable::GetEngineID, "GetEngineID", 1, "x"); - - SQAIEventEngineAvailable.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptEventStationFirstVehicle to be used as Squirrel parameter */ template <> inline ScriptEventStationFirstVehicle *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventStationFirstVehicle *)instance; } @@ -434,21 +177,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptEventStationFirstVehicle *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventStationFirstVehicle", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIEventStationFirstVehicle"; } - -void SQAIEventStationFirstVehicle_Register(Squirrel *engine) -{ - DefSQClass SQAIEventStationFirstVehicle("AIEventStationFirstVehicle"); - SQAIEventStationFirstVehicle.PreRegister(engine, "AIEvent"); - - SQAIEventStationFirstVehicle.DefSQStaticMethod(engine, &ScriptEventStationFirstVehicle::Convert, "Convert", 2, ".x"); - - SQAIEventStationFirstVehicle.DefSQMethod(engine, &ScriptEventStationFirstVehicle::GetStationID, "GetStationID", 1, "x"); - SQAIEventStationFirstVehicle.DefSQMethod(engine, &ScriptEventStationFirstVehicle::GetVehicleID, "GetVehicleID", 1, "x"); - - SQAIEventStationFirstVehicle.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptEventDisasterZeppelinerCrashed to be used as Squirrel parameter */ template <> inline ScriptEventDisasterZeppelinerCrashed *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventDisasterZeppelinerCrashed *)instance; } @@ -458,20 +186,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptEventDisasterZeppelinerCrashed *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventDisasterZeppelinerCrashed", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIEventDisasterZeppelinerCrashed"; } - -void SQAIEventDisasterZeppelinerCrashed_Register(Squirrel *engine) -{ - DefSQClass SQAIEventDisasterZeppelinerCrashed("AIEventDisasterZeppelinerCrashed"); - SQAIEventDisasterZeppelinerCrashed.PreRegister(engine, "AIEvent"); - - SQAIEventDisasterZeppelinerCrashed.DefSQStaticMethod(engine, &ScriptEventDisasterZeppelinerCrashed::Convert, "Convert", 2, ".x"); - - SQAIEventDisasterZeppelinerCrashed.DefSQMethod(engine, &ScriptEventDisasterZeppelinerCrashed::GetStationID, "GetStationID", 1, "x"); - - SQAIEventDisasterZeppelinerCrashed.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptEventDisasterZeppelinerCleared to be used as Squirrel parameter */ template <> inline ScriptEventDisasterZeppelinerCleared *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventDisasterZeppelinerCleared *)instance; } @@ -481,20 +195,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptEventDisasterZeppelinerCleared *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventDisasterZeppelinerCleared", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIEventDisasterZeppelinerCleared"; } - -void SQAIEventDisasterZeppelinerCleared_Register(Squirrel *engine) -{ - DefSQClass SQAIEventDisasterZeppelinerCleared("AIEventDisasterZeppelinerCleared"); - SQAIEventDisasterZeppelinerCleared.PreRegister(engine, "AIEvent"); - - SQAIEventDisasterZeppelinerCleared.DefSQStaticMethod(engine, &ScriptEventDisasterZeppelinerCleared::Convert, "Convert", 2, ".x"); - - SQAIEventDisasterZeppelinerCleared.DefSQMethod(engine, &ScriptEventDisasterZeppelinerCleared::GetStationID, "GetStationID", 1, "x"); - - SQAIEventDisasterZeppelinerCleared.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptEventTownFounded to be used as Squirrel parameter */ template <> inline ScriptEventTownFounded *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptEventTownFounded *)instance; } @@ -503,17 +203,3 @@ namespace SQConvert { template <> inline const ScriptEventTownFounded &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptEventTownFounded *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptEventTownFounded *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "EventTownFounded", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AIEventTownFounded"; } - -void SQAIEventTownFounded_Register(Squirrel *engine) -{ - DefSQClass SQAIEventTownFounded("AIEventTownFounded"); - SQAIEventTownFounded.PreRegister(engine, "AIEvent"); - - SQAIEventTownFounded.DefSQStaticMethod(engine, &ScriptEventTownFounded::Convert, "Convert", 2, ".x"); - - SQAIEventTownFounded.DefSQMethod(engine, &ScriptEventTownFounded::GetTownID, "GetTownID", 1, "x"); - - SQAIEventTownFounded.PostRegister(engine); -} diff --git a/src/ai/api/ai_execmode.hpp.sq b/src/script/api/template/template_execmode.hpp.sq similarity index 83% rename from src/ai/api/ai_execmode.hpp.sq rename to src/script/api/template/template_execmode.hpp.sq index 11e176af95..4c8326bc17 100644 --- a/src/ai/api/ai_execmode.hpp.sq +++ b/src/script/api/template/template_execmode.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_execmode.hpp" +#include "../script_execmode.hpp" namespace SQConvert { /* Allow ScriptExecMode to be used as Squirrel parameter */ @@ -19,14 +19,3 @@ namespace SQConvert { template <> inline const ScriptExecMode &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptExecMode *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptExecMode *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "ExecMode", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AIExecMode"; } - -void SQAIExecMode_Register(Squirrel *engine) -{ - DefSQClass SQAIExecMode("AIExecMode"); - SQAIExecMode.PreRegister(engine); - SQAIExecMode.AddConstructor(engine, "x"); - - SQAIExecMode.PostRegister(engine); -} diff --git a/src/ai/api/ai_gamesettings.hpp.sq b/src/script/api/template/template_gamesettings.hpp.sq similarity index 71% rename from src/ai/api/ai_gamesettings.hpp.sq rename to src/script/api/template/template_gamesettings.hpp.sq index 42a13a3026..9c6e91746c 100644 --- a/src/ai/api/ai_gamesettings.hpp.sq +++ b/src/script/api/template/template_gamesettings.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_gamesettings.hpp" +#include "../script_gamesettings.hpp" namespace SQConvert { /* Allow ScriptGameSettings to be used as Squirrel parameter */ @@ -19,18 +19,3 @@ namespace SQConvert { template <> inline const ScriptGameSettings &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptGameSettings *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptGameSettings *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "GameSettings", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AIGameSettings"; } - -void SQAIGameSettings_Register(Squirrel *engine) -{ - DefSQClass SQAIGameSettings("AIGameSettings"); - SQAIGameSettings.PreRegister(engine); - SQAIGameSettings.AddConstructor(engine, "x"); - - SQAIGameSettings.DefSQStaticMethod(engine, &ScriptGameSettings::IsValid, "IsValid", 2, ".."); - SQAIGameSettings.DefSQStaticMethod(engine, &ScriptGameSettings::GetValue, "GetValue", 2, ".."); - SQAIGameSettings.DefSQStaticMethod(engine, &ScriptGameSettings::IsDisabledVehicleType, "IsDisabledVehicleType", 2, ".i"); - - SQAIGameSettings.PostRegister(engine); -} diff --git a/src/script/api/template/template_group.hpp.sq b/src/script/api/template/template_group.hpp.sq new file mode 100644 index 0000000000..ac4abe5a17 --- /dev/null +++ b/src/script/api/template/template_group.hpp.sq @@ -0,0 +1,25 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_group.hpp" + +namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptGroup::GroupID GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptGroup::GroupID)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptGroup::GroupID res) { sq_pushinteger(vm, (int32)res); return 1; } + + /* Allow ScriptGroup to be used as Squirrel parameter */ + template <> inline ScriptGroup *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptGroup *)instance; } + template <> inline ScriptGroup &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptGroup *)instance; } + template <> inline const ScriptGroup *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptGroup *)instance; } + template <> inline const ScriptGroup &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptGroup *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptGroup *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Group", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert diff --git a/src/ai/api/ai_grouplist.hpp.sq b/src/script/api/template/template_grouplist.hpp.sq similarity index 82% rename from src/ai/api/ai_grouplist.hpp.sq rename to src/script/api/template/template_grouplist.hpp.sq index 30ff61b91a..858abcf015 100644 --- a/src/ai/api/ai_grouplist.hpp.sq +++ b/src/script/api/template/template_grouplist.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_grouplist.hpp" +#include "../script_grouplist.hpp" namespace SQConvert { /* Allow ScriptGroupList to be used as Squirrel parameter */ @@ -19,14 +19,3 @@ namespace SQConvert { template <> inline const ScriptGroupList &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptGroupList *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptGroupList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "GroupList", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AIGroupList"; } - -void SQAIGroupList_Register(Squirrel *engine) -{ - DefSQClass SQAIGroupList("AIGroupList"); - SQAIGroupList.PreRegister(engine, "AIList"); - SQAIGroupList.AddConstructor(engine, "x"); - - SQAIGroupList.PostRegister(engine); -} diff --git a/src/script/api/template/template_industry.hpp.sq b/src/script/api/template/template_industry.hpp.sq new file mode 100644 index 0000000000..e1e02263c6 --- /dev/null +++ b/src/script/api/template/template_industry.hpp.sq @@ -0,0 +1,25 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_industry.hpp" + +namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptIndustry::CargoAcceptState GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptIndustry::CargoAcceptState)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptIndustry::CargoAcceptState res) { sq_pushinteger(vm, (int32)res); return 1; } + + /* Allow ScriptIndustry to be used as Squirrel parameter */ + template <> inline ScriptIndustry *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptIndustry *)instance; } + template <> inline ScriptIndustry &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustry *)instance; } + template <> inline const ScriptIndustry *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptIndustry *)instance; } + template <> inline const ScriptIndustry &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustry *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptIndustry *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Industry", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert diff --git a/src/ai/api/ai_industrylist.hpp.sq b/src/script/api/template/template_industrylist.hpp.sq similarity index 77% rename from src/ai/api/ai_industrylist.hpp.sq rename to src/script/api/template/template_industrylist.hpp.sq index 5702d1b634..0c0316346a 100644 --- a/src/ai/api/ai_industrylist.hpp.sq +++ b/src/script/api/template/template_industrylist.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_industrylist.hpp" +#include "../script_industrylist.hpp" namespace SQConvert { /* Allow ScriptIndustryList to be used as Squirrel parameter */ @@ -20,17 +20,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptIndustryList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "IndustryList", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIIndustryList"; } - -void SQAIIndustryList_Register(Squirrel *engine) -{ - DefSQClass SQAIIndustryList("AIIndustryList"); - SQAIIndustryList.PreRegister(engine, "AIList"); - SQAIIndustryList.AddConstructor(engine, "x"); - - SQAIIndustryList.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptIndustryList_CargoAccepting to be used as Squirrel parameter */ template <> inline ScriptIndustryList_CargoAccepting *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptIndustryList_CargoAccepting *)instance; } @@ -40,17 +29,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptIndustryList_CargoAccepting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "IndustryList_CargoAccepting", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIIndustryList_CargoAccepting"; } - -void SQAIIndustryList_CargoAccepting_Register(Squirrel *engine) -{ - DefSQClass SQAIIndustryList_CargoAccepting("AIIndustryList_CargoAccepting"); - SQAIIndustryList_CargoAccepting.PreRegister(engine, "AIList"); - SQAIIndustryList_CargoAccepting.AddConstructor(engine, "xi"); - - SQAIIndustryList_CargoAccepting.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptIndustryList_CargoProducing to be used as Squirrel parameter */ template <> inline ScriptIndustryList_CargoProducing *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptIndustryList_CargoProducing *)instance; } @@ -59,14 +37,3 @@ namespace SQConvert { template <> inline const ScriptIndustryList_CargoProducing &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustryList_CargoProducing *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptIndustryList_CargoProducing *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "IndustryList_CargoProducing", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AIIndustryList_CargoProducing"; } - -void SQAIIndustryList_CargoProducing_Register(Squirrel *engine) -{ - DefSQClass SQAIIndustryList_CargoProducing("AIIndustryList_CargoProducing"); - SQAIIndustryList_CargoProducing.PreRegister(engine, "AIList"); - SQAIIndustryList_CargoProducing.AddConstructor(engine, "xi"); - - SQAIIndustryList_CargoProducing.PostRegister(engine); -} diff --git a/src/script/api/template/template_industrytype.hpp.sq b/src/script/api/template/template_industrytype.hpp.sq new file mode 100644 index 0000000000..79495053ea --- /dev/null +++ b/src/script/api/template/template_industrytype.hpp.sq @@ -0,0 +1,25 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_industrytype.hpp" + +namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptIndustryType::SpecialIndustryType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptIndustryType::SpecialIndustryType)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptIndustryType::SpecialIndustryType res) { sq_pushinteger(vm, (int32)res); return 1; } + + /* Allow ScriptIndustryType to be used as Squirrel parameter */ + template <> inline ScriptIndustryType *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptIndustryType *)instance; } + template <> inline ScriptIndustryType &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustryType *)instance; } + template <> inline const ScriptIndustryType *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptIndustryType *)instance; } + template <> inline const ScriptIndustryType &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustryType *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptIndustryType *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "IndustryType", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert diff --git a/src/ai/api/ai_industrytypelist.hpp.sq b/src/script/api/template/template_industrytypelist.hpp.sq similarity index 81% rename from src/ai/api/ai_industrytypelist.hpp.sq rename to src/script/api/template/template_industrytypelist.hpp.sq index 7953ece2b8..044f9ccedf 100644 --- a/src/ai/api/ai_industrytypelist.hpp.sq +++ b/src/script/api/template/template_industrytypelist.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_industrytypelist.hpp" +#include "../script_industrytypelist.hpp" namespace SQConvert { /* Allow ScriptIndustryTypeList to be used as Squirrel parameter */ @@ -19,14 +19,3 @@ namespace SQConvert { template <> inline const ScriptIndustryTypeList &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptIndustryTypeList *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptIndustryTypeList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "IndustryTypeList", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AIIndustryTypeList"; } - -void SQAIIndustryTypeList_Register(Squirrel *engine) -{ - DefSQClass SQAIIndustryTypeList("AIIndustryTypeList"); - SQAIIndustryTypeList.PreRegister(engine, "AIList"); - SQAIIndustryTypeList.AddConstructor(engine, "x"); - - SQAIIndustryTypeList.PostRegister(engine); -} diff --git a/src/script/api/template/template_list.hpp.sq b/src/script/api/template/template_list.hpp.sq new file mode 100644 index 0000000000..fa8d2b36dc --- /dev/null +++ b/src/script/api/template/template_list.hpp.sq @@ -0,0 +1,25 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_list.hpp" + +namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptList::SorterType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptList::SorterType)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptList::SorterType res) { sq_pushinteger(vm, (int32)res); return 1; } + + /* Allow ScriptList to be used as Squirrel parameter */ + template <> inline ScriptList *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptList *)instance; } + template <> inline ScriptList &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptList *)instance; } + template <> inline const ScriptList *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptList *)instance; } + template <> inline const ScriptList &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptList *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "List", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert diff --git a/src/ai/api/ai_log.hpp.sq b/src/script/api/template/template_log.hpp.sq similarity index 76% rename from src/ai/api/ai_log.hpp.sq rename to src/script/api/template/template_log.hpp.sq index ef367ed7e7..4f3c9e7f1c 100644 --- a/src/ai/api/ai_log.hpp.sq +++ b/src/script/api/template/template_log.hpp.sq @@ -9,9 +9,13 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_log.hpp" +#include "../script_log.hpp" namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptLog::ScriptLogType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptLog::ScriptLogType)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptLog::ScriptLogType res) { sq_pushinteger(vm, (int32)res); return 1; } + /* Allow ScriptLog to be used as Squirrel parameter */ template <> inline ScriptLog *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptLog *)instance; } template <> inline ScriptLog &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptLog *)instance; } @@ -19,18 +23,3 @@ namespace SQConvert { template <> inline const ScriptLog &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptLog *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptLog *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Log", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AILog"; } - -void SQAILog_Register(Squirrel *engine) -{ - DefSQClass SQAILog("AILog"); - SQAILog.PreRegister(engine); - SQAILog.AddConstructor(engine, "x"); - - SQAILog.DefSQStaticMethod(engine, &ScriptLog::Info, "Info", 2, ".."); - SQAILog.DefSQStaticMethod(engine, &ScriptLog::Warning, "Warning", 2, ".."); - SQAILog.DefSQStaticMethod(engine, &ScriptLog::Error, "Error", 2, ".."); - - SQAILog.PostRegister(engine); -} diff --git a/src/script/api/template/template_map.hpp.sq b/src/script/api/template/template_map.hpp.sq new file mode 100644 index 0000000000..4d34cc734b --- /dev/null +++ b/src/script/api/template/template_map.hpp.sq @@ -0,0 +1,21 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_map.hpp" + +namespace SQConvert { + /* Allow ScriptMap to be used as Squirrel parameter */ + template <> inline ScriptMap *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptMap *)instance; } + template <> inline ScriptMap &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptMap *)instance; } + template <> inline const ScriptMap *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptMap *)instance; } + template <> inline const ScriptMap &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptMap *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptMap *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Map", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert diff --git a/src/script/api/template/template_marine.hpp.sq b/src/script/api/template/template_marine.hpp.sq new file mode 100644 index 0000000000..d2415b6994 --- /dev/null +++ b/src/script/api/template/template_marine.hpp.sq @@ -0,0 +1,27 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_marine.hpp" + +namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptMarine::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptMarine::ErrorMessages)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptMarine::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptMarine::BuildType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptMarine::BuildType)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptMarine::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; } + + /* Allow ScriptMarine to be used as Squirrel parameter */ + template <> inline ScriptMarine *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptMarine *)instance; } + template <> inline ScriptMarine &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptMarine *)instance; } + template <> inline const ScriptMarine *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptMarine *)instance; } + template <> inline const ScriptMarine &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptMarine *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptMarine *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Marine", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert diff --git a/src/script/api/template/template_order.hpp.sq b/src/script/api/template/template_order.hpp.sq new file mode 100644 index 0000000000..d11fafa14f --- /dev/null +++ b/src/script/api/template/template_order.hpp.sq @@ -0,0 +1,35 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_order.hpp" + +namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptOrder::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptOrder::ErrorMessages)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptOrder::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptOrder::ScriptOrderFlags GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptOrder::ScriptOrderFlags)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptOrder::ScriptOrderFlags res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptOrder::OrderCondition GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptOrder::OrderCondition)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptOrder::OrderCondition res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptOrder::CompareFunction GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptOrder::CompareFunction)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptOrder::CompareFunction res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptOrder::OrderPosition GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptOrder::OrderPosition)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptOrder::OrderPosition res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptOrder::StopLocation GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptOrder::StopLocation)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptOrder::StopLocation res) { sq_pushinteger(vm, (int32)res); return 1; } + + /* Allow ScriptOrder to be used as Squirrel parameter */ + template <> inline ScriptOrder *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptOrder *)instance; } + template <> inline ScriptOrder &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptOrder *)instance; } + template <> inline const ScriptOrder *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptOrder *)instance; } + template <> inline const ScriptOrder &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptOrder *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptOrder *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Order", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert diff --git a/src/script/api/template/template_rail.hpp.sq b/src/script/api/template/template_rail.hpp.sq new file mode 100644 index 0000000000..f92f96d587 --- /dev/null +++ b/src/script/api/template/template_rail.hpp.sq @@ -0,0 +1,33 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_rail.hpp" + +namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptRail::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRail::ErrorMessages)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptRail::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptRail::RailType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRail::RailType)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptRail::RailType res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptRail::RailTrack GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRail::RailTrack)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptRail::RailTrack res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptRail::SignalType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRail::SignalType)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptRail::SignalType res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptRail::BuildType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRail::BuildType)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptRail::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; } + + /* Allow ScriptRail to be used as Squirrel parameter */ + template <> inline ScriptRail *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptRail *)instance; } + template <> inline ScriptRail &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptRail *)instance; } + template <> inline const ScriptRail *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptRail *)instance; } + template <> inline const ScriptRail &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptRail *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptRail *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Rail", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert diff --git a/src/ai/api/ai_railtypelist.hpp.sq b/src/script/api/template/template_railtypelist.hpp.sq similarity index 82% rename from src/ai/api/ai_railtypelist.hpp.sq rename to src/script/api/template/template_railtypelist.hpp.sq index e067ae66a0..9a768e1d5c 100644 --- a/src/ai/api/ai_railtypelist.hpp.sq +++ b/src/script/api/template/template_railtypelist.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_railtypelist.hpp" +#include "../script_railtypelist.hpp" namespace SQConvert { /* Allow ScriptRailTypeList to be used as Squirrel parameter */ @@ -19,14 +19,3 @@ namespace SQConvert { template <> inline const ScriptRailTypeList &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptRailTypeList *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptRailTypeList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "RailTypeList", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AIRailTypeList"; } - -void SQAIRailTypeList_Register(Squirrel *engine) -{ - DefSQClass SQAIRailTypeList("AIRailTypeList"); - SQAIRailTypeList.PreRegister(engine, "AIList"); - SQAIRailTypeList.AddConstructor(engine, "x"); - - SQAIRailTypeList.PostRegister(engine); -} diff --git a/src/script/api/template/template_road.hpp.sq b/src/script/api/template/template_road.hpp.sq new file mode 100644 index 0000000000..d50bda573d --- /dev/null +++ b/src/script/api/template/template_road.hpp.sq @@ -0,0 +1,31 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_road.hpp" + +namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptRoad::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRoad::ErrorMessages)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptRoad::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptRoad::RoadType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRoad::RoadType)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptRoad::RoadType res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptRoad::RoadVehicleType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRoad::RoadVehicleType)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptRoad::RoadVehicleType res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptRoad::BuildType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRoad::BuildType)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptRoad::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; } + + /* Allow ScriptRoad to be used as Squirrel parameter */ + template <> inline ScriptRoad *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptRoad *)instance; } + template <> inline ScriptRoad &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptRoad *)instance; } + template <> inline const ScriptRoad *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptRoad *)instance; } + template <> inline const ScriptRoad &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptRoad *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptRoad *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Road", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert diff --git a/src/ai/api/ai_sign.hpp.sq b/src/script/api/template/template_sign.hpp.sq similarity index 65% rename from src/ai/api/ai_sign.hpp.sq rename to src/script/api/template/template_sign.hpp.sq index 84c7b6c5f8..db926fed3f 100644 --- a/src/ai/api/ai_sign.hpp.sq +++ b/src/script/api/template/template_sign.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_sign.hpp" +#include "../script_sign.hpp" namespace SQConvert { /* Allow enums to be used as Squirrel parameters */ @@ -23,28 +23,3 @@ namespace SQConvert { template <> inline const ScriptSign &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptSign *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptSign *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Sign", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AISign"; } - -void SQAISign_Register(Squirrel *engine) -{ - DefSQClass SQAISign("AISign"); - SQAISign.PreRegister(engine); - SQAISign.AddConstructor(engine, "x"); - - SQAISign.DefSQConst(engine, ScriptSign::ERR_SIGN_BASE, "ERR_SIGN_BASE"); - SQAISign.DefSQConst(engine, ScriptSign::ERR_SIGN_TOO_MANY_SIGNS, "ERR_SIGN_TOO_MANY_SIGNS"); - - ScriptError::RegisterErrorMap(STR_ERROR_TOO_MANY_SIGNS, ScriptSign::ERR_SIGN_TOO_MANY_SIGNS); - - ScriptError::RegisterErrorMapString(ScriptSign::ERR_SIGN_TOO_MANY_SIGNS, "ERR_SIGN_TOO_MANY_SIGNS"); - - SQAISign.DefSQStaticMethod(engine, &ScriptSign::IsValidSign, "IsValidSign", 2, ".i"); - SQAISign.DefSQStaticMethod(engine, &ScriptSign::SetName, "SetName", 3, ".i."); - SQAISign.DefSQStaticMethod(engine, &ScriptSign::GetName, "GetName", 2, ".i"); - SQAISign.DefSQStaticMethod(engine, &ScriptSign::GetLocation, "GetLocation", 2, ".i"); - SQAISign.DefSQStaticMethod(engine, &ScriptSign::BuildSign, "BuildSign", 3, ".i."); - SQAISign.DefSQStaticMethod(engine, &ScriptSign::RemoveSign, "RemoveSign", 2, ".i"); - - SQAISign.PostRegister(engine); -} diff --git a/src/ai/api/ai_signlist.hpp.sq b/src/script/api/template/template_signlist.hpp.sq similarity index 83% rename from src/ai/api/ai_signlist.hpp.sq rename to src/script/api/template/template_signlist.hpp.sq index a8bc4fbc24..e5bd67ae5f 100644 --- a/src/ai/api/ai_signlist.hpp.sq +++ b/src/script/api/template/template_signlist.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_signlist.hpp" +#include "../script_signlist.hpp" namespace SQConvert { /* Allow ScriptSignList to be used as Squirrel parameter */ @@ -19,14 +19,3 @@ namespace SQConvert { template <> inline const ScriptSignList &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptSignList *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptSignList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "SignList", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AISignList"; } - -void SQAISignList_Register(Squirrel *engine) -{ - DefSQClass SQAISignList("AISignList"); - SQAISignList.PreRegister(engine, "AIList"); - SQAISignList.AddConstructor(engine, "x"); - - SQAISignList.PostRegister(engine); -} diff --git a/src/script/api/template/template_station.hpp.sq b/src/script/api/template/template_station.hpp.sq new file mode 100644 index 0000000000..729ae68a6d --- /dev/null +++ b/src/script/api/template/template_station.hpp.sq @@ -0,0 +1,27 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_station.hpp" + +namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptStation::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptStation::ErrorMessages)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptStation::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptStation::StationType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptStation::StationType)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptStation::StationType res) { sq_pushinteger(vm, (int32)res); return 1; } + + /* Allow ScriptStation to be used as Squirrel parameter */ + template <> inline ScriptStation *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStation *)instance; } + template <> inline ScriptStation &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStation *)instance; } + template <> inline const ScriptStation *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStation *)instance; } + template <> inline const ScriptStation &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStation *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptStation *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Station", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert diff --git a/src/ai/api/ai_stationlist.hpp.sq b/src/script/api/template/template_stationlist.hpp.sq similarity index 78% rename from src/ai/api/ai_stationlist.hpp.sq rename to src/script/api/template/template_stationlist.hpp.sq index e8776abdae..f9f49a4ef2 100644 --- a/src/ai/api/ai_stationlist.hpp.sq +++ b/src/script/api/template/template_stationlist.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_stationlist.hpp" +#include "../script_stationlist.hpp" namespace SQConvert { /* Allow ScriptStationList to be used as Squirrel parameter */ @@ -20,17 +20,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptStationList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "StationList", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIStationList"; } - -void SQAIStationList_Register(Squirrel *engine) -{ - DefSQClass SQAIStationList("AIStationList"); - SQAIStationList.PreRegister(engine, "AIList"); - SQAIStationList.AddConstructor(engine, "xi"); - - SQAIStationList.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptStationList_Vehicle to be used as Squirrel parameter */ template <> inline ScriptStationList_Vehicle *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_Vehicle *)instance; } @@ -39,14 +28,3 @@ namespace SQConvert { template <> inline const ScriptStationList_Vehicle &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_Vehicle *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptStationList_Vehicle *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "StationList_Vehicle", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AIStationList_Vehicle"; } - -void SQAIStationList_Vehicle_Register(Squirrel *engine) -{ - DefSQClass SQAIStationList_Vehicle("AIStationList_Vehicle"); - SQAIStationList_Vehicle.PreRegister(engine, "AIList"); - SQAIStationList_Vehicle.AddConstructor(engine, "xi"); - - SQAIStationList_Vehicle.PostRegister(engine); -} diff --git a/src/ai/api/ai_subsidy.hpp.sq b/src/script/api/template/template_subsidy.hpp.sq similarity index 60% rename from src/ai/api/ai_subsidy.hpp.sq rename to src/script/api/template/template_subsidy.hpp.sq index 1efcc04ca7..61303a645e 100644 --- a/src/ai/api/ai_subsidy.hpp.sq +++ b/src/script/api/template/template_subsidy.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_subsidy.hpp" +#include "../script_subsidy.hpp" namespace SQConvert { /* Allow enums to be used as Squirrel parameters */ @@ -23,28 +23,3 @@ namespace SQConvert { template <> inline const ScriptSubsidy &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptSubsidy *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptSubsidy *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Subsidy", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AISubsidy"; } - -void SQAISubsidy_Register(Squirrel *engine) -{ - DefSQClass SQAISubsidy("AISubsidy"); - SQAISubsidy.PreRegister(engine); - SQAISubsidy.AddConstructor(engine, "x"); - - SQAISubsidy.DefSQConst(engine, ScriptSubsidy::SPT_INDUSTRY, "SPT_INDUSTRY"); - SQAISubsidy.DefSQConst(engine, ScriptSubsidy::SPT_TOWN, "SPT_TOWN"); - SQAISubsidy.DefSQConst(engine, ScriptSubsidy::SPT_INVALID, "SPT_INVALID"); - - SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::IsValidSubsidy, "IsValidSubsidy", 2, ".i"); - SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::IsAwarded, "IsAwarded", 2, ".i"); - SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetAwardedTo, "GetAwardedTo", 2, ".i"); - SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetExpireDate, "GetExpireDate", 2, ".i"); - SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetCargoType, "GetCargoType", 2, ".i"); - SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetSourceType, "GetSourceType", 2, ".i"); - SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetSourceIndex, "GetSourceIndex", 2, ".i"); - SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetDestinationType, "GetDestinationType", 2, ".i"); - SQAISubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetDestinationIndex, "GetDestinationIndex", 2, ".i"); - - SQAISubsidy.PostRegister(engine); -} diff --git a/src/ai/api/ai_subsidylist.hpp.sq b/src/script/api/template/template_subsidylist.hpp.sq similarity index 82% rename from src/ai/api/ai_subsidylist.hpp.sq rename to src/script/api/template/template_subsidylist.hpp.sq index 310953ee7f..4e6284f4e9 100644 --- a/src/ai/api/ai_subsidylist.hpp.sq +++ b/src/script/api/template/template_subsidylist.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_subsidylist.hpp" +#include "../script_subsidylist.hpp" namespace SQConvert { /* Allow ScriptSubsidyList to be used as Squirrel parameter */ @@ -19,14 +19,3 @@ namespace SQConvert { template <> inline const ScriptSubsidyList &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptSubsidyList *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptSubsidyList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "SubsidyList", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AISubsidyList"; } - -void SQAISubsidyList_Register(Squirrel *engine) -{ - DefSQClass SQAISubsidyList("AISubsidyList"); - SQAISubsidyList.PreRegister(engine, "AIList"); - SQAISubsidyList.AddConstructor(engine, "x"); - - SQAISubsidyList.PostRegister(engine); -} diff --git a/src/ai/api/ai_testmode.hpp.sq b/src/script/api/template/template_testmode.hpp.sq similarity index 83% rename from src/ai/api/ai_testmode.hpp.sq rename to src/script/api/template/template_testmode.hpp.sq index f169bce11b..bacafa16e7 100644 --- a/src/ai/api/ai_testmode.hpp.sq +++ b/src/script/api/template/template_testmode.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_testmode.hpp" +#include "../script_testmode.hpp" namespace SQConvert { /* Allow ScriptTestMode to be used as Squirrel parameter */ @@ -19,14 +19,3 @@ namespace SQConvert { template <> inline const ScriptTestMode &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTestMode *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptTestMode *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TestMode", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AITestMode"; } - -void SQAITestMode_Register(Squirrel *engine) -{ - DefSQClass SQAITestMode("AITestMode"); - SQAITestMode.PreRegister(engine); - SQAITestMode.AddConstructor(engine, "x"); - - SQAITestMode.PostRegister(engine); -} diff --git a/src/script/api/template/template_tile.hpp.sq b/src/script/api/template/template_tile.hpp.sq new file mode 100644 index 0000000000..8897e8c55e --- /dev/null +++ b/src/script/api/template/template_tile.hpp.sq @@ -0,0 +1,33 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_tile.hpp" + +namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptTile::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTile::ErrorMessages)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptTile::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptTile::Corner GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTile::Corner)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptTile::Corner res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptTile::Slope GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTile::Slope)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptTile::Slope res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptTile::TransportType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTile::TransportType)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptTile::TransportType res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptTile::BuildType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTile::BuildType)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptTile::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; } + + /* Allow ScriptTile to be used as Squirrel parameter */ + template <> inline ScriptTile *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptTile *)instance; } + template <> inline ScriptTile &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTile *)instance; } + template <> inline const ScriptTile *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptTile *)instance; } + template <> inline const ScriptTile &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTile *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptTile *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Tile", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert diff --git a/src/ai/api/ai_tilelist.hpp.sq b/src/script/api/template/template_tilelist.hpp.sq similarity index 73% rename from src/ai/api/ai_tilelist.hpp.sq rename to src/script/api/template/template_tilelist.hpp.sq index 970b50f3ab..e3d73a7c85 100644 --- a/src/ai/api/ai_tilelist.hpp.sq +++ b/src/script/api/template/template_tilelist.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_tilelist.hpp" +#include "../script_tilelist.hpp" namespace SQConvert { /* Allow ScriptTileList to be used as Squirrel parameter */ @@ -20,22 +20,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptTileList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TileList", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AITileList"; } - -void SQAITileList_Register(Squirrel *engine) -{ - DefSQClass SQAITileList("AITileList"); - SQAITileList.PreRegister(engine, "AIList"); - SQAITileList.AddConstructor(engine, "x"); - - SQAITileList.DefSQMethod(engine, &ScriptTileList::AddRectangle, "AddRectangle", 3, "xii"); - SQAITileList.DefSQMethod(engine, &ScriptTileList::AddTile, "AddTile", 2, "xi"); - SQAITileList.DefSQMethod(engine, &ScriptTileList::RemoveRectangle, "RemoveRectangle", 3, "xii"); - SQAITileList.DefSQMethod(engine, &ScriptTileList::RemoveTile, "RemoveTile", 2, "xi"); - - SQAITileList.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptTileList_IndustryAccepting to be used as Squirrel parameter */ template <> inline ScriptTileList_IndustryAccepting *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptTileList_IndustryAccepting *)instance; } @@ -45,17 +29,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptTileList_IndustryAccepting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TileList_IndustryAccepting", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AITileList_IndustryAccepting"; } - -void SQAITileList_IndustryAccepting_Register(Squirrel *engine) -{ - DefSQClass SQAITileList_IndustryAccepting("AITileList_IndustryAccepting"); - SQAITileList_IndustryAccepting.PreRegister(engine, "AITileList"); - SQAITileList_IndustryAccepting.AddConstructor(engine, "xii"); - - SQAITileList_IndustryAccepting.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptTileList_IndustryProducing to be used as Squirrel parameter */ template <> inline ScriptTileList_IndustryProducing *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptTileList_IndustryProducing *)instance; } @@ -65,17 +38,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptTileList_IndustryProducing *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TileList_IndustryProducing", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AITileList_IndustryProducing"; } - -void SQAITileList_IndustryProducing_Register(Squirrel *engine) -{ - DefSQClass SQAITileList_IndustryProducing("AITileList_IndustryProducing"); - SQAITileList_IndustryProducing.PreRegister(engine, "AITileList"); - SQAITileList_IndustryProducing.AddConstructor(engine, "xii"); - - SQAITileList_IndustryProducing.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptTileList_StationType to be used as Squirrel parameter */ template <> inline ScriptTileList_StationType *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptTileList_StationType *)instance; } @@ -84,14 +46,3 @@ namespace SQConvert { template <> inline const ScriptTileList_StationType &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTileList_StationType *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptTileList_StationType *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TileList_StationType", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AITileList_StationType"; } - -void SQAITileList_StationType_Register(Squirrel *engine) -{ - DefSQClass SQAITileList_StationType("AITileList_StationType"); - SQAITileList_StationType.PreRegister(engine, "AITileList"); - SQAITileList_StationType.AddConstructor(engine, "xii"); - - SQAITileList_StationType.PostRegister(engine); -} diff --git a/src/script/api/template/template_town.hpp.sq b/src/script/api/template/template_town.hpp.sq new file mode 100644 index 0000000000..8eda7fce3e --- /dev/null +++ b/src/script/api/template/template_town.hpp.sq @@ -0,0 +1,29 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_town.hpp" + +namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptTown::TownAction GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTown::TownAction)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptTown::TownAction res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptTown::TownRating GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTown::TownRating)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptTown::TownRating res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptTown::RoadLayout GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTown::RoadLayout)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptTown::RoadLayout res) { sq_pushinteger(vm, (int32)res); return 1; } + + /* Allow ScriptTown to be used as Squirrel parameter */ + template <> inline ScriptTown *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptTown *)instance; } + template <> inline ScriptTown &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTown *)instance; } + template <> inline const ScriptTown *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptTown *)instance; } + template <> inline const ScriptTown &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTown *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptTown *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Town", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert diff --git a/src/ai/api/ai_townlist.hpp.sq b/src/script/api/template/template_townlist.hpp.sq similarity index 80% rename from src/ai/api/ai_townlist.hpp.sq rename to src/script/api/template/template_townlist.hpp.sq index b9d70b2cbd..5bbd2e203a 100644 --- a/src/ai/api/ai_townlist.hpp.sq +++ b/src/script/api/template/template_townlist.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_townlist.hpp" +#include "../script_townlist.hpp" namespace SQConvert { /* Allow ScriptTownList to be used as Squirrel parameter */ @@ -20,17 +20,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptTownList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TownList", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AITownList"; } - -void SQAITownList_Register(Squirrel *engine) -{ - DefSQClass SQAITownList("AITownList"); - SQAITownList.PreRegister(engine, "AIList"); - SQAITownList.AddConstructor(engine, "x"); - - SQAITownList.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptTownEffectList to be used as Squirrel parameter */ template <> inline ScriptTownEffectList *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptTownEffectList *)instance; } @@ -39,14 +28,3 @@ namespace SQConvert { template <> inline const ScriptTownEffectList &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTownEffectList *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptTownEffectList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "TownEffectList", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AITownEffectList"; } - -void SQAITownEffectList_Register(Squirrel *engine) -{ - DefSQClass SQAITownEffectList("AITownEffectList"); - SQAITownEffectList.PreRegister(engine, "AIList"); - SQAITownEffectList.AddConstructor(engine, "x"); - - SQAITownEffectList.PostRegister(engine); -} diff --git a/src/script/api/template/template_tunnel.hpp.sq b/src/script/api/template/template_tunnel.hpp.sq new file mode 100644 index 0000000000..2d7eed91e5 --- /dev/null +++ b/src/script/api/template/template_tunnel.hpp.sq @@ -0,0 +1,25 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_tunnel.hpp" + +namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptTunnel::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptTunnel::ErrorMessages)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptTunnel::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } + + /* Allow ScriptTunnel to be used as Squirrel parameter */ + template <> inline ScriptTunnel *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptTunnel *)instance; } + template <> inline ScriptTunnel &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTunnel *)instance; } + template <> inline const ScriptTunnel *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptTunnel *)instance; } + template <> inline const ScriptTunnel &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptTunnel *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptTunnel *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Tunnel", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert diff --git a/src/script/api/template/template_vehicle.hpp.sq b/src/script/api/template/template_vehicle.hpp.sq new file mode 100644 index 0000000000..999a9c5078 --- /dev/null +++ b/src/script/api/template/template_vehicle.hpp.sq @@ -0,0 +1,29 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_vehicle.hpp" + +namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptVehicle::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptVehicle::ErrorMessages)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptVehicle::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptVehicle::VehicleType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptVehicle::VehicleType)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptVehicle::VehicleType res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptVehicle::VehicleState GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptVehicle::VehicleState)tmp; } + template <> inline int Return(HSQUIRRELVM vm, ScriptVehicle::VehicleState res) { sq_pushinteger(vm, (int32)res); return 1; } + + /* Allow ScriptVehicle to be used as Squirrel parameter */ + template <> inline ScriptVehicle *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptVehicle *)instance; } + template <> inline ScriptVehicle &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptVehicle *)instance; } + template <> inline const ScriptVehicle *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptVehicle *)instance; } + template <> inline const ScriptVehicle &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptVehicle *)instance; } + template <> inline int Return(HSQUIRRELVM vm, ScriptVehicle *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Vehicle", res, NULL, DefSQDestructorCallback, true); return 1; } +} // namespace SQConvert diff --git a/src/ai/api/ai_vehiclelist.hpp.sq b/src/script/api/template/template_vehiclelist.hpp.sq similarity index 76% rename from src/ai/api/ai_vehiclelist.hpp.sq rename to src/script/api/template/template_vehiclelist.hpp.sq index f1235d7823..dd1d17682e 100644 --- a/src/ai/api/ai_vehiclelist.hpp.sq +++ b/src/script/api/template/template_vehiclelist.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_vehiclelist.hpp" +#include "../script_vehiclelist.hpp" namespace SQConvert { /* Allow ScriptVehicleList to be used as Squirrel parameter */ @@ -20,17 +20,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptVehicleList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "VehicleList", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIVehicleList"; } - -void SQAIVehicleList_Register(Squirrel *engine) -{ - DefSQClass SQAIVehicleList("AIVehicleList"); - SQAIVehicleList.PreRegister(engine, "AIList"); - SQAIVehicleList.AddConstructor(engine, "x"); - - SQAIVehicleList.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptVehicleList_Station to be used as Squirrel parameter */ template <> inline ScriptVehicleList_Station *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptVehicleList_Station *)instance; } @@ -40,17 +29,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptVehicleList_Station *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "VehicleList_Station", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIVehicleList_Station"; } - -void SQAIVehicleList_Station_Register(Squirrel *engine) -{ - DefSQClass SQAIVehicleList_Station("AIVehicleList_Station"); - SQAIVehicleList_Station.PreRegister(engine, "AIList"); - SQAIVehicleList_Station.AddConstructor(engine, "xi"); - - SQAIVehicleList_Station.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptVehicleList_Depot to be used as Squirrel parameter */ template <> inline ScriptVehicleList_Depot *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptVehicleList_Depot *)instance; } @@ -60,17 +38,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptVehicleList_Depot *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "VehicleList_Depot", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIVehicleList_Depot"; } - -void SQAIVehicleList_Depot_Register(Squirrel *engine) -{ - DefSQClass SQAIVehicleList_Depot("AIVehicleList_Depot"); - SQAIVehicleList_Depot.PreRegister(engine, "AIList"); - SQAIVehicleList_Depot.AddConstructor(engine, "xi"); - - SQAIVehicleList_Depot.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptVehicleList_SharedOrders to be used as Squirrel parameter */ template <> inline ScriptVehicleList_SharedOrders *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptVehicleList_SharedOrders *)instance; } @@ -80,17 +47,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptVehicleList_SharedOrders *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "VehicleList_SharedOrders", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIVehicleList_SharedOrders"; } - -void SQAIVehicleList_SharedOrders_Register(Squirrel *engine) -{ - DefSQClass SQAIVehicleList_SharedOrders("AIVehicleList_SharedOrders"); - SQAIVehicleList_SharedOrders.PreRegister(engine, "AIList"); - SQAIVehicleList_SharedOrders.AddConstructor(engine, "xi"); - - SQAIVehicleList_SharedOrders.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptVehicleList_Group to be used as Squirrel parameter */ template <> inline ScriptVehicleList_Group *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptVehicleList_Group *)instance; } @@ -100,17 +56,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptVehicleList_Group *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "VehicleList_Group", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIVehicleList_Group"; } - -void SQAIVehicleList_Group_Register(Squirrel *engine) -{ - DefSQClass SQAIVehicleList_Group("AIVehicleList_Group"); - SQAIVehicleList_Group.PreRegister(engine, "AIList"); - SQAIVehicleList_Group.AddConstructor(engine, "xi"); - - SQAIVehicleList_Group.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptVehicleList_DefaultGroup to be used as Squirrel parameter */ template <> inline ScriptVehicleList_DefaultGroup *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptVehicleList_DefaultGroup *)instance; } @@ -119,14 +64,3 @@ namespace SQConvert { template <> inline const ScriptVehicleList_DefaultGroup &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptVehicleList_DefaultGroup *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptVehicleList_DefaultGroup *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "VehicleList_DefaultGroup", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AIVehicleList_DefaultGroup"; } - -void SQAIVehicleList_DefaultGroup_Register(Squirrel *engine) -{ - DefSQClass SQAIVehicleList_DefaultGroup("AIVehicleList_DefaultGroup"); - SQAIVehicleList_DefaultGroup.PreRegister(engine, "AIList"); - SQAIVehicleList_DefaultGroup.AddConstructor(engine, "xi"); - - SQAIVehicleList_DefaultGroup.PostRegister(engine); -} diff --git a/src/ai/api/ai_waypoint.hpp.sq b/src/script/api/template/template_waypoint.hpp.sq similarity index 58% rename from src/ai/api/ai_waypoint.hpp.sq rename to src/script/api/template/template_waypoint.hpp.sq index c647e91f03..048af7e503 100644 --- a/src/ai/api/ai_waypoint.hpp.sq +++ b/src/script/api/template/template_waypoint.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_waypoint.hpp" +#include "../script_waypoint.hpp" namespace SQConvert { /* Allow enums to be used as Squirrel parameters */ @@ -25,31 +25,3 @@ namespace SQConvert { template <> inline const ScriptWaypoint &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptWaypoint *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptWaypoint *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Waypoint", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AIWaypoint"; } - -void SQAIWaypoint_Register(Squirrel *engine) -{ - DefSQClass SQAIWaypoint("AIWaypoint"); - SQAIWaypoint.PreRegister(engine, "AIBaseStation"); - SQAIWaypoint.AddConstructor(engine, "x"); - - SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::WAYPOINT_RAIL, "WAYPOINT_RAIL"); - SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::WAYPOINT_BUOY, "WAYPOINT_BUOY"); - SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::WAYPOINT_ANY, "WAYPOINT_ANY"); - SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::ERR_WAYPOINT_BASE, "ERR_WAYPOINT_BASE"); - SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT, "ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT"); - SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS, "ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS"); - - ScriptError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_WAYPOINT, ScriptWaypoint::ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT); - ScriptError::RegisterErrorMap(STR_ERROR_WAYPOINT_ADJOINS_MORE_THAN_ONE_EXISTING, ScriptWaypoint::ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS); - - ScriptError::RegisterErrorMapString(ScriptWaypoint::ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT, "ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT"); - ScriptError::RegisterErrorMapString(ScriptWaypoint::ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS, "ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS"); - - SQAIWaypoint.DefSQStaticMethod(engine, &ScriptWaypoint::IsValidWaypoint, "IsValidWaypoint", 2, ".i"); - SQAIWaypoint.DefSQStaticMethod(engine, &ScriptWaypoint::GetWaypointID, "GetWaypointID", 2, ".i"); - SQAIWaypoint.DefSQStaticMethod(engine, &ScriptWaypoint::HasWaypointType, "HasWaypointType", 3, ".ii"); - - SQAIWaypoint.PostRegister(engine); -} diff --git a/src/ai/api/ai_waypointlist.hpp.sq b/src/script/api/template/template_waypointlist.hpp.sq similarity index 78% rename from src/ai/api/ai_waypointlist.hpp.sq rename to src/script/api/template/template_waypointlist.hpp.sq index 2438e005fd..2e23bba148 100644 --- a/src/ai/api/ai_waypointlist.hpp.sq +++ b/src/script/api/template/template_waypointlist.hpp.sq @@ -9,7 +9,7 @@ /* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ -#include "../../script/api/script_waypointlist.hpp" +#include "../script_waypointlist.hpp" namespace SQConvert { /* Allow ScriptWaypointList to be used as Squirrel parameter */ @@ -20,17 +20,6 @@ namespace SQConvert { template <> inline int Return(HSQUIRRELVM vm, ScriptWaypointList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "WaypointList", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert -template <> const char *GetClassName() { return "AIWaypointList"; } - -void SQAIWaypointList_Register(Squirrel *engine) -{ - DefSQClass SQAIWaypointList("AIWaypointList"); - SQAIWaypointList.PreRegister(engine, "AIList"); - SQAIWaypointList.AddConstructor(engine, "xi"); - - SQAIWaypointList.PostRegister(engine); -} - namespace SQConvert { /* Allow ScriptWaypointList_Vehicle to be used as Squirrel parameter */ template <> inline ScriptWaypointList_Vehicle *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptWaypointList_Vehicle *)instance; } @@ -39,14 +28,3 @@ namespace SQConvert { template <> inline const ScriptWaypointList_Vehicle &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptWaypointList_Vehicle *)instance; } template <> inline int Return(HSQUIRRELVM vm, ScriptWaypointList_Vehicle *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "WaypointList_Vehicle", res, NULL, DefSQDestructorCallback, true); return 1; } } // namespace SQConvert - -template <> const char *GetClassName() { return "AIWaypointList_Vehicle"; } - -void SQAIWaypointList_Vehicle_Register(Squirrel *engine) -{ - DefSQClass SQAIWaypointList_Vehicle("AIWaypointList_Vehicle"); - SQAIWaypointList_Vehicle.PreRegister(engine, "AIList"); - SQAIWaypointList_Vehicle.AddConstructor(engine, "xi"); - - SQAIWaypointList_Vehicle.PostRegister(engine); -}