From 9359c6fc47f6fabddc399d044ea74dc6ebfdfb05 Mon Sep 17 00:00:00 2001 From: truebrain Date: Mon, 19 Dec 2011 20:57:34 +0000 Subject: (svn r23615) -Add: more API functions exposed to NoGo (part 2) --- src/engine.cpp | 4 +- src/game/game_instance.cpp | 48 ++++++++++++++++ src/script/api/game/game_basestation.hpp.sq | 34 +++++++++++ src/script/api/game/game_bridge.hpp.sq | 48 ++++++++++++++++ src/script/api/game/game_bridgelist.hpp.sq | 37 ++++++++++++ src/script/api/game/game_cargolist.hpp.sq | 61 ++++++++++++++++++++ src/script/api/game/game_depotlist.hpp.sq | 25 +++++++++ src/script/api/game/game_engine.hpp.sq | 51 +++++++++++++++++ src/script/api/game/game_enginelist.hpp.sq | 25 +++++++++ src/script/api/game/game_rail.hpp.sq | 84 ++++++++++++++++++++++++++++ src/script/api/game/game_railtypelist.hpp.sq | 25 +++++++++ src/script/api/game/game_station.hpp.sq | 61 ++++++++++++++++++++ src/script/api/game/game_stationlist.hpp.sq | 37 ++++++++++++ src/script/api/game/game_subsidy.hpp.sq | 39 +++++++++++++ src/script/api/game/game_subsidylist.hpp.sq | 25 +++++++++ src/script/api/game/game_tilelist.hpp.sq | 66 ++++++++++++++++++++++ src/script/api/game/game_tunnel.hpp.sq | 44 +++++++++++++++ src/script/api/game/game_vehiclelist.hpp.sq | 61 ++++++++++++++++++++ src/script/api/game/game_waypoint.hpp.sq | 42 ++++++++++++++ src/script/api/game/game_waypointlist.hpp.sq | 37 ++++++++++++ src/script/api/script_basestation.cpp | 2 +- src/script/api/script_basestation.hpp | 3 +- src/script/api/script_bridge.hpp | 4 +- src/script/api/script_bridgelist.hpp | 4 +- src/script/api/script_cargolist.hpp | 8 +-- src/script/api/script_depotlist.cpp | 4 +- src/script/api/script_depotlist.hpp | 2 +- src/script/api/script_engine.cpp | 2 +- src/script/api/script_engine.hpp | 2 +- src/script/api/script_enginelist.cpp | 2 +- src/script/api/script_enginelist.hpp | 2 +- src/script/api/script_rail.cpp | 2 +- src/script/api/script_rail.hpp | 15 ++++- src/script/api/script_railtypelist.cpp | 2 +- src/script/api/script_railtypelist.hpp | 2 +- src/script/api/script_station.cpp | 2 +- src/script/api/script_station.hpp | 2 +- src/script/api/script_stationlist.cpp | 2 +- src/script/api/script_stationlist.hpp | 4 +- src/script/api/script_subsidy.hpp | 2 +- src/script/api/script_subsidylist.hpp | 2 +- src/script/api/script_tilelist.hpp | 8 +-- src/script/api/script_tunnel.hpp | 4 +- src/script/api/script_vehiclelist.cpp | 6 +- src/script/api/script_vehiclelist.hpp | 8 +-- src/script/api/script_waypoint.cpp | 2 +- src/script/api/script_waypoint.hpp | 2 +- src/script/api/script_waypointlist.cpp | 2 +- src/script/api/script_waypointlist.hpp | 4 +- 49 files changed, 914 insertions(+), 46 deletions(-) create mode 100644 src/script/api/game/game_basestation.hpp.sq create mode 100644 src/script/api/game/game_bridge.hpp.sq create mode 100644 src/script/api/game/game_bridgelist.hpp.sq create mode 100644 src/script/api/game/game_cargolist.hpp.sq create mode 100644 src/script/api/game/game_depotlist.hpp.sq create mode 100644 src/script/api/game/game_engine.hpp.sq create mode 100644 src/script/api/game/game_enginelist.hpp.sq create mode 100644 src/script/api/game/game_rail.hpp.sq create mode 100644 src/script/api/game/game_railtypelist.hpp.sq create mode 100644 src/script/api/game/game_station.hpp.sq create mode 100644 src/script/api/game/game_stationlist.hpp.sq create mode 100644 src/script/api/game/game_subsidy.hpp.sq create mode 100644 src/script/api/game/game_subsidylist.hpp.sq create mode 100644 src/script/api/game/game_tilelist.hpp.sq create mode 100644 src/script/api/game/game_tunnel.hpp.sq create mode 100644 src/script/api/game/game_vehiclelist.hpp.sq create mode 100644 src/script/api/game/game_waypoint.hpp.sq create mode 100644 src/script/api/game/game_waypointlist.hpp.sq diff --git a/src/engine.cpp b/src/engine.cpp index 33e9bdd7e..5fc32714c 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -996,11 +996,11 @@ bool IsEngineBuildable(EngineID engine, VehicleType type, CompanyID company) if (e->type != type) return false; /* check if it's available */ - if (!HasBit(e->company_avail, company)) return false; + if (company != OWNER_DEITY && !HasBit(e->company_avail, company)) return false; if (!e->IsEnabled()) return false; - if (type == VEH_TRAIN) { + if (type == VEH_TRAIN && company != OWNER_DEITY) { /* Check if the rail type is available to this company */ const Company *c = Company::Get(company); if (((GetRailTypeInfo(e->u.rail.railtype))->compatible_railtypes & c->avail_railtypes) == 0) return false; diff --git a/src/game/game_instance.cpp b/src/game/game_instance.cpp index 21f81d3be..87cb2e68c 100644 --- a/src/game/game_instance.cpp +++ b/src/game/game_instance.cpp @@ -26,10 +26,17 @@ #include "../script/api/game/game_accounting.hpp.sq" #include "../script/api/game/game_airport.hpp.sq" #include "../script/api/game/game_base.hpp.sq" +#include "../script/api/game/game_basestation.hpp.sq" +#include "../script/api/game/game_bridge.hpp.sq" +#include "../script/api/game/game_bridgelist.hpp.sq" #include "../script/api/game/game_cargo.hpp.sq" +#include "../script/api/game/game_cargolist.hpp.sq" #include "../script/api/game/game_company.hpp.sq" #include "../script/api/game/game_controller.hpp.sq" #include "../script/api/game/game_date.hpp.sq" +#include "../script/api/game/game_depotlist.hpp.sq" +#include "../script/api/game/game_engine.hpp.sq" +#include "../script/api/game/game_enginelist.hpp.sq" #include "../script/api/game/game_error.hpp.sq" #include "../script/api/game/game_event.hpp.sq" #include "../script/api/game/game_execmode.hpp.sq" @@ -43,13 +50,24 @@ #include "../script/api/game/game_log.hpp.sq" #include "../script/api/game/game_map.hpp.sq" #include "../script/api/game/game_marine.hpp.sq" +#include "../script/api/game/game_rail.hpp.sq" +#include "../script/api/game/game_railtypelist.hpp.sq" #include "../script/api/game/game_road.hpp.sq" #include "../script/api/game/game_signlist.hpp.sq" +#include "../script/api/game/game_station.hpp.sq" +#include "../script/api/game/game_stationlist.hpp.sq" +#include "../script/api/game/game_subsidy.hpp.sq" +#include "../script/api/game/game_subsidylist.hpp.sq" #include "../script/api/game/game_testmode.hpp.sq" #include "../script/api/game/game_tile.hpp.sq" +#include "../script/api/game/game_tilelist.hpp.sq" #include "../script/api/game/game_town.hpp.sq" #include "../script/api/game/game_townlist.hpp.sq" +#include "../script/api/game/game_tunnel.hpp.sq" #include "../script/api/game/game_vehicle.hpp.sq" +#include "../script/api/game/game_vehiclelist.hpp.sq" +#include "../script/api/game/game_waypoint.hpp.sq" +#include "../script/api/game/game_waypointlist.hpp.sq" GameInstance::GameInstance() : @@ -73,9 +91,20 @@ void GameInstance::RegisterAPI() SQGSAccounting_Register(this->engine); SQGSAirport_Register(this->engine); SQGSBase_Register(this->engine); + SQGSBaseStation_Register(this->engine); + SQGSBridge_Register(this->engine); + SQGSBridgeList_Register(this->engine); + SQGSBridgeList_Length_Register(this->engine); SQGSCargo_Register(this->engine); + SQGSCargoList_Register(this->engine); + SQGSCargoList_IndustryAccepting_Register(this->engine); + SQGSCargoList_IndustryProducing_Register(this->engine); + SQGSCargoList_StationAccepting_Register(this->engine); SQGSCompany_Register(this->engine); SQGSDate_Register(this->engine); + SQGSDepotList_Register(this->engine); + SQGSEngine_Register(this->engine); + SQGSEngineList_Register(this->engine); SQGSError_Register(this->engine); SQGSEvent_Register(this->engine); SQGSEventController_Register(this->engine); @@ -91,14 +120,33 @@ void GameInstance::RegisterAPI() SQGSLog_Register(this->engine); SQGSMap_Register(this->engine); SQGSMarine_Register(this->engine); + SQGSRail_Register(this->engine); + SQGSRailTypeList_Register(this->engine); SQGSRoad_Register(this->engine); SQGSSignList_Register(this->engine); + SQGSStation_Register(this->engine); + SQGSStationList_Register(this->engine); + SQGSStationList_Vehicle_Register(this->engine); + SQGSSubsidy_Register(this->engine); + SQGSSubsidyList_Register(this->engine); SQGSTestMode_Register(this->engine); SQGSTile_Register(this->engine); + SQGSTileList_Register(this->engine); + SQGSTileList_IndustryAccepting_Register(this->engine); + SQGSTileList_IndustryProducing_Register(this->engine); + SQGSTileList_StationType_Register(this->engine); SQGSTown_Register(this->engine); SQGSTownEffectList_Register(this->engine); SQGSTownList_Register(this->engine); + SQGSTunnel_Register(this->engine); SQGSVehicle_Register(this->engine); + SQGSVehicleList_Register(this->engine); + SQGSVehicleList_Depot_Register(this->engine); + SQGSVehicleList_SharedOrders_Register(this->engine); + SQGSVehicleList_Station_Register(this->engine); + SQGSWaypoint_Register(this->engine); + SQGSWaypointList_Register(this->engine); + SQGSWaypointList_Vehicle_Register(this->engine); } diff --git a/src/script/api/game/game_basestation.hpp.sq b/src/script/api/game/game_basestation.hpp.sq new file mode 100644 index 000000000..d20b4c739 --- /dev/null +++ b/src/script/api/game/game_basestation.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_basestation.hpp" +#include "../template/template_basestation.hpp.sq" + + +template <> const char *GetClassName() { return "GSBaseStation"; } + +void SQGSBaseStation_Register(Squirrel *engine) +{ + DefSQClass SQGSBaseStation("GSBaseStation"); + SQGSBaseStation.PreRegister(engine); + SQGSBaseStation.AddConstructor(engine, "x"); + + SQGSBaseStation.DefSQConst(engine, ScriptBaseStation::STATION_NEW, "STATION_NEW"); + SQGSBaseStation.DefSQConst(engine, ScriptBaseStation::STATION_JOIN_ADJACENT, "STATION_JOIN_ADJACENT"); + SQGSBaseStation.DefSQConst(engine, ScriptBaseStation::STATION_INVALID, "STATION_INVALID"); + + SQGSBaseStation.DefSQStaticMethod(engine, &ScriptBaseStation::IsValidBaseStation, "IsValidBaseStation", 2, ".i"); + SQGSBaseStation.DefSQStaticMethod(engine, &ScriptBaseStation::GetName, "GetName", 2, ".i"); + SQGSBaseStation.DefSQStaticMethod(engine, &ScriptBaseStation::GetLocation, "GetLocation", 2, ".i"); + SQGSBaseStation.DefSQStaticMethod(engine, &ScriptBaseStation::GetConstructionDate, "GetConstructionDate", 2, ".i"); + + SQGSBaseStation.PostRegister(engine); +} diff --git a/src/script/api/game/game_bridge.hpp.sq b/src/script/api/game/game_bridge.hpp.sq new file mode 100644 index 000000000..d4c2d0583 --- /dev/null +++ b/src/script/api/game/game_bridge.hpp.sq @@ -0,0 +1,48 @@ +/* $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" +#include "../template/template_bridge.hpp.sq" + + +template <> const char *GetClassName() { return "GSBridge"; } + +void SQGSBridge_Register(Squirrel *engine) +{ + DefSQClass SQGSBridge("GSBridge"); + SQGSBridge.PreRegister(engine); + SQGSBridge.AddConstructor(engine, "x"); + + SQGSBridge.DefSQConst(engine, ScriptBridge::ERR_BRIDGE_BASE, "ERR_BRIDGE_BASE"); + SQGSBridge.DefSQConst(engine, ScriptBridge::ERR_BRIDGE_TYPE_UNAVAILABLE, "ERR_BRIDGE_TYPE_UNAVAILABLE"); + SQGSBridge.DefSQConst(engine, ScriptBridge::ERR_BRIDGE_CANNOT_END_IN_WATER, "ERR_BRIDGE_CANNOT_END_IN_WATER"); + SQGSBridge.DefSQConst(engine, ScriptBridge::ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT, "ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT"); + + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_BUILD_BRIDGE_HERE, ScriptBridge::ERR_BRIDGE_TYPE_UNAVAILABLE); + ScriptError::RegisterErrorMap(STR_ERROR_ENDS_OF_BRIDGE_MUST_BOTH, ScriptBridge::ERR_BRIDGE_CANNOT_END_IN_WATER); + ScriptError::RegisterErrorMap(STR_ERROR_BRIDGEHEADS_NOT_SAME_HEIGHT, ScriptBridge::ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT); + + ScriptError::RegisterErrorMapString(ScriptBridge::ERR_BRIDGE_TYPE_UNAVAILABLE, "ERR_BRIDGE_TYPE_UNAVAILABLE"); + ScriptError::RegisterErrorMapString(ScriptBridge::ERR_BRIDGE_CANNOT_END_IN_WATER, "ERR_BRIDGE_CANNOT_END_IN_WATER"); + ScriptError::RegisterErrorMapString(ScriptBridge::ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT, "ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT"); + + SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::IsValidBridge, "IsValidBridge", 2, ".i"); + SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::IsBridgeTile, "IsBridgeTile", 2, ".i"); + SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::GetBridgeID, "GetBridgeID", 2, ".i"); + SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::GetName, "GetName", 2, ".i"); + SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::GetMaxSpeed, "GetMaxSpeed", 2, ".i"); + SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::GetPrice, "GetPrice", 3, ".ii"); + SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::GetMaxLength, "GetMaxLength", 2, ".i"); + SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::GetMinLength, "GetMinLength", 2, ".i"); + SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::GetOtherBridgeEnd, "GetOtherBridgeEnd", 2, ".i"); + + SQGSBridge.PostRegister(engine); +} diff --git a/src/script/api/game/game_bridgelist.hpp.sq b/src/script/api/game/game_bridgelist.hpp.sq new file mode 100644 index 000000000..d40c2c1e0 --- /dev/null +++ b/src/script/api/game/game_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 "GSBridgeList"; } + +void SQGSBridgeList_Register(Squirrel *engine) +{ + DefSQClass SQGSBridgeList("GSBridgeList"); + SQGSBridgeList.PreRegister(engine, "GSList"); + SQGSBridgeList.AddConstructor(engine, "x"); + + SQGSBridgeList.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "GSBridgeList_Length"; } + +void SQGSBridgeList_Length_Register(Squirrel *engine) +{ + DefSQClass SQGSBridgeList_Length("GSBridgeList_Length"); + SQGSBridgeList_Length.PreRegister(engine, "GSList"); + SQGSBridgeList_Length.AddConstructor(engine, "xi"); + + SQGSBridgeList_Length.PostRegister(engine); +} diff --git a/src/script/api/game/game_cargolist.hpp.sq b/src/script/api/game/game_cargolist.hpp.sq new file mode 100644 index 000000000..00b22b3d7 --- /dev/null +++ b/src/script/api/game/game_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 "GSCargoList"; } + +void SQGSCargoList_Register(Squirrel *engine) +{ + DefSQClass SQGSCargoList("GSCargoList"); + SQGSCargoList.PreRegister(engine, "GSList"); + SQGSCargoList.AddConstructor(engine, "x"); + + SQGSCargoList.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "GSCargoList_IndustryAccepting"; } + +void SQGSCargoList_IndustryAccepting_Register(Squirrel *engine) +{ + DefSQClass SQGSCargoList_IndustryAccepting("GSCargoList_IndustryAccepting"); + SQGSCargoList_IndustryAccepting.PreRegister(engine, "GSList"); + SQGSCargoList_IndustryAccepting.AddConstructor(engine, "xi"); + + SQGSCargoList_IndustryAccepting.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "GSCargoList_IndustryProducing"; } + +void SQGSCargoList_IndustryProducing_Register(Squirrel *engine) +{ + DefSQClass SQGSCargoList_IndustryProducing("GSCargoList_IndustryProducing"); + SQGSCargoList_IndustryProducing.PreRegister(engine, "GSList"); + SQGSCargoList_IndustryProducing.AddConstructor(engine, "xi"); + + SQGSCargoList_IndustryProducing.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "GSCargoList_StationAccepting"; } + +void SQGSCargoList_StationAccepting_Register(Squirrel *engine) +{ + DefSQClass SQGSCargoList_StationAccepting("GSCargoList_StationAccepting"); + SQGSCargoList_StationAccepting.PreRegister(engine, "GSList"); + SQGSCargoList_StationAccepting.AddConstructor(engine, "xi"); + + SQGSCargoList_StationAccepting.PostRegister(engine); +} diff --git a/src/script/api/game/game_depotlist.hpp.sq b/src/script/api/game/game_depotlist.hpp.sq new file mode 100644 index 000000000..59257cdad --- /dev/null +++ b/src/script/api/game/game_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 "GSDepotList"; } + +void SQGSDepotList_Register(Squirrel *engine) +{ + DefSQClass SQGSDepotList("GSDepotList"); + SQGSDepotList.PreRegister(engine, "GSList"); + SQGSDepotList.AddConstructor(engine, "xi"); + + SQGSDepotList.PostRegister(engine); +} diff --git a/src/script/api/game/game_engine.hpp.sq b/src/script/api/game/game_engine.hpp.sq new file mode 100644 index 000000000..488175547 --- /dev/null +++ b/src/script/api/game/game_engine.hpp.sq @@ -0,0 +1,51 @@ +/* $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" +#include "../template/template_engine.hpp.sq" + + +template <> const char *GetClassName() { return "GSEngine"; } + +void SQGSEngine_Register(Squirrel *engine) +{ + DefSQClass SQGSEngine("GSEngine"); + SQGSEngine.PreRegister(engine); + SQGSEngine.AddConstructor(engine, "x"); + + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::IsValidEngine, "IsValidEngine", 2, ".i"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::IsBuildable, "IsBuildable", 2, ".i"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetName, "GetName", 2, ".i"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetCargoType, "GetCargoType", 2, ".i"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::CanRefitCargo, "CanRefitCargo", 3, ".ii"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::CanPullCargo, "CanPullCargo", 3, ".ii"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetCapacity, "GetCapacity", 2, ".i"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetReliability, "GetReliability", 2, ".i"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetMaxSpeed, "GetMaxSpeed", 2, ".i"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetPrice, "GetPrice", 2, ".i"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetMaxAge, "GetMaxAge", 2, ".i"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetRunningCost, "GetRunningCost", 2, ".i"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetPower, "GetPower", 2, ".i"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetWeight, "GetWeight", 2, ".i"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetMaxTractiveEffort, "GetMaxTractiveEffort", 2, ".i"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetDesignDate, "GetDesignDate", 2, ".i"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetVehicleType, "GetVehicleType", 2, ".i"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::IsWagon, "IsWagon", 2, ".i"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::CanRunOnRail, "CanRunOnRail", 3, ".ii"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::HasPowerOnRail, "HasPowerOnRail", 3, ".ii"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetRoadType, "GetRoadType", 2, ".i"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetRailType, "GetRailType", 2, ".i"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::IsArticulated, "IsArticulated", 2, ".i"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetPlaneType, "GetPlaneType", 2, ".i"); + SQGSEngine.DefSQStaticMethod(engine, &ScriptEngine::GetMaximumOrderDistance, "GetMaximumOrderDistance", 2, ".i"); + + SQGSEngine.PostRegister(engine); +} diff --git a/src/script/api/game/game_enginelist.hpp.sq b/src/script/api/game/game_enginelist.hpp.sq new file mode 100644 index 000000000..1f052b833 --- /dev/null +++ b/src/script/api/game/game_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 "GSEngineList"; } + +void SQGSEngineList_Register(Squirrel *engine) +{ + DefSQClass SQGSEngineList("GSEngineList"); + SQGSEngineList.PreRegister(engine, "GSList"); + SQGSEngineList.AddConstructor(engine, "xi"); + + SQGSEngineList.PostRegister(engine); +} diff --git a/src/script/api/game/game_rail.hpp.sq b/src/script/api/game/game_rail.hpp.sq new file mode 100644 index 000000000..ea900f448 --- /dev/null +++ b/src/script/api/game/game_rail.hpp.sq @@ -0,0 +1,84 @@ +/* $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" +#include "../template/template_rail.hpp.sq" + + +template <> const char *GetClassName() { return "GSRail"; } + +void SQGSRail_Register(Squirrel *engine) +{ + DefSQClass SQGSRail("GSRail"); + SQGSRail.PreRegister(engine); + SQGSRail.AddConstructor(engine, "x"); + + SQGSRail.DefSQConst(engine, ScriptRail::ERR_RAIL_BASE, "ERR_RAIL_BASE"); + SQGSRail.DefSQConst(engine, ScriptRail::ERR_CROSSING_ON_ONEWAY_ROAD, "ERR_CROSSING_ON_ONEWAY_ROAD"); + SQGSRail.DefSQConst(engine, ScriptRail::ERR_UNSUITABLE_TRACK, "ERR_UNSUITABLE_TRACK"); + SQGSRail.DefSQConst(engine, ScriptRail::ERR_RAILTYPE_DISALLOWS_CROSSING, "ERR_RAILTYPE_DISALLOWS_CROSSING"); + SQGSRail.DefSQConst(engine, ScriptRail::RAILTYPE_INVALID, "RAILTYPE_INVALID"); + SQGSRail.DefSQConst(engine, ScriptRail::RAILTRACK_NE_SW, "RAILTRACK_NE_SW"); + SQGSRail.DefSQConst(engine, ScriptRail::RAILTRACK_NW_SE, "RAILTRACK_NW_SE"); + SQGSRail.DefSQConst(engine, ScriptRail::RAILTRACK_NW_NE, "RAILTRACK_NW_NE"); + SQGSRail.DefSQConst(engine, ScriptRail::RAILTRACK_SW_SE, "RAILTRACK_SW_SE"); + SQGSRail.DefSQConst(engine, ScriptRail::RAILTRACK_NW_SW, "RAILTRACK_NW_SW"); + SQGSRail.DefSQConst(engine, ScriptRail::RAILTRACK_NE_SE, "RAILTRACK_NE_SE"); + SQGSRail.DefSQConst(engine, ScriptRail::RAILTRACK_INVALID, "RAILTRACK_INVALID"); + SQGSRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_NORMAL, "SIGNALTYPE_NORMAL"); + SQGSRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_ENTRY, "SIGNALTYPE_ENTRY"); + SQGSRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_EXIT, "SIGNALTYPE_EXIT"); + SQGSRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_COMBO, "SIGNALTYPE_COMBO"); + SQGSRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_PBS, "SIGNALTYPE_PBS"); + SQGSRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_PBS_ONEWAY, "SIGNALTYPE_PBS_ONEWAY"); + SQGSRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_TWOWAY, "SIGNALTYPE_TWOWAY"); + SQGSRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_NORMAL_TWOWAY, "SIGNALTYPE_NORMAL_TWOWAY"); + SQGSRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_ENTRY_TWOWAY, "SIGNALTYPE_ENTRY_TWOWAY"); + SQGSRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_EXIT_TWOWAY, "SIGNALTYPE_EXIT_TWOWAY"); + SQGSRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_COMBO_TWOWAY, "SIGNALTYPE_COMBO_TWOWAY"); + SQGSRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_NONE, "SIGNALTYPE_NONE"); + SQGSRail.DefSQConst(engine, ScriptRail::BT_TRACK, "BT_TRACK"); + SQGSRail.DefSQConst(engine, ScriptRail::BT_SIGNAL, "BT_SIGNAL"); + SQGSRail.DefSQConst(engine, ScriptRail::BT_DEPOT, "BT_DEPOT"); + SQGSRail.DefSQConst(engine, ScriptRail::BT_STATION, "BT_STATION"); + SQGSRail.DefSQConst(engine, ScriptRail::BT_WAYPOINT, "BT_WAYPOINT"); + + ScriptError::RegisterErrorMap(STR_ERROR_CROSSING_ON_ONEWAY_ROAD, ScriptRail::ERR_CROSSING_ON_ONEWAY_ROAD); + ScriptError::RegisterErrorMap(STR_ERROR_NO_SUITABLE_RAILROAD_TRACK, ScriptRail::ERR_UNSUITABLE_TRACK); + ScriptError::RegisterErrorMap(STR_ERROR_CROSSING_DISALLOWED, ScriptRail::ERR_RAILTYPE_DISALLOWS_CROSSING); + + ScriptError::RegisterErrorMapString(ScriptRail::ERR_CROSSING_ON_ONEWAY_ROAD, "ERR_CROSSING_ON_ONEWAY_ROAD"); + ScriptError::RegisterErrorMapString(ScriptRail::ERR_UNSUITABLE_TRACK, "ERR_UNSUITABLE_TRACK"); + ScriptError::RegisterErrorMapString(ScriptRail::ERR_RAILTYPE_DISALLOWS_CROSSING, "ERR_RAILTYPE_DISALLOWS_CROSSING"); + + SQGSRail.DefSQStaticMethod(engine, &ScriptRail::GetName, "GetName", 2, ".i"); + SQGSRail.DefSQStaticMethod(engine, &ScriptRail::IsRailTile, "IsRailTile", 2, ".i"); + SQGSRail.DefSQStaticMethod(engine, &ScriptRail::IsLevelCrossingTile, "IsLevelCrossingTile", 2, ".i"); + SQGSRail.DefSQStaticMethod(engine, &ScriptRail::IsRailDepotTile, "IsRailDepotTile", 2, ".i"); + SQGSRail.DefSQStaticMethod(engine, &ScriptRail::IsRailStationTile, "IsRailStationTile", 2, ".i"); + SQGSRail.DefSQStaticMethod(engine, &ScriptRail::IsRailWaypointTile, "IsRailWaypointTile", 2, ".i"); + SQGSRail.DefSQStaticMethod(engine, &ScriptRail::IsRailTypeAvailable, "IsRailTypeAvailable", 2, ".i"); + SQGSRail.DefSQStaticMethod(engine, &ScriptRail::GetCurrentRailType, "GetCurrentRailType", 1, "."); + SQGSRail.DefSQStaticMethod(engine, &ScriptRail::SetCurrentRailType, "SetCurrentRailType", 2, ".i"); + SQGSRail.DefSQStaticMethod(engine, &ScriptRail::TrainCanRunOnRail, "TrainCanRunOnRail", 3, ".ii"); + SQGSRail.DefSQStaticMethod(engine, &ScriptRail::TrainHasPowerOnRail, "TrainHasPowerOnRail", 3, ".ii"); + SQGSRail.DefSQStaticMethod(engine, &ScriptRail::GetRailType, "GetRailType", 2, ".i"); + SQGSRail.DefSQStaticMethod(engine, &ScriptRail::GetRailDepotFrontTile, "GetRailDepotFrontTile", 2, ".i"); + SQGSRail.DefSQStaticMethod(engine, &ScriptRail::GetRailStationDirection, "GetRailStationDirection", 2, ".i"); + SQGSRail.DefSQStaticMethod(engine, &ScriptRail::GetRailTracks, "GetRailTracks", 2, ".i"); + SQGSRail.DefSQStaticMethod(engine, &ScriptRail::AreTilesConnected, "AreTilesConnected", 4, ".iii"); + SQGSRail.DefSQStaticMethod(engine, &ScriptRail::GetSignalType, "GetSignalType", 3, ".ii"); + SQGSRail.DefSQStaticMethod(engine, &ScriptRail::GetBuildCost, "GetBuildCost", 3, ".ii"); + SQGSRail.DefSQStaticMethod(engine, &ScriptRail::GetMaxSpeed, "GetMaxSpeed", 2, ".i"); + SQGSRail.DefSQStaticMethod(engine, &ScriptRail::GetMaintenanceCostFactor, "GetMaintenanceCostFactor", 2, ".i"); + + SQGSRail.PostRegister(engine); +} diff --git a/src/script/api/game/game_railtypelist.hpp.sq b/src/script/api/game/game_railtypelist.hpp.sq new file mode 100644 index 000000000..caa036aca --- /dev/null +++ b/src/script/api/game/game_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 "GSRailTypeList"; } + +void SQGSRailTypeList_Register(Squirrel *engine) +{ + DefSQClass SQGSRailTypeList("GSRailTypeList"); + SQGSRailTypeList.PreRegister(engine, "GSList"); + SQGSRailTypeList.AddConstructor(engine, "x"); + + SQGSRailTypeList.PostRegister(engine); +} diff --git a/src/script/api/game/game_station.hpp.sq b/src/script/api/game/game_station.hpp.sq new file mode 100644 index 000000000..5aa696794 --- /dev/null +++ b/src/script/api/game/game_station.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_station.hpp" +#include "../template/template_station.hpp.sq" + + +template <> const char *GetClassName() { return "GSStation"; } + +void SQGSStation_Register(Squirrel *engine) +{ + DefSQClass SQGSStation("GSStation"); + SQGSStation.PreRegister(engine, "GSBaseStation"); + SQGSStation.AddConstructor(engine, "x"); + + SQGSStation.DefSQConst(engine, ScriptStation::ERR_STATION_BASE, "ERR_STATION_BASE"); + SQGSStation.DefSQConst(engine, ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION, "ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION"); + SQGSStation.DefSQConst(engine, ScriptStation::ERR_STATION_TOO_MANY_STATIONS, "ERR_STATION_TOO_MANY_STATIONS"); + SQGSStation.DefSQConst(engine, ScriptStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN, "ERR_STATION_TOO_MANY_STATIONS_IN_TOWN"); + SQGSStation.DefSQConst(engine, ScriptStation::STATION_TRAIN, "STATION_TRAIN"); + SQGSStation.DefSQConst(engine, ScriptStation::STATION_TRUCK_STOP, "STATION_TRUCK_STOP"); + SQGSStation.DefSQConst(engine, ScriptStation::STATION_BUS_STOP, "STATION_BUS_STOP"); + SQGSStation.DefSQConst(engine, ScriptStation::STATION_AIRPORT, "STATION_AIRPORT"); + SQGSStation.DefSQConst(engine, ScriptStation::STATION_DOCK, "STATION_DOCK"); + SQGSStation.DefSQConst(engine, ScriptStation::STATION_ANY, "STATION_ANY"); + + ScriptError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT, ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION); + ScriptError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION, ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION); + ScriptError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK, ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION); + ScriptError::RegisterErrorMap(STR_ERROR_TOO_MANY_STATIONS_LOADING, ScriptStation::ERR_STATION_TOO_MANY_STATIONS); + ScriptError::RegisterErrorMap(STR_ERROR_TOO_MANY_TRUCK_STOPS, ScriptStation::ERR_STATION_TOO_MANY_STATIONS); + ScriptError::RegisterErrorMap(STR_ERROR_TOO_MANY_BUS_STOPS, ScriptStation::ERR_STATION_TOO_MANY_STATIONS); + ScriptError::RegisterErrorMap(STR_ERROR_LOCAL_AUTHORITY_REFUSES_AIRPORT, ScriptStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN); + + ScriptError::RegisterErrorMapString(ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION, "ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION"); + ScriptError::RegisterErrorMapString(ScriptStation::ERR_STATION_TOO_MANY_STATIONS, "ERR_STATION_TOO_MANY_STATIONS"); + ScriptError::RegisterErrorMapString(ScriptStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN, "ERR_STATION_TOO_MANY_STATIONS_IN_TOWN"); + + SQGSStation.DefSQStaticMethod(engine, &ScriptStation::IsValidStation, "IsValidStation", 2, ".i"); + SQGSStation.DefSQStaticMethod(engine, &ScriptStation::GetStationID, "GetStationID", 2, ".i"); + SQGSStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoWaiting, "GetCargoWaiting", 3, ".ii"); + SQGSStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoRating, "GetCargoRating", 3, ".ii"); + SQGSStation.DefSQStaticMethod(engine, &ScriptStation::GetCoverageRadius, "GetCoverageRadius", 2, ".i"); + SQGSStation.DefSQStaticMethod(engine, &ScriptStation::GetStationCoverageRadius, "GetStationCoverageRadius", 2, ".i"); + SQGSStation.DefSQStaticMethod(engine, &ScriptStation::GetDistanceManhattanToTile, "GetDistanceManhattanToTile", 3, ".ii"); + SQGSStation.DefSQStaticMethod(engine, &ScriptStation::GetDistanceSquareToTile, "GetDistanceSquareToTile", 3, ".ii"); + SQGSStation.DefSQStaticMethod(engine, &ScriptStation::IsWithinTownInfluence, "IsWithinTownInfluence", 3, ".ii"); + SQGSStation.DefSQStaticMethod(engine, &ScriptStation::HasStationType, "HasStationType", 3, ".ii"); + SQGSStation.DefSQStaticMethod(engine, &ScriptStation::HasRoadType, "HasRoadType", 3, ".ii"); + SQGSStation.DefSQStaticMethod(engine, &ScriptStation::GetNearestTown, "GetNearestTown", 2, ".i"); + + SQGSStation.PostRegister(engine); +} diff --git a/src/script/api/game/game_stationlist.hpp.sq b/src/script/api/game/game_stationlist.hpp.sq new file mode 100644 index 000000000..65138964f --- /dev/null +++ b/src/script/api/game/game_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 "GSStationList"; } + +void SQGSStationList_Register(Squirrel *engine) +{ + DefSQClass SQGSStationList("GSStationList"); + SQGSStationList.PreRegister(engine, "GSList"); + SQGSStationList.AddConstructor(engine, "xi"); + + SQGSStationList.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "GSStationList_Vehicle"; } + +void SQGSStationList_Vehicle_Register(Squirrel *engine) +{ + DefSQClass SQGSStationList_Vehicle("GSStationList_Vehicle"); + SQGSStationList_Vehicle.PreRegister(engine, "GSList"); + SQGSStationList_Vehicle.AddConstructor(engine, "xi"); + + SQGSStationList_Vehicle.PostRegister(engine); +} diff --git a/src/script/api/game/game_subsidy.hpp.sq b/src/script/api/game/game_subsidy.hpp.sq new file mode 100644 index 000000000..bba8abce5 --- /dev/null +++ b/src/script/api/game/game_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 "GSSubsidy"; } + +void SQGSSubsidy_Register(Squirrel *engine) +{ + DefSQClass SQGSSubsidy("GSSubsidy"); + SQGSSubsidy.PreRegister(engine); + SQGSSubsidy.AddConstructor(engine, "x"); + + SQGSSubsidy.DefSQConst(engine, ScriptSubsidy::SPT_INDUSTRY, "SPT_INDUSTRY"); + SQGSSubsidy.DefSQConst(engine, ScriptSubsidy::SPT_TOWN, "SPT_TOWN"); + SQGSSubsidy.DefSQConst(engine, ScriptSubsidy::SPT_INVALID, "SPT_INVALID"); + + SQGSSubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::IsValidSubsidy, "IsValidSubsidy", 2, ".i"); + SQGSSubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::IsAwarded, "IsAwarded", 2, ".i"); + SQGSSubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetAwardedTo, "GetAwardedTo", 2, ".i"); + SQGSSubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetExpireDate, "GetExpireDate", 2, ".i"); + SQGSSubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetCargoType, "GetCargoType", 2, ".i"); + SQGSSubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetSourceType, "GetSourceType", 2, ".i"); + SQGSSubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetSourceIndex, "GetSourceIndex", 2, ".i"); + SQGSSubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetDestinationType, "GetDestinationType", 2, ".i"); + SQGSSubsidy.DefSQStaticMethod(engine, &ScriptSubsidy::GetDestinationIndex, "GetDestinationIndex", 2, ".i"); + + SQGSSubsidy.PostRegister(engine); +} diff --git a/src/script/api/game/game_subsidylist.hpp.sq b/src/script/api/game/game_subsidylist.hpp.sq new file mode 100644 index 000000000..73dcbd411 --- /dev/null +++ b/src/script/api/game/game_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 "GSSubsidyList"; } + +void SQGSSubsidyList_Register(Squirrel *engine) +{ + DefSQClass SQGSSubsidyList("GSSubsidyList"); + SQGSSubsidyList.PreRegister(engine, "GSList"); + SQGSSubsidyList.AddConstructor(engine, "x"); + + SQGSSubsidyList.PostRegister(engine); +} diff --git a/src/script/api/game/game_tilelist.hpp.sq b/src/script/api/game/game_tilelist.hpp.sq new file mode 100644 index 000000000..a4ade9cc5 --- /dev/null +++ b/src/script/api/game/game_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 "GSTileList"; } + +void SQGSTileList_Register(Squirrel *engine) +{ + DefSQClass SQGSTileList("GSTileList"); + SQGSTileList.PreRegister(engine, "GSList"); + SQGSTileList.AddConstructor(engine, "x"); + + SQGSTileList.DefSQMethod(engine, &ScriptTileList::AddRectangle, "AddRectangle", 3, "xii"); + SQGSTileList.DefSQMethod(engine, &ScriptTileList::AddTile, "AddTile", 2, "xi"); + SQGSTileList.DefSQMethod(engine, &ScriptTileList::RemoveRectangle, "RemoveRectangle", 3, "xii"); + SQGSTileList.DefSQMethod(engine, &ScriptTileList::RemoveTile, "RemoveTile", 2, "xi"); + + SQGSTileList.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "GSTileList_IndustryAccepting"; } + +void SQGSTileList_IndustryAccepting_Register(Squirrel *engine) +{ + DefSQClass SQGSTileList_IndustryAccepting("GSTileList_IndustryAccepting"); + SQGSTileList_IndustryAccepting.PreRegister(engine, "GSTileList"); + SQGSTileList_IndustryAccepting.AddConstructor(engine, "xii"); + + SQGSTileList_IndustryAccepting.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "GSTileList_IndustryProducing"; } + +void SQGSTileList_IndustryProducing_Register(Squirrel *engine) +{ + DefSQClass SQGSTileList_IndustryProducing("GSTileList_IndustryProducing"); + SQGSTileList_IndustryProducing.PreRegister(engine, "GSTileList"); + SQGSTileList_IndustryProducing.AddConstructor(engine, "xii"); + + SQGSTileList_IndustryProducing.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "GSTileList_StationType"; } + +void SQGSTileList_StationType_Register(Squirrel *engine) +{ + DefSQClass SQGSTileList_StationType("GSTileList_StationType"); + SQGSTileList_StationType.PreRegister(engine, "GSTileList"); + SQGSTileList_StationType.AddConstructor(engine, "xii"); + + SQGSTileList_StationType.PostRegister(engine); +} diff --git a/src/script/api/game/game_tunnel.hpp.sq b/src/script/api/game/game_tunnel.hpp.sq new file mode 100644 index 000000000..49a6311de --- /dev/null +++ b/src/script/api/game/game_tunnel.hpp.sq @@ -0,0 +1,44 @@ +/* $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" +#include "../template/template_tunnel.hpp.sq" + + +template <> const char *GetClassName() { return "GSTunnel"; } + +void SQGSTunnel_Register(Squirrel *engine) +{ + DefSQClass SQGSTunnel("GSTunnel"); + SQGSTunnel.PreRegister(engine); + SQGSTunnel.AddConstructor(engine, "x"); + + SQGSTunnel.DefSQConst(engine, ScriptTunnel::ERR_TUNNEL_BASE, "ERR_TUNNEL_BASE"); + SQGSTunnel.DefSQConst(engine, ScriptTunnel::ERR_TUNNEL_CANNOT_BUILD_ON_WATER, "ERR_TUNNEL_CANNOT_BUILD_ON_WATER"); + SQGSTunnel.DefSQConst(engine, ScriptTunnel::ERR_TUNNEL_START_SITE_UNSUITABLE, "ERR_TUNNEL_START_SITE_UNSUITABLE"); + SQGSTunnel.DefSQConst(engine, ScriptTunnel::ERR_TUNNEL_ANOTHER_TUNNEL_IN_THE_WAY, "ERR_TUNNEL_ANOTHER_TUNNEL_IN_THE_WAY"); + SQGSTunnel.DefSQConst(engine, ScriptTunnel::ERR_TUNNEL_END_SITE_UNSUITABLE, "ERR_TUNNEL_END_SITE_UNSUITABLE"); + + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_BUILD_ON_WATER, ScriptTunnel::ERR_TUNNEL_CANNOT_BUILD_ON_WATER); + ScriptError::RegisterErrorMap(STR_ERROR_SITE_UNSUITABLE_FOR_TUNNEL, ScriptTunnel::ERR_TUNNEL_START_SITE_UNSUITABLE); + ScriptError::RegisterErrorMap(STR_ERROR_ANOTHER_TUNNEL_IN_THE_WAY, ScriptTunnel::ERR_TUNNEL_ANOTHER_TUNNEL_IN_THE_WAY); + ScriptError::RegisterErrorMap(STR_ERROR_UNABLE_TO_EXCAVATE_LAND, ScriptTunnel::ERR_TUNNEL_END_SITE_UNSUITABLE); + + ScriptError::RegisterErrorMapString(ScriptTunnel::ERR_TUNNEL_CANNOT_BUILD_ON_WATER, "ERR_TUNNEL_CANNOT_BUILD_ON_WATER"); + ScriptError::RegisterErrorMapString(ScriptTunnel::ERR_TUNNEL_START_SITE_UNSUITABLE, "ERR_TUNNEL_START_SITE_UNSUITABLE"); + ScriptError::RegisterErrorMapString(ScriptTunnel::ERR_TUNNEL_ANOTHER_TUNNEL_IN_THE_WAY, "ERR_TUNNEL_ANOTHER_TUNNEL_IN_THE_WAY"); + ScriptError::RegisterErrorMapString(ScriptTunnel::ERR_TUNNEL_END_SITE_UNSUITABLE, "ERR_TUNNEL_END_SITE_UNSUITABLE"); + + SQGSTunnel.DefSQStaticMethod(engine, &ScriptTunnel::IsTunnelTile, "IsTunnelTile", 2, ".i"); + SQGSTunnel.DefSQStaticMethod(engine, &ScriptTunnel::GetOtherTunnelEnd, "GetOtherTunnelEnd", 2, ".i"); + + SQGSTunnel.PostRegister(engine); +} diff --git a/src/script/api/game/game_vehiclelist.hpp.sq b/src/script/api/game/game_vehiclelist.hpp.sq new file mode 100644 index 000000000..c5c6a18a7 --- /dev/null +++ b/src/script/api/game/game_vehiclelist.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_vehiclelist.hpp" +#include "../template/template_vehiclelist.hpp.sq" + + +template <> const char *GetClassName() { return "GSVehicleList"; } + +void SQGSVehicleList_Register(Squirrel *engine) +{ + DefSQClass SQGSVehicleList("GSVehicleList"); + SQGSVehicleList.PreRegister(engine, "GSList"); + SQGSVehicleList.AddConstructor(engine, "x"); + + SQGSVehicleList.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "GSVehicleList_Station"; } + +void SQGSVehicleList_Station_Register(Squirrel *engine) +{ + DefSQClass SQGSVehicleList_Station("GSVehicleList_Station"); + SQGSVehicleList_Station.PreRegister(engine, "GSList"); + SQGSVehicleList_Station.AddConstructor(engine, "xi"); + + SQGSVehicleList_Station.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "GSVehicleList_Depot"; } + +void SQGSVehicleList_Depot_Register(Squirrel *engine) +{ + DefSQClass SQGSVehicleList_Depot("GSVehicleList_Depot"); + SQGSVehicleList_Depot.PreRegister(engine, "GSList"); + SQGSVehicleList_Depot.AddConstructor(engine, "xi"); + + SQGSVehicleList_Depot.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "GSVehicleList_SharedOrders"; } + +void SQGSVehicleList_SharedOrders_Register(Squirrel *engine) +{ + DefSQClass SQGSVehicleList_SharedOrders("GSVehicleList_SharedOrders"); + SQGSVehicleList_SharedOrders.PreRegister(engine, "GSList"); + SQGSVehicleList_SharedOrders.AddConstructor(engine, "xi"); + + SQGSVehicleList_SharedOrders.PostRegister(engine); +} diff --git a/src/script/api/game/game_waypoint.hpp.sq b/src/script/api/game/game_waypoint.hpp.sq new file mode 100644 index 000000000..984e1fa2f --- /dev/null +++ b/src/script/api/game/game_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 "GSWaypoint"; } + +void SQGSWaypoint_Register(Squirrel *engine) +{ + DefSQClass SQGSWaypoint("GSWaypoint"); + SQGSWaypoint.PreRegister(engine, "GSBaseStation"); + SQGSWaypoint.AddConstructor(engine, "x"); + + SQGSWaypoint.DefSQConst(engine, ScriptWaypoint::ERR_WAYPOINT_BASE, "ERR_WAYPOINT_BASE"); + SQGSWaypoint.DefSQConst(engine, ScriptWaypoint::ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT, "ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT"); + SQGSWaypoint.DefSQConst(engine, ScriptWaypoint::ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS, "ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS"); + SQGSWaypoint.DefSQConst(engine, ScriptWaypoint::WAYPOINT_RAIL, "WAYPOINT_RAIL"); + SQGSWaypoint.DefSQConst(engine, ScriptWaypoint::WAYPOINT_BUOY, "WAYPOINT_BUOY"); + SQGSWaypoint.DefSQConst(engine, ScriptWaypoint::WAYPOINT_ANY, "WAYPOINT_ANY"); + + 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"); + + SQGSWaypoint.DefSQStaticMethod(engine, &ScriptWaypoint::IsValidWaypoint, "IsValidWaypoint", 2, ".i"); + SQGSWaypoint.DefSQStaticMethod(engine, &ScriptWaypoint::GetWaypointID, "GetWaypointID", 2, ".i"); + SQGSWaypoint.DefSQStaticMethod(engine, &ScriptWaypoint::HasWaypointType, "HasWaypointType", 3, ".ii"); + + SQGSWaypoint.PostRegister(engine); +} diff --git a/src/script/api/game/game_waypointlist.hpp.sq b/src/script/api/game/game_waypointlist.hpp.sq new file mode 100644 index 000000000..ccb428ce6 --- /dev/null +++ b/src/script/api/game/game_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 "GSWaypointList"; } + +void SQGSWaypointList_Register(Squirrel *engine) +{ + DefSQClass SQGSWaypointList("GSWaypointList"); + SQGSWaypointList.PreRegister(engine, "GSList"); + SQGSWaypointList.AddConstructor(engine, "xi"); + + SQGSWaypointList.PostRegister(engine); +} + + +template <> const char *GetClassName() { return "GSWaypointList_Vehicle"; } + +void SQGSWaypointList_Vehicle_Register(Squirrel *engine) +{ + DefSQClass SQGSWaypointList_Vehicle("GSWaypointList_Vehicle"); + SQGSWaypointList_Vehicle.PreRegister(engine, "GSList"); + SQGSWaypointList_Vehicle.AddConstructor(engine, "xi"); + + SQGSWaypointList_Vehicle.PostRegister(engine); +} diff --git a/src/script/api/script_basestation.cpp b/src/script/api/script_basestation.cpp index 9fcb4b593..0ef286242 100644 --- a/src/script/api/script_basestation.cpp +++ b/src/script/api/script_basestation.cpp @@ -20,7 +20,7 @@ /* static */ bool ScriptBaseStation::IsValidBaseStation(StationID station_id) { const BaseStation *st = ::BaseStation::GetIfValid(station_id); - return st != NULL && (st->owner == _current_company || st->owner == OWNER_NONE); + return st != NULL && (st->owner == _current_company || _current_company == OWNER_DEITY || st->owner == OWNER_NONE); } /* static */ char *ScriptBaseStation::GetName(StationID station_id) diff --git a/src/script/api/script_basestation.hpp b/src/script/api/script_basestation.hpp index b5d5e6f78..c7b462f7e 100644 --- a/src/script/api/script_basestation.hpp +++ b/src/script/api/script_basestation.hpp @@ -16,7 +16,7 @@ /** * Base class for stations and waypoints. - * @api ai + * @api ai game */ class ScriptBaseStation : public ScriptObject { public: @@ -55,6 +55,7 @@ public: * @pre 'name' must have at most 30 characters. * @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE * @return True if the name was changed. + * @api -game */ static bool SetName(StationID station_id, const char *name); diff --git a/src/script/api/script_bridge.hpp b/src/script/api/script_bridge.hpp index 29bca9e40..16fe8d6b8 100644 --- a/src/script/api/script_bridge.hpp +++ b/src/script/api/script_bridge.hpp @@ -16,7 +16,7 @@ /** * Class that handles all bridge related functions. - * @api ai + * @api ai game */ class ScriptBridge : public ScriptObject { public: @@ -145,6 +145,7 @@ public: * @return Whether the bridge has been/can be build or not. * @note No matter if the road pieces were build or not, if building the * bridge succeeded, this function returns true. + * @api -game */ static bool BuildBridge(ScriptVehicle::VehicleType vehicle_type, BridgeID bridge_id, TileIndex start, TileIndex end); @@ -154,6 +155,7 @@ public: * @pre ScriptMap::IsValidTile(tile). * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY * @return Whether the bridge has been/can be removed or not. + * @api -game */ static bool RemoveBridge(TileIndex tile); diff --git a/src/script/api/script_bridgelist.hpp b/src/script/api/script_bridgelist.hpp index 596213b12..ed09af8b1 100644 --- a/src/script/api/script_bridgelist.hpp +++ b/src/script/api/script_bridgelist.hpp @@ -16,7 +16,7 @@ /** * Create a list of bridges types. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptBridgeList : public ScriptList { @@ -26,7 +26,7 @@ public: /** * Create a list of bridges types that can be built on a specific length. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptBridgeList_Length : public ScriptList { diff --git a/src/script/api/script_cargolist.hpp b/src/script/api/script_cargolist.hpp index 8880ee287..a7cd8b69b 100644 --- a/src/script/api/script_cargolist.hpp +++ b/src/script/api/script_cargolist.hpp @@ -16,7 +16,7 @@ /** * Creates a list of cargoes that can be produced in the current game. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptCargoList : public ScriptList { @@ -28,7 +28,7 @@ public: * Creates a list of cargoes that the given industry accepts. * @note This list also includes cargoes that are temporarily not accepted * by this industry, @see ScriptIndustry::IsCargoAccepted. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptCargoList_IndustryAccepting : public ScriptList { @@ -41,7 +41,7 @@ public: /** * Creates a list of cargoes that the given industry can produce. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptCargoList_IndustryProducing : public ScriptList { @@ -54,7 +54,7 @@ public: /** * Creates a list of cargoes that the given station accepts. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptCargoList_StationAccepting : public ScriptList { diff --git a/src/script/api/script_depotlist.cpp b/src/script/api/script_depotlist.cpp index c66850b67..072cddf1c 100644 --- a/src/script/api/script_depotlist.cpp +++ b/src/script/api/script_depotlist.cpp @@ -29,7 +29,7 @@ ScriptDepotList::ScriptDepotList(ScriptTile::TransportType transport_type) /* Hangars are not seen as real depots by the depot code. */ const Station *st; FOR_ALL_STATIONS(st) { - if (st->owner == ::_current_company) { + if (st->owner == ::_current_company || ::_current_company == OWNER_DEITY) { for (uint i = 0; i < st->airport.GetNumHangars(); i++) { this->AddItem(st->airport.GetHangarTile(i)); } @@ -42,6 +42,6 @@ ScriptDepotList::ScriptDepotList(ScriptTile::TransportType transport_type) /* Handle 'standard' depots. */ const Depot *depot; FOR_ALL_DEPOTS(depot) { - if (::GetTileOwner(depot->xy) == ::_current_company && ::IsTileType(depot->xy, tile_type)) this->AddItem(depot->xy); + if ((::GetTileOwner(depot->xy) == ::_current_company || ::_current_company == OWNER_DEITY) && ::IsTileType(depot->xy, tile_type)) this->AddItem(depot->xy); } } diff --git a/src/script/api/script_depotlist.hpp b/src/script/api/script_depotlist.hpp index f24be369a..c516ac758 100644 --- a/src/script/api/script_depotlist.hpp +++ b/src/script/api/script_depotlist.hpp @@ -17,7 +17,7 @@ /** * Creates a list of the locations of the depots (and hangars) of which you are the owner. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptDepotList : public ScriptList { diff --git a/src/script/api/script_engine.cpp b/src/script/api/script_engine.cpp index 6c9d3c709..56470c399 100644 --- a/src/script/api/script_engine.cpp +++ b/src/script/api/script_engine.cpp @@ -24,7 +24,7 @@ /* static */ bool ScriptEngine::IsValidEngine(EngineID engine_id) { const Engine *e = ::Engine::GetIfValid(engine_id); - return e != NULL && (::IsEngineBuildable(engine_id, e->type, _current_company) || ::Company::Get(_current_company)->group_all[e->type].num_engines[engine_id] > 0); + return e != NULL && (::IsEngineBuildable(engine_id, e->type, _current_company) || (_current_company != OWNER_DEITY && ::Company::Get(_current_company)->group_all[e->type].num_engines[engine_id] > 0)); } /* static */ bool ScriptEngine::IsBuildable(EngineID engine_id) diff --git a/src/script/api/script_engine.hpp b/src/script/api/script_engine.hpp index f96676f3b..c97707acd 100644 --- a/src/script/api/script_engine.hpp +++ b/src/script/api/script_engine.hpp @@ -18,7 +18,7 @@ /** * Class that handles all engine related functions. - * @api ai + * @api ai game */ class ScriptEngine : public ScriptObject { public: diff --git a/src/script/api/script_enginelist.cpp b/src/script/api/script_enginelist.cpp index 6b0b512ab..e76d86e13 100644 --- a/src/script/api/script_enginelist.cpp +++ b/src/script/api/script_enginelist.cpp @@ -19,6 +19,6 @@ ScriptEngineList::ScriptEngineList(ScriptVehicle::VehicleType vehicle_type) { Engine *e; FOR_ALL_ENGINES_OF_TYPE(e, (::VehicleType)vehicle_type) { - if (HasBit(e->company_avail, _current_company)) this->AddItem(e->index); + if (_current_company == OWNER_DEITY || HasBit(e->company_avail, _current_company)) this->AddItem(e->index); } } diff --git a/src/script/api/script_enginelist.hpp b/src/script/api/script_enginelist.hpp index 78672c93e..1fe2c4bc1 100644 --- a/src/script/api/script_enginelist.hpp +++ b/src/script/api/script_enginelist.hpp @@ -17,7 +17,7 @@ /** * Create a list of engines based on a vehicle type. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptEngineList : public ScriptList { diff --git a/src/script/api/script_rail.cpp b/src/script/api/script_rail.cpp index 6f0ce7255..631578806 100644 --- a/src/script/api/script_rail.cpp +++ b/src/script/api/script_rail.cpp @@ -74,7 +74,7 @@ { if ((::RailType)rail_type < RAILTYPE_BEGIN || (::RailType)rail_type >= RAILTYPE_END) return false; - return ::HasRailtypeAvail(_current_company, (::RailType)rail_type); + return _current_company == OWNER_DEITY || ::HasRailtypeAvail(_current_company, (::RailType)rail_type); } /* static */ ScriptRail::RailType ScriptRail::GetCurrentRailType() diff --git a/src/script/api/script_rail.hpp b/src/script/api/script_rail.hpp index c5158fee6..f76d53531 100644 --- a/src/script/api/script_rail.hpp +++ b/src/script/api/script_rail.hpp @@ -18,7 +18,7 @@ /** * Class that handles all rail related functions. - * @api ai + * @api ai game */ class ScriptRail : public ScriptObject { public: @@ -205,6 +205,7 @@ public: * @pre IsRailTypeAvailable(convert_to). * @exception ScriptRail::ERR_UNSUITABLE_TRACK * @return Whether at least some rail has been converted successfully. + * @api -game */ static bool ConvertRailType(TileIndex start_tile, TileIndex end_tile, ScriptRail::RailType convert_to); @@ -235,6 +236,7 @@ public: * @exception ScriptError::ERR_FLAT_LAND_REQUIRED * @exception ScriptError::ERR_AREA_NOT_CLEAR * @return Whether the rail depot has been/can be build or not. + * @api -game */ static bool BuildRailDepot(TileIndex tile, TileIndex front); @@ -258,6 +260,7 @@ public: * @exception ScriptStation::ERR_STATION_TOO_MANY_STATIONS * @exception ScriptStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN * @return Whether the station has been/can be build or not. + * @api -game */ static bool BuildRailStation(TileIndex tile, RailTrack direction, uint num_platforms, uint platform_length, StationID station_id); @@ -291,6 +294,7 @@ public: * @exception ScriptStation::ERR_STATION_TOO_MANY_STATIONS * @exception ScriptStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN * @return Whether the station has been/can be build or not. + * @api -game */ static bool BuildNewGRFRailStation(TileIndex tile, RailTrack direction, uint num_platforms, uint platform_length, StationID station_id, CargoID cargo_id, IndustryType source_industry, IndustryType goal_industry, int distance, bool source_station); @@ -303,6 +307,7 @@ public: * @pre IsRailTypeAvailable(GetCurrentRailType()). * @exception ScriptError::ERR_FLAT_LAND_REQUIRED * @return Whether the rail waypoint has been/can be build or not. + * @api -game */ static bool BuildRailWaypoint(TileIndex tile); @@ -314,6 +319,7 @@ public: * @pre IsValidTile(tile). * @pre IsValidTile(tile2). * @return Whether at least one tile has been/can be cleared or not. + * @api -game */ static bool RemoveRailWaypointTileRectangle(TileIndex tile, TileIndex tile2, bool keep_rail); @@ -325,6 +331,7 @@ public: * @pre IsValidTile(tile). * @pre IsValidTile(tile2). * @return Whether at least one tile has been/can be cleared or not. + * @api -game */ static bool RemoveRailStationTileRectangle(TileIndex tile, TileIndex tile2, bool keep_rail); @@ -351,6 +358,7 @@ public: * @return Whether the rail has been/can be build or not. * @note You can only build a single track with this function so do not * use the values from RailTrack as bitmask. + * @api -game */ static bool BuildRailTrack(TileIndex tile, RailTrack rail_track); @@ -363,6 +371,7 @@ public: * @return Whether the rail has been/can be removed or not. * @note You can only remove a single track with this function so do not * use the values from RailTrack as bitmask. + * @api -game */ static bool RemoveRailTrack(TileIndex tile, RailTrack rail_track); @@ -398,6 +407,7 @@ public: * @exception ScriptError::ERR_ALREADY_BUILT * @note Construction will fail if an obstacle is found between the start and end tiles. * @return Whether the rail has been/can be build or not. + * @api -game */ static bool BuildRail(TileIndex from, TileIndex tile, TileIndex to); @@ -414,6 +424,7 @@ public: * (ScriptMap::GetTileX(from) == ScriptMap::GetTileX(tile) && ScriptMap::GetTileX(tile) == ScriptMap::GetTileX(to)) || * (ScriptMap::GetTileY(from) == ScriptMap::GetTileY(tile) && ScriptMap::GetTileY(tile) == ScriptMap::GetTileY(to)). * @return Whether the rail has been/can be removed or not. + * @api -game */ static bool RemoveRail(TileIndex from, TileIndex tile, TileIndex to); @@ -435,6 +446,7 @@ public: * @pre IsRailTile(tile) && !IsRailStationTile(tile) && !IsRailWaypointTile(tile). * @exception ScriptRail::ERR_UNSUITABLE_TRACK * @return Whether the signal has been/can be build or not. + * @api -game */ static bool BuildSignal(TileIndex tile, TileIndex front, SignalType signal); @@ -445,6 +457,7 @@ public: * @pre ScriptMap::DistanceManhattan(tile, front) == 1. * @pre GetSignalType(tile, front) != SIGNALTYPE_NONE. * @return Whether the signal has been/can be removed or not. + * @api -game */ static bool RemoveSignal(TileIndex tile, TileIndex front); diff --git a/src/script/api/script_railtypelist.cpp b/src/script/api/script_railtypelist.cpp index 4f0f1d62b..b064b244b 100644 --- a/src/script/api/script_railtypelist.cpp +++ b/src/script/api/script_railtypelist.cpp @@ -17,6 +17,6 @@ ScriptRailTypeList::ScriptRailTypeList() { for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) { - if (::HasRailtypeAvail(_current_company, rt)) this->AddItem(rt); + if (_current_company == OWNER_DEITY || ::HasRailtypeAvail(_current_company, rt)) this->AddItem(rt); } } diff --git a/src/script/api/script_railtypelist.hpp b/src/script/api/script_railtypelist.hpp index 723f1452d..478fd0d5e 100644 --- a/src/script/api/script_railtypelist.hpp +++ b/src/script/api/script_railtypelist.hpp @@ -16,7 +16,7 @@ /** * Creates a list of all available railtypes. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptRailTypeList : public ScriptList { diff --git a/src/script/api/script_station.cpp b/src/script/api/script_station.cpp index 4ece3da04..61964c47b 100644 --- a/src/script/api/script_station.cpp +++ b/src/script/api/script_station.cpp @@ -23,7 +23,7 @@ /* static */ bool ScriptStation::IsValidStation(StationID station_id) { const Station *st = ::Station::GetIfValid(station_id); - return st != NULL && (st->owner == _current_company || st->owner == OWNER_NONE); + return st != NULL && (st->owner == _current_company || _current_company == OWNER_DEITY || st->owner == OWNER_NONE); } /* static */ StationID ScriptStation::GetStationID(TileIndex tile) diff --git a/src/script/api/script_station.hpp b/src/script/api/script_station.hpp index da986fc71..becff2156 100644 --- a/src/script/api/script_station.hpp +++ b/src/script/api/script_station.hpp @@ -18,7 +18,7 @@ /** * Class that handles all station related functions. - * @api ai + * @api ai game */ class ScriptStation : public ScriptBaseStation { public: diff --git a/src/script/api/script_stationlist.cpp b/src/script/api/script_stationlist.cpp index bba90cc2b..2885e5d78 100644 --- a/src/script/api/script_stationlist.cpp +++ b/src/script/api/script_stationlist.cpp @@ -20,7 +20,7 @@ ScriptStationList::ScriptStationList(ScriptStation::StationType station_type) { Station *st; FOR_ALL_STATIONS(st) { - if (st->owner == _current_company && (st->facilities & station_type) != 0) this->AddItem(st->index); + if ((st->owner == _current_company || _current_company == OWNER_DEITY) && (st->facilities & station_type) != 0) this->AddItem(st->index); } } diff --git a/src/script/api/script_stationlist.hpp b/src/script/api/script_stationlist.hpp index 49269d29f..cd9c98137 100644 --- a/src/script/api/script_stationlist.hpp +++ b/src/script/api/script_stationlist.hpp @@ -17,7 +17,7 @@ /** * Creates a list of stations of which you are the owner. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptStationList : public ScriptList { @@ -30,7 +30,7 @@ public: /** * Creates a list of stations which the vehicle has in its orders. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptStationList_Vehicle : public ScriptList { diff --git a/src/script/api/script_subsidy.hpp b/src/script/api/script_subsidy.hpp index 674b0e14d..b6742ab1c 100644 --- a/src/script/api/script_subsidy.hpp +++ b/src/script/api/script_subsidy.hpp @@ -16,7 +16,7 @@ /** * Class that handles all subsidy related functions. - * @api ai + * @api ai game */ class ScriptSubsidy : public ScriptObject { public: diff --git a/src/script/api/script_subsidylist.hpp b/src/script/api/script_subsidylist.hpp index 05342df2e..7080ac6d8 100644 --- a/src/script/api/script_subsidylist.hpp +++ b/src/script/api/script_subsidylist.hpp @@ -16,7 +16,7 @@ /** * Creates a list of all current subsidies. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptSubsidyList : public ScriptList { diff --git a/src/script/api/script_tilelist.hpp b/src/script/api/script_tilelist.hpp index 990237c4f..74c3afa52 100644 --- a/src/script/api/script_tilelist.hpp +++ b/src/script/api/script_tilelist.hpp @@ -17,7 +17,7 @@ /** * Creates an empty list, in which you can add tiles. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptTileList : public ScriptList { @@ -58,7 +58,7 @@ public: /** * Creates a list of tiles that will accept cargo for the given industry. * @note If a simular industry is close, it might happen that this industry receives the cargo. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptTileList_IndustryAccepting : public ScriptTileList { @@ -75,7 +75,7 @@ public: /** * Creates a list of tiles which the industry checks to see if a station is * there to receive cargo produced by this industry. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptTileList_IndustryProducing : public ScriptTileList { @@ -92,7 +92,7 @@ public: /** * Creates a list of tiles which have the requested StationType of the * StationID. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptTileList_StationType : public ScriptTileList { diff --git a/src/script/api/script_tunnel.hpp b/src/script/api/script_tunnel.hpp index 80f69d69c..1ae9c4d1b 100644 --- a/src/script/api/script_tunnel.hpp +++ b/src/script/api/script_tunnel.hpp @@ -16,7 +16,7 @@ /** * Class that handles all tunnel related functions. - * @api ai + * @api ai game */ class ScriptTunnel : public ScriptObject { public: @@ -96,6 +96,7 @@ public: * @note The slope of a tile can be determined by ScriptTile::GetSlope(TileIndex). * @note No matter if the road pieces were build or not, if building the * tunnel succeeded, this function returns true. + * @api -game */ static bool BuildTunnel(ScriptVehicle::VehicleType vehicle_type, TileIndex start); @@ -105,6 +106,7 @@ public: * @pre ScriptMap::IsValidTile(tile) && IsTunnelTile(tile). * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY * @return Whether the tunnel has been/can be removed or not. + * @api -game */ static bool RemoveTunnel(TileIndex tile); }; diff --git a/src/script/api/script_vehiclelist.cpp b/src/script/api/script_vehiclelist.cpp index a8eae5be8..13bd9ae0d 100644 --- a/src/script/api/script_vehiclelist.cpp +++ b/src/script/api/script_vehiclelist.cpp @@ -22,7 +22,7 @@ ScriptVehicleList::ScriptVehicleList() { const Vehicle *v; FOR_ALL_VEHICLES(v) { - if (v->owner == _current_company && v->IsPrimaryVehicle()) this->AddItem(v->index); + if ((v->owner == _current_company || _current_company == OWNER_DEITY) && v->IsPrimaryVehicle()) this->AddItem(v->index); } } @@ -32,7 +32,7 @@ ScriptVehicleList_Station::ScriptVehicleList_Station(StationID station_id) const Vehicle *v; FOR_ALL_VEHICLES(v) { - if (v->owner == _current_company && v->IsPrimaryVehicle()) { + if ((v->owner == _current_company || _current_company == OWNER_DEITY) && v->IsPrimaryVehicle()) { const Order *order; FOR_VEHICLE_ORDERS(v, order) { @@ -83,7 +83,7 @@ ScriptVehicleList_Depot::ScriptVehicleList_Depot(TileIndex tile) const Vehicle *v; FOR_ALL_VEHICLES(v) { - if (v->owner == _current_company && v->IsPrimaryVehicle() && v->type == type) { + if ((v->owner == _current_company || _current_company == OWNER_DEITY) && v->IsPrimaryVehicle() && v->type == type) { const Order *order; FOR_VEHICLE_ORDERS(v, order) { diff --git a/src/script/api/script_vehiclelist.hpp b/src/script/api/script_vehiclelist.hpp index 9ede0ec48..7df3a2bb0 100644 --- a/src/script/api/script_vehiclelist.hpp +++ b/src/script/api/script_vehiclelist.hpp @@ -17,7 +17,7 @@ /** * Creates a list of vehicles of which you are the owner. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptVehicleList : public ScriptList { @@ -27,7 +27,7 @@ public: /** * Creates a list of vehicles that have orders to a given station. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptVehicleList_Station : public ScriptList { @@ -45,7 +45,7 @@ public: * aircraft having a depot order on a hangar of that airport will be * returned. For all other vehicle types the tile has to be a depot or * an empty list will be returned. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptVehicleList_Depot : public ScriptList { @@ -58,7 +58,7 @@ public: /** * Creates a list of vehicles that share orders. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptVehicleList_SharedOrders : public ScriptList { diff --git a/src/script/api/script_waypoint.cpp b/src/script/api/script_waypoint.cpp index 86dd11649..fdb3ac9d9 100644 --- a/src/script/api/script_waypoint.cpp +++ b/src/script/api/script_waypoint.cpp @@ -19,7 +19,7 @@ /* static */ bool ScriptWaypoint::IsValidWaypoint(StationID waypoint_id) { const Waypoint *wp = ::Waypoint::GetIfValid(waypoint_id); - return wp != NULL && (wp->owner == _current_company || wp->owner == OWNER_NONE); + return wp != NULL && (wp->owner == _current_company || _current_company == OWNER_DEITY || wp->owner == OWNER_NONE); } /* static */ StationID ScriptWaypoint::GetWaypointID(TileIndex tile) diff --git a/src/script/api/script_waypoint.hpp b/src/script/api/script_waypoint.hpp index 797501e7e..5151e2ad3 100644 --- a/src/script/api/script_waypoint.hpp +++ b/src/script/api/script_waypoint.hpp @@ -17,7 +17,7 @@ /** * Class that handles all waypoint related functions. - * @api ai + * @api ai game */ class ScriptWaypoint : public ScriptBaseStation { public: diff --git a/src/script/api/script_waypointlist.cpp b/src/script/api/script_waypointlist.cpp index 11ab6b951..2906f15e9 100644 --- a/src/script/api/script_waypointlist.cpp +++ b/src/script/api/script_waypointlist.cpp @@ -21,7 +21,7 @@ ScriptWaypointList::ScriptWaypointList(ScriptWaypoint::WaypointType waypoint_typ const Waypoint *wp; FOR_ALL_WAYPOINTS(wp) { if ((wp->facilities & waypoint_type) && - (wp->owner == _current_company || wp->owner == OWNER_NONE)) this->AddItem(wp->index); + (wp->owner == _current_company || _current_company == OWNER_DEITY || wp->owner == OWNER_NONE)) this->AddItem(wp->index); } } diff --git a/src/script/api/script_waypointlist.hpp b/src/script/api/script_waypointlist.hpp index 18afbb8c8..fde15c953 100644 --- a/src/script/api/script_waypointlist.hpp +++ b/src/script/api/script_waypointlist.hpp @@ -17,7 +17,7 @@ /** * Creates a list of waypoints of which you are the owner. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptWaypointList : public ScriptList { @@ -30,7 +30,7 @@ public: /** * Creates a list of waypoints which the vehicle has in its orders. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptWaypointList_Vehicle : public ScriptList { -- cgit v1.2.3-70-g09d2