Mercurial > hg > openttd
changeset 18766:327b85ab521d draft
(svn r23614) -Add: more API functions exposed to NoGo (part 1)
line wrap: on
line diff
--- a/src/game/game_instance.cpp +++ b/src/game/game_instance.cpp @@ -24,13 +24,32 @@ /* Convert all Game related classes to Squirrel data. * Note: this line is a marker in squirrel_export.sh. Do not change! */ #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_cargo.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_error.hpp.sq" #include "../script/api/game/game_event.hpp.sq" #include "../script/api/game/game_execmode.hpp.sq" +#include "../script/api/game/game_gamesettings.hpp.sq" +#include "../script/api/game/game_industry.hpp.sq" +#include "../script/api/game/game_industrylist.hpp.sq" +#include "../script/api/game/game_industrytype.hpp.sq" +#include "../script/api/game/game_industrytypelist.hpp.sq" +#include "../script/api/game/game_infrastructure.hpp.sq" #include "../script/api/game/game_list.hpp.sq" #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_road.hpp.sq" +#include "../script/api/game/game_signlist.hpp.sq" #include "../script/api/game/game_testmode.hpp.sq" +#include "../script/api/game/game_tile.hpp.sq" +#include "../script/api/game/game_town.hpp.sq" +#include "../script/api/game/game_townlist.hpp.sq" +#include "../script/api/game/game_vehicle.hpp.sq" GameInstance::GameInstance() : @@ -52,12 +71,34 @@ /* Register all classes */ SQGSList_Register(this->engine); SQGSAccounting_Register(this->engine); + SQGSAirport_Register(this->engine); + SQGSBase_Register(this->engine); + SQGSCargo_Register(this->engine); + SQGSCompany_Register(this->engine); + SQGSDate_Register(this->engine); SQGSError_Register(this->engine); SQGSEvent_Register(this->engine); SQGSEventController_Register(this->engine); SQGSExecMode_Register(this->engine); + SQGSGameSettings_Register(this->engine); + SQGSIndustry_Register(this->engine); + SQGSIndustryList_Register(this->engine); + SQGSIndustryList_CargoAccepting_Register(this->engine); + SQGSIndustryList_CargoProducing_Register(this->engine); + SQGSIndustryType_Register(this->engine); + SQGSIndustryTypeList_Register(this->engine); + SQGSInfrastructure_Register(this->engine); SQGSLog_Register(this->engine); + SQGSMap_Register(this->engine); + SQGSMarine_Register(this->engine); + SQGSRoad_Register(this->engine); + SQGSSignList_Register(this->engine); SQGSTestMode_Register(this->engine); + SQGSTile_Register(this->engine); + SQGSTown_Register(this->engine); + SQGSTownEffectList_Register(this->engine); + SQGSTownList_Register(this->engine); + SQGSVehicle_Register(this->engine); }
new file mode 100644 --- /dev/null +++ b/src/script/api/game/game_airport.hpp.sq @@ -0,0 +1,55 @@ +/* $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 <http://www.gnu.org/licenses/>. + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_airport.hpp" +#include "../template/template_airport.hpp.sq" + + +template <> const char *GetClassName<ScriptAirport, ST_GS>() { return "GSAirport"; } + +void SQGSAirport_Register(Squirrel *engine) +{ + DefSQClass<ScriptAirport, ST_GS> SQGSAirport("GSAirport"); + SQGSAirport.PreRegister(engine); + SQGSAirport.AddConstructor<void (ScriptAirport::*)(), 1>(engine, "x"); + + SQGSAirport.DefSQConst(engine, ScriptAirport::AT_SMALL, "AT_SMALL"); + SQGSAirport.DefSQConst(engine, ScriptAirport::AT_LARGE, "AT_LARGE"); + SQGSAirport.DefSQConst(engine, ScriptAirport::AT_METROPOLITAN, "AT_METROPOLITAN"); + SQGSAirport.DefSQConst(engine, ScriptAirport::AT_INTERNATIONAL, "AT_INTERNATIONAL"); + SQGSAirport.DefSQConst(engine, ScriptAirport::AT_COMMUTER, "AT_COMMUTER"); + SQGSAirport.DefSQConst(engine, ScriptAirport::AT_INTERCON, "AT_INTERCON"); + SQGSAirport.DefSQConst(engine, ScriptAirport::AT_HELIPORT, "AT_HELIPORT"); + SQGSAirport.DefSQConst(engine, ScriptAirport::AT_HELISTATION, "AT_HELISTATION"); + SQGSAirport.DefSQConst(engine, ScriptAirport::AT_HELIDEPOT, "AT_HELIDEPOT"); + SQGSAirport.DefSQConst(engine, ScriptAirport::AT_INVALID, "AT_INVALID"); + SQGSAirport.DefSQConst(engine, ScriptAirport::PT_HELICOPTER, "PT_HELICOPTER"); + SQGSAirport.DefSQConst(engine, ScriptAirport::PT_SMALL_PLANE, "PT_SMALL_PLANE"); + SQGSAirport.DefSQConst(engine, ScriptAirport::PT_BIG_PLANE, "PT_BIG_PLANE"); + SQGSAirport.DefSQConst(engine, ScriptAirport::PT_INVALID, "PT_INVALID"); + + SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::IsValidAirportType, "IsValidAirportType", 2, ".i"); + SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::IsAirportInformationAvailable, "IsAirportInformationAvailable", 2, ".i"); + SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::GetPrice, "GetPrice", 2, ".i"); + SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::IsHangarTile, "IsHangarTile", 2, ".i"); + SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::IsAirportTile, "IsAirportTile", 2, ".i"); + SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::GetAirportWidth, "GetAirportWidth", 2, ".i"); + SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::GetAirportHeight, "GetAirportHeight", 2, ".i"); + SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::GetAirportCoverageRadius, "GetAirportCoverageRadius", 2, ".i"); + SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::GetNumHangars, "GetNumHangars", 2, ".i"); + SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::GetHangarOfAirport, "GetHangarOfAirport", 2, ".i"); + SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::GetAirportType, "GetAirportType", 2, ".i"); + SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::GetNoiseLevelIncrease, "GetNoiseLevelIncrease", 3, ".ii"); + SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::GetNearestTown, "GetNearestTown", 3, ".ii"); + SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::GetMaintenanceCostFactor, "GetMaintenanceCostFactor", 2, ".i"); + + SQGSAirport.PostRegister(engine); +}
new file mode 100644 --- /dev/null +++ b/src/script/api/game/game_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 <http://www.gnu.org/licenses/>. + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_base.hpp" +#include "../template/template_base.hpp.sq" + + +template <> const char *GetClassName<ScriptBase, ST_GS>() { return "GSBase"; } + +void SQGSBase_Register(Squirrel *engine) +{ + DefSQClass<ScriptBase, ST_GS> SQGSBase("GSBase"); + SQGSBase.PreRegister(engine); + SQGSBase.AddConstructor<void (ScriptBase::*)(), 1>(engine, "x"); + + SQGSBase.DefSQStaticMethod(engine, &ScriptBase::Rand, "Rand", 1, "."); + SQGSBase.DefSQStaticMethod(engine, &ScriptBase::RandItem, "RandItem", 2, ".i"); + SQGSBase.DefSQStaticMethod(engine, &ScriptBase::RandRange, "RandRange", 2, ".i"); + SQGSBase.DefSQStaticMethod(engine, &ScriptBase::RandRangeItem, "RandRangeItem", 3, ".ii"); + SQGSBase.DefSQStaticMethod(engine, &ScriptBase::Chance, "Chance", 3, ".ii"); + SQGSBase.DefSQStaticMethod(engine, &ScriptBase::ChanceItem, "ChanceItem", 4, ".iii"); + + SQGSBase.PostRegister(engine); +}
new file mode 100644 --- /dev/null +++ b/src/script/api/game/game_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 <http://www.gnu.org/licenses/>. + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_cargo.hpp" +#include "../template/template_cargo.hpp.sq" + + +template <> const char *GetClassName<ScriptCargo, ST_GS>() { return "GSCargo"; } + +void SQGSCargo_Register(Squirrel *engine) +{ + DefSQClass<ScriptCargo, ST_GS> SQGSCargo("GSCargo"); + SQGSCargo.PreRegister(engine); + SQGSCargo.AddConstructor<void (ScriptCargo::*)(), 1>(engine, "x"); + + SQGSCargo.DefSQConst(engine, ScriptCargo::CC_PASSENGERS, "CC_PASSENGERS"); + SQGSCargo.DefSQConst(engine, ScriptCargo::CC_MAIL, "CC_MAIL"); + SQGSCargo.DefSQConst(engine, ScriptCargo::CC_EXPRESS, "CC_EXPRESS"); + SQGSCargo.DefSQConst(engine, ScriptCargo::CC_ARMOURED, "CC_ARMOURED"); + SQGSCargo.DefSQConst(engine, ScriptCargo::CC_BULK, "CC_BULK"); + SQGSCargo.DefSQConst(engine, ScriptCargo::CC_PIECE_GOODS, "CC_PIECE_GOODS"); + SQGSCargo.DefSQConst(engine, ScriptCargo::CC_LIQUID, "CC_LIQUID"); + SQGSCargo.DefSQConst(engine, ScriptCargo::CC_REFRIGERATED, "CC_REFRIGERATED"); + SQGSCargo.DefSQConst(engine, ScriptCargo::CC_HAZARDOUS, "CC_HAZARDOUS"); + SQGSCargo.DefSQConst(engine, ScriptCargo::CC_COVERED, "CC_COVERED"); + SQGSCargo.DefSQConst(engine, ScriptCargo::TE_NONE, "TE_NONE"); + SQGSCargo.DefSQConst(engine, ScriptCargo::TE_PASSENGERS, "TE_PASSENGERS"); + SQGSCargo.DefSQConst(engine, ScriptCargo::TE_MAIL, "TE_MAIL"); + SQGSCargo.DefSQConst(engine, ScriptCargo::TE_GOODS, "TE_GOODS"); + SQGSCargo.DefSQConst(engine, ScriptCargo::TE_WATER, "TE_WATER"); + SQGSCargo.DefSQConst(engine, ScriptCargo::TE_FOOD, "TE_FOOD"); + SQGSCargo.DefSQConst(engine, ScriptCargo::CT_AUTO_REFIT, "CT_AUTO_REFIT"); + SQGSCargo.DefSQConst(engine, ScriptCargo::CT_NO_REFIT, "CT_NO_REFIT"); + + SQGSCargo.DefSQStaticMethod(engine, &ScriptCargo::IsValidCargo, "IsValidCargo", 2, ".i"); + SQGSCargo.DefSQStaticMethod(engine, &ScriptCargo::IsValidTownEffect, "IsValidTownEffect", 2, ".i"); + SQGSCargo.DefSQStaticMethod(engine, &ScriptCargo::GetCargoLabel, "GetCargoLabel", 2, ".i"); + SQGSCargo.DefSQStaticMethod(engine, &ScriptCargo::IsFreight, "IsFreight", 2, ".i"); + SQGSCargo.DefSQStaticMethod(engine, &ScriptCargo::HasCargoClass, "HasCargoClass", 3, ".ii"); + SQGSCargo.DefSQStaticMethod(engine, &ScriptCargo::GetTownEffect, "GetTownEffect", 2, ".i"); + SQGSCargo.DefSQStaticMethod(engine, &ScriptCargo::GetCargoIncome, "GetCargoIncome", 4, ".iii"); + + SQGSCargo.PostRegister(engine); +}
new file mode 100644 --- /dev/null +++ b/src/script/api/game/game_company.hpp.sq @@ -0,0 +1,53 @@ +/* $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 <http://www.gnu.org/licenses/>. + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_company.hpp" +#include "../template/template_company.hpp.sq" + + +template <> const char *GetClassName<ScriptCompany, ST_GS>() { return "GSCompany"; } + +void SQGSCompany_Register(Squirrel *engine) +{ + DefSQClass<ScriptCompany, ST_GS> SQGSCompany("GSCompany"); + SQGSCompany.PreRegister(engine); + SQGSCompany.AddConstructor<void (ScriptCompany::*)(), 1>(engine, "x"); + + SQGSCompany.DefSQConst(engine, ScriptCompany::CURRENT_QUARTER, "CURRENT_QUARTER"); + SQGSCompany.DefSQConst(engine, ScriptCompany::EARLIEST_QUARTER, "EARLIEST_QUARTER"); + SQGSCompany.DefSQConst(engine, ScriptCompany::COMPANY_FIRST, "COMPANY_FIRST"); + SQGSCompany.DefSQConst(engine, ScriptCompany::COMPANY_LAST, "COMPANY_LAST"); + SQGSCompany.DefSQConst(engine, ScriptCompany::COMPANY_INVALID, "COMPANY_INVALID"); + SQGSCompany.DefSQConst(engine, ScriptCompany::COMPANY_SELF, "COMPANY_SELF"); + SQGSCompany.DefSQConst(engine, ScriptCompany::GENDER_MALE, "GENDER_MALE"); + SQGSCompany.DefSQConst(engine, ScriptCompany::GENDER_FEMALE, "GENDER_FEMALE"); + SQGSCompany.DefSQConst(engine, ScriptCompany::GENDER_INVALID, "GENDER_INVALID"); + + SQGSCompany.DefSQStaticMethod(engine, &ScriptCompany::ResolveCompanyID, "ResolveCompanyID", 2, ".i"); + SQGSCompany.DefSQStaticMethod(engine, &ScriptCompany::GetName, "GetName", 2, ".i"); + SQGSCompany.DefSQStaticMethod(engine, &ScriptCompany::GetPresidentName, "GetPresidentName", 2, ".i"); + SQGSCompany.DefSQStaticMethod(engine, &ScriptCompany::GetPresidentGender, "GetPresidentGender", 2, ".i"); + SQGSCompany.DefSQStaticMethod(engine, &ScriptCompany::GetLoanAmount, "GetLoanAmount", 1, "."); + SQGSCompany.DefSQStaticMethod(engine, &ScriptCompany::GetMaxLoanAmount, "GetMaxLoanAmount", 1, "."); + SQGSCompany.DefSQStaticMethod(engine, &ScriptCompany::GetLoanInterval, "GetLoanInterval", 1, "."); + SQGSCompany.DefSQStaticMethod(engine, &ScriptCompany::GetBankBalance, "GetBankBalance", 2, ".i"); + SQGSCompany.DefSQStaticMethod(engine, &ScriptCompany::GetQuarterlyIncome, "GetQuarterlyIncome", 3, ".ii"); + SQGSCompany.DefSQStaticMethod(engine, &ScriptCompany::GetQuarterlyExpenses, "GetQuarterlyExpenses", 3, ".ii"); + SQGSCompany.DefSQStaticMethod(engine, &ScriptCompany::GetQuarterlyCargoDelivered, "GetQuarterlyCargoDelivered", 3, ".ii"); + SQGSCompany.DefSQStaticMethod(engine, &ScriptCompany::GetQuarterlyPerformanceRating, "GetQuarterlyPerformanceRating", 3, ".ii"); + SQGSCompany.DefSQStaticMethod(engine, &ScriptCompany::GetQuarterlyCompanyValue, "GetQuarterlyCompanyValue", 3, ".ii"); + SQGSCompany.DefSQStaticMethod(engine, &ScriptCompany::GetCompanyHQ, "GetCompanyHQ", 2, ".i"); + SQGSCompany.DefSQStaticMethod(engine, &ScriptCompany::GetAutoRenewStatus, "GetAutoRenewStatus", 2, ".i"); + SQGSCompany.DefSQStaticMethod(engine, &ScriptCompany::GetAutoRenewMonths, "GetAutoRenewMonths", 2, ".i"); + SQGSCompany.DefSQStaticMethod(engine, &ScriptCompany::GetAutoRenewMoney, "GetAutoRenewMoney", 2, ".i"); + + SQGSCompany.PostRegister(engine); +}
new file mode 100644 --- /dev/null +++ b/src/script/api/game/game_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 <http://www.gnu.org/licenses/>. + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_date.hpp" +#include "../template/template_date.hpp.sq" + + +template <> const char *GetClassName<ScriptDate, ST_GS>() { return "GSDate"; } + +void SQGSDate_Register(Squirrel *engine) +{ + DefSQClass<ScriptDate, ST_GS> SQGSDate("GSDate"); + SQGSDate.PreRegister(engine); + SQGSDate.AddConstructor<void (ScriptDate::*)(), 1>(engine, "x"); + + SQGSDate.DefSQStaticMethod(engine, &ScriptDate::GetCurrentDate, "GetCurrentDate", 1, "."); + SQGSDate.DefSQStaticMethod(engine, &ScriptDate::GetYear, "GetYear", 2, ".i"); + SQGSDate.DefSQStaticMethod(engine, &ScriptDate::GetMonth, "GetMonth", 2, ".i"); + SQGSDate.DefSQStaticMethod(engine, &ScriptDate::GetDayOfMonth, "GetDayOfMonth", 2, ".i"); + SQGSDate.DefSQStaticMethod(engine, &ScriptDate::GetDate, "GetDate", 4, ".iii"); + + SQGSDate.PostRegister(engine); +}
new file mode 100644 --- /dev/null +++ b/src/script/api/game/game_gamesettings.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 <http://www.gnu.org/licenses/>. + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_gamesettings.hpp" +#include "../template/template_gamesettings.hpp.sq" + + +template <> const char *GetClassName<ScriptGameSettings, ST_GS>() { return "GSGameSettings"; } + +void SQGSGameSettings_Register(Squirrel *engine) +{ + DefSQClass<ScriptGameSettings, ST_GS> SQGSGameSettings("GSGameSettings"); + SQGSGameSettings.PreRegister(engine); + SQGSGameSettings.AddConstructor<void (ScriptGameSettings::*)(), 1>(engine, "x"); + + SQGSGameSettings.DefSQStaticMethod(engine, &ScriptGameSettings::IsValid, "IsValid", 2, ".."); + SQGSGameSettings.DefSQStaticMethod(engine, &ScriptGameSettings::GetValue, "GetValue", 2, ".."); + + SQGSGameSettings.PostRegister(engine); +}
new file mode 100644 --- /dev/null +++ b/src/script/api/game/game_industry.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 <http://www.gnu.org/licenses/>. + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_industry.hpp" +#include "../template/template_industry.hpp.sq" + + +template <> const char *GetClassName<ScriptIndustry, ST_GS>() { return "GSIndustry"; } + +void SQGSIndustry_Register(Squirrel *engine) +{ + DefSQClass<ScriptIndustry, ST_GS> SQGSIndustry("GSIndustry"); + SQGSIndustry.PreRegister(engine); + SQGSIndustry.AddConstructor<void (ScriptIndustry::*)(), 1>(engine, "x"); + + SQGSIndustry.DefSQConst(engine, ScriptIndustry::CAS_NOT_ACCEPTED, "CAS_NOT_ACCEPTED"); + SQGSIndustry.DefSQConst(engine, ScriptIndustry::CAS_ACCEPTED, "CAS_ACCEPTED"); + SQGSIndustry.DefSQConst(engine, ScriptIndustry::CAS_TEMP_REFUSED, "CAS_TEMP_REFUSED"); + + SQGSIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetIndustryCount, "GetIndustryCount", 1, "."); + SQGSIndustry.DefSQStaticMethod(engine, &ScriptIndustry::IsValidIndustry, "IsValidIndustry", 2, ".i"); + SQGSIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetIndustryID, "GetIndustryID", 2, ".i"); + SQGSIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetName, "GetName", 2, ".i"); + SQGSIndustry.DefSQStaticMethod(engine, &ScriptIndustry::IsCargoAccepted, "IsCargoAccepted", 3, ".ii"); + SQGSIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetStockpiledCargo, "GetStockpiledCargo", 3, ".ii"); + SQGSIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetLastMonthProduction, "GetLastMonthProduction", 3, ".ii"); + SQGSIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetLastMonthTransported, "GetLastMonthTransported", 3, ".ii"); + SQGSIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetLastMonthTransportedPercentage, "GetLastMonthTransportedPercentage", 3, ".ii"); + SQGSIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetLocation, "GetLocation", 2, ".i"); + SQGSIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetAmountOfStationsAround, "GetAmountOfStationsAround", 2, ".i"); + SQGSIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetDistanceManhattanToTile, "GetDistanceManhattanToTile", 3, ".ii"); + SQGSIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetDistanceSquareToTile, "GetDistanceSquareToTile", 3, ".ii"); + SQGSIndustry.DefSQStaticMethod(engine, &ScriptIndustry::IsBuiltOnWater, "IsBuiltOnWater", 2, ".i"); + SQGSIndustry.DefSQStaticMethod(engine, &ScriptIndustry::HasHeliport, "HasHeliport", 2, ".i"); + SQGSIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetHeliportLocation, "GetHeliportLocation", 2, ".i"); + SQGSIndustry.DefSQStaticMethod(engine, &ScriptIndustry::HasDock, "HasDock", 2, ".i"); + SQGSIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetDockLocation, "GetDockLocation", 2, ".i"); + SQGSIndustry.DefSQStaticMethod(engine, &ScriptIndustry::GetIndustryType, "GetIndustryType", 2, ".i"); + + SQGSIndustry.PostRegister(engine); +}
new file mode 100644 --- /dev/null +++ b/src/script/api/game/game_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 <http://www.gnu.org/licenses/>. + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_industrylist.hpp" +#include "../template/template_industrylist.hpp.sq" + + +template <> const char *GetClassName<ScriptIndustryList, ST_GS>() { return "GSIndustryList"; } + +void SQGSIndustryList_Register(Squirrel *engine) +{ + DefSQClass<ScriptIndustryList, ST_GS> SQGSIndustryList("GSIndustryList"); + SQGSIndustryList.PreRegister(engine, "GSList"); + SQGSIndustryList.AddConstructor<void (ScriptIndustryList::*)(), 1>(engine, "x"); + + SQGSIndustryList.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptIndustryList_CargoAccepting, ST_GS>() { return "GSIndustryList_CargoAccepting"; } + +void SQGSIndustryList_CargoAccepting_Register(Squirrel *engine) +{ + DefSQClass<ScriptIndustryList_CargoAccepting, ST_GS> SQGSIndustryList_CargoAccepting("GSIndustryList_CargoAccepting"); + SQGSIndustryList_CargoAccepting.PreRegister(engine, "GSList"); + SQGSIndustryList_CargoAccepting.AddConstructor<void (ScriptIndustryList_CargoAccepting::*)(CargoID cargo_id), 2>(engine, "xi"); + + SQGSIndustryList_CargoAccepting.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptIndustryList_CargoProducing, ST_GS>() { return "GSIndustryList_CargoProducing"; } + +void SQGSIndustryList_CargoProducing_Register(Squirrel *engine) +{ + DefSQClass<ScriptIndustryList_CargoProducing, ST_GS> SQGSIndustryList_CargoProducing("GSIndustryList_CargoProducing"); + SQGSIndustryList_CargoProducing.PreRegister(engine, "GSList"); + SQGSIndustryList_CargoProducing.AddConstructor<void (ScriptIndustryList_CargoProducing::*)(CargoID cargo_id), 2>(engine, "xi"); + + SQGSIndustryList_CargoProducing.PostRegister(engine); +}
new file mode 100644 --- /dev/null +++ b/src/script/api/game/game_industrytype.hpp.sq @@ -0,0 +1,41 @@ +/* $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 <http://www.gnu.org/licenses/>. + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_industrytype.hpp" +#include "../template/template_industrytype.hpp.sq" + + +template <> const char *GetClassName<ScriptIndustryType, ST_GS>() { return "GSIndustryType"; } + +void SQGSIndustryType_Register(Squirrel *engine) +{ + DefSQClass<ScriptIndustryType, ST_GS> SQGSIndustryType("GSIndustryType"); + SQGSIndustryType.PreRegister(engine); + SQGSIndustryType.AddConstructor<void (ScriptIndustryType::*)(), 1>(engine, "x"); + + SQGSIndustryType.DefSQConst(engine, ScriptIndustryType::INDUSTRYTYPE_UNKNOWN, "INDUSTRYTYPE_UNKNOWN"); + SQGSIndustryType.DefSQConst(engine, ScriptIndustryType::INDUSTRYTYPE_TOWN, "INDUSTRYTYPE_TOWN"); + + SQGSIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::IsValidIndustryType, "IsValidIndustryType", 2, ".i"); + SQGSIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::GetName, "GetName", 2, ".i"); + SQGSIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::GetProducedCargo, "GetProducedCargo", 2, ".i"); + SQGSIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::GetAcceptedCargo, "GetAcceptedCargo", 2, ".i"); + SQGSIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::IsRawIndustry, "IsRawIndustry", 2, ".i"); + SQGSIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::ProductionCanIncrease, "ProductionCanIncrease", 2, ".i"); + SQGSIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::GetConstructionCost, "GetConstructionCost", 2, ".i"); + SQGSIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::CanBuildIndustry, "CanBuildIndustry", 2, ".i"); + SQGSIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::CanProspectIndustry, "CanProspectIndustry", 2, ".i"); + SQGSIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::IsBuiltOnWater, "IsBuiltOnWater", 2, ".i"); + SQGSIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::HasHeliport, "HasHeliport", 2, ".i"); + SQGSIndustryType.DefSQStaticMethod(engine, &ScriptIndustryType::HasDock, "HasDock", 2, ".i"); + + SQGSIndustryType.PostRegister(engine); +}
new file mode 100644 --- /dev/null +++ b/src/script/api/game/game_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 <http://www.gnu.org/licenses/>. + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_industrytypelist.hpp" +#include "../template/template_industrytypelist.hpp.sq" + + +template <> const char *GetClassName<ScriptIndustryTypeList, ST_GS>() { return "GSIndustryTypeList"; } + +void SQGSIndustryTypeList_Register(Squirrel *engine) +{ + DefSQClass<ScriptIndustryTypeList, ST_GS> SQGSIndustryTypeList("GSIndustryTypeList"); + SQGSIndustryTypeList.PreRegister(engine, "GSList"); + SQGSIndustryTypeList.AddConstructor<void (ScriptIndustryTypeList::*)(), 1>(engine, "x"); + + SQGSIndustryTypeList.PostRegister(engine); +}
new file mode 100644 --- /dev/null +++ b/src/script/api/game/game_infrastructure.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 <http://www.gnu.org/licenses/>. + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_infrastructure.hpp" +#include "../template/template_infrastructure.hpp.sq" + + +template <> const char *GetClassName<ScriptInfrastructure, ST_GS>() { return "GSInfrastructure"; } + +void SQGSInfrastructure_Register(Squirrel *engine) +{ + DefSQClass<ScriptInfrastructure, ST_GS> SQGSInfrastructure("GSInfrastructure"); + SQGSInfrastructure.PreRegister(engine); + SQGSInfrastructure.AddConstructor<void (ScriptInfrastructure::*)(), 1>(engine, "x"); + + SQGSInfrastructure.DefSQConst(engine, ScriptInfrastructure::INFRASTRUCTURE_RAIL, "INFRASTRUCTURE_RAIL"); + SQGSInfrastructure.DefSQConst(engine, ScriptInfrastructure::INFRASTRUCTURE_SIGNALS, "INFRASTRUCTURE_SIGNALS"); + SQGSInfrastructure.DefSQConst(engine, ScriptInfrastructure::INFRASTRUCTURE_ROAD, "INFRASTRUCTURE_ROAD"); + SQGSInfrastructure.DefSQConst(engine, ScriptInfrastructure::INFRASTRUCTURE_CANAL, "INFRASTRUCTURE_CANAL"); + SQGSInfrastructure.DefSQConst(engine, ScriptInfrastructure::INFRASTRUCTURE_STATION, "INFRASTRUCTURE_STATION"); + SQGSInfrastructure.DefSQConst(engine, ScriptInfrastructure::INFRASTRUCTURE_AIRPORT, "INFRASTRUCTURE_AIRPORT"); + + SQGSInfrastructure.DefSQStaticMethod(engine, &ScriptInfrastructure::GetRailPieceCount, "GetRailPieceCount", 3, ".ii"); + SQGSInfrastructure.DefSQStaticMethod(engine, &ScriptInfrastructure::GetRoadPieceCount, "GetRoadPieceCount", 3, ".ii"); + SQGSInfrastructure.DefSQStaticMethod(engine, &ScriptInfrastructure::GetInfrastructurePieceCount, "GetInfrastructurePieceCount", 3, ".ii"); + SQGSInfrastructure.DefSQStaticMethod(engine, &ScriptInfrastructure::GetMonthlyRailCosts, "GetMonthlyRailCosts", 3, ".ii"); + SQGSInfrastructure.DefSQStaticMethod(engine, &ScriptInfrastructure::GetMonthlyRoadCosts, "GetMonthlyRoadCosts", 3, ".ii"); + SQGSInfrastructure.DefSQStaticMethod(engine, &ScriptInfrastructure::GetMonthlyInfrastructureCosts, "GetMonthlyInfrastructureCosts", 3, ".ii"); + + SQGSInfrastructure.PostRegister(engine); +}
new file mode 100644 --- /dev/null +++ b/src/script/api/game/game_map.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 <http://www.gnu.org/licenses/>. + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_map.hpp" +#include "../template/template_map.hpp.sq" + + +template <> const char *GetClassName<ScriptMap, ST_GS>() { return "GSMap"; } + +void SQGSMap_Register(Squirrel *engine) +{ + DefSQClass<ScriptMap, ST_GS> SQGSMap("GSMap"); + SQGSMap.PreRegister(engine); + SQGSMap.AddConstructor<void (ScriptMap::*)(), 1>(engine, "x"); + + SQGSMap.DefSQConst(engine, ScriptMap::TILE_INVALID, "TILE_INVALID"); + + SQGSMap.DefSQStaticMethod(engine, &ScriptMap::IsValidTile, "IsValidTile", 2, ".i"); + SQGSMap.DefSQStaticMethod(engine, &ScriptMap::GetMapSize, "GetMapSize", 1, "."); + SQGSMap.DefSQStaticMethod(engine, &ScriptMap::GetMapSizeX, "GetMapSizeX", 1, "."); + SQGSMap.DefSQStaticMethod(engine, &ScriptMap::GetMapSizeY, "GetMapSizeY", 1, "."); + SQGSMap.DefSQStaticMethod(engine, &ScriptMap::GetTileX, "GetTileX", 2, ".i"); + SQGSMap.DefSQStaticMethod(engine, &ScriptMap::GetTileY, "GetTileY", 2, ".i"); + SQGSMap.DefSQStaticMethod(engine, &ScriptMap::GetTileIndex, "GetTileIndex", 3, ".ii"); + SQGSMap.DefSQStaticMethod(engine, &ScriptMap::DistanceManhattan, "DistanceManhattan", 3, ".ii"); + SQGSMap.DefSQStaticMethod(engine, &ScriptMap::DistanceMax, "DistanceMax", 3, ".ii"); + SQGSMap.DefSQStaticMethod(engine, &ScriptMap::DistanceSquare, "DistanceSquare", 3, ".ii"); + SQGSMap.DefSQStaticMethod(engine, &ScriptMap::DistanceFromEdge, "DistanceFromEdge", 2, ".i"); + + SQGSMap.PostRegister(engine); +}
new file mode 100644 --- /dev/null +++ b/src/script/api/game/game_marine.hpp.sq @@ -0,0 +1,43 @@ +/* $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 <http://www.gnu.org/licenses/>. + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_marine.hpp" +#include "../template/template_marine.hpp.sq" + + +template <> const char *GetClassName<ScriptMarine, ST_GS>() { return "GSMarine"; } + +void SQGSMarine_Register(Squirrel *engine) +{ + DefSQClass<ScriptMarine, ST_GS> SQGSMarine("GSMarine"); + SQGSMarine.PreRegister(engine); + SQGSMarine.AddConstructor<void (ScriptMarine::*)(), 1>(engine, "x"); + + SQGSMarine.DefSQConst(engine, ScriptMarine::ERR_MARINE_BASE, "ERR_MARINE_BASE"); + SQGSMarine.DefSQConst(engine, ScriptMarine::ERR_MARINE_MUST_BE_BUILT_ON_WATER, "ERR_MARINE_MUST_BE_BUILT_ON_WATER"); + SQGSMarine.DefSQConst(engine, ScriptMarine::BT_DOCK, "BT_DOCK"); + SQGSMarine.DefSQConst(engine, ScriptMarine::BT_DEPOT, "BT_DEPOT"); + SQGSMarine.DefSQConst(engine, ScriptMarine::BT_BUOY, "BT_BUOY"); + + ScriptError::RegisterErrorMap(STR_ERROR_MUST_BE_BUILT_ON_WATER, ScriptMarine::ERR_MARINE_MUST_BE_BUILT_ON_WATER); + + ScriptError::RegisterErrorMapString(ScriptMarine::ERR_MARINE_MUST_BE_BUILT_ON_WATER, "ERR_MARINE_MUST_BE_BUILT_ON_WATER"); + + SQGSMarine.DefSQStaticMethod(engine, &ScriptMarine::IsWaterDepotTile, "IsWaterDepotTile", 2, ".i"); + SQGSMarine.DefSQStaticMethod(engine, &ScriptMarine::IsDockTile, "IsDockTile", 2, ".i"); + SQGSMarine.DefSQStaticMethod(engine, &ScriptMarine::IsBuoyTile, "IsBuoyTile", 2, ".i"); + SQGSMarine.DefSQStaticMethod(engine, &ScriptMarine::IsLockTile, "IsLockTile", 2, ".i"); + SQGSMarine.DefSQStaticMethod(engine, &ScriptMarine::IsCanalTile, "IsCanalTile", 2, ".i"); + SQGSMarine.DefSQStaticMethod(engine, &ScriptMarine::AreWaterTilesConnected, "AreWaterTilesConnected", 3, ".ii"); + SQGSMarine.DefSQStaticMethod(engine, &ScriptMarine::GetBuildCost, "GetBuildCost", 2, ".i"); + + SQGSMarine.PostRegister(engine); +}
new file mode 100644 --- /dev/null +++ b/src/script/api/game/game_road.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 <http://www.gnu.org/licenses/>. + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_road.hpp" +#include "../template/template_road.hpp.sq" + + +template <> const char *GetClassName<ScriptRoad, ST_GS>() { return "GSRoad"; } + +void SQGSRoad_Register(Squirrel *engine) +{ + DefSQClass<ScriptRoad, ST_GS> SQGSRoad("GSRoad"); + SQGSRoad.PreRegister(engine); + SQGSRoad.AddConstructor<void (ScriptRoad::*)(), 1>(engine, "x"); + + SQGSRoad.DefSQConst(engine, ScriptRoad::ERR_ROAD_BASE, "ERR_ROAD_BASE"); + SQGSRoad.DefSQConst(engine, ScriptRoad::ERR_ROAD_WORKS_IN_PROGRESS, "ERR_ROAD_WORKS_IN_PROGRESS"); + SQGSRoad.DefSQConst(engine, ScriptRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION, "ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION"); + SQGSRoad.DefSQConst(engine, ScriptRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD, "ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD"); + SQGSRoad.DefSQConst(engine, ScriptRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS, "ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS"); + SQGSRoad.DefSQConst(engine, ScriptRoad::ROADTYPE_ROAD, "ROADTYPE_ROAD"); + SQGSRoad.DefSQConst(engine, ScriptRoad::ROADTYPE_TRAM, "ROADTYPE_TRAM"); + SQGSRoad.DefSQConst(engine, ScriptRoad::ROADTYPE_INVALID, "ROADTYPE_INVALID"); + SQGSRoad.DefSQConst(engine, ScriptRoad::ROADVEHTYPE_BUS, "ROADVEHTYPE_BUS"); + SQGSRoad.DefSQConst(engine, ScriptRoad::ROADVEHTYPE_TRUCK, "ROADVEHTYPE_TRUCK"); + SQGSRoad.DefSQConst(engine, ScriptRoad::BT_ROAD, "BT_ROAD"); + SQGSRoad.DefSQConst(engine, ScriptRoad::BT_DEPOT, "BT_DEPOT"); + SQGSRoad.DefSQConst(engine, ScriptRoad::BT_BUS_STOP, "BT_BUS_STOP"); + SQGSRoad.DefSQConst(engine, ScriptRoad::BT_TRUCK_STOP, "BT_TRUCK_STOP"); + + ScriptError::RegisterErrorMap(STR_ERROR_ROAD_WORKS_IN_PROGRESS, ScriptRoad::ERR_ROAD_WORKS_IN_PROGRESS); + ScriptError::RegisterErrorMap(STR_ERROR_DRIVE_THROUGH_DIRECTION, ScriptRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION); + ScriptError::RegisterErrorMap(STR_ERROR_DRIVE_THROUGH_ON_TOWN_ROAD, ScriptRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD); + ScriptError::RegisterErrorMap(STR_ERROR_ONEWAY_ROADS_CAN_T_HAVE_JUNCTION, ScriptRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS); + + ScriptError::RegisterErrorMapString(ScriptRoad::ERR_ROAD_WORKS_IN_PROGRESS, "ERR_ROAD_WORKS_IN_PROGRESS"); + ScriptError::RegisterErrorMapString(ScriptRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION, "ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION"); + ScriptError::RegisterErrorMapString(ScriptRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD, "ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD"); + ScriptError::RegisterErrorMapString(ScriptRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS, "ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS"); + + SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::GetRoadVehicleTypeForCargo, "GetRoadVehicleTypeForCargo", 2, ".i"); + SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::IsRoadTile, "IsRoadTile", 2, ".i"); + SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::IsRoadDepotTile, "IsRoadDepotTile", 2, ".i"); + SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::IsRoadStationTile, "IsRoadStationTile", 2, ".i"); + SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::IsDriveThroughRoadStationTile, "IsDriveThroughRoadStationTile", 2, ".i"); + SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::GetCurrentRoadType, "GetCurrentRoadType", 1, "."); + SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::SetCurrentRoadType, "SetCurrentRoadType", 2, ".i"); + SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::HasRoadType, "HasRoadType", 3, ".ii"); + SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::AreRoadTilesConnected, "AreRoadTilesConnected", 3, ".ii"); + SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::GetNeighbourRoadCount, "GetNeighbourRoadCount", 2, ".i"); + SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::GetRoadDepotFrontTile, "GetRoadDepotFrontTile", 2, ".i"); + SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::GetRoadStationFrontTile, "GetRoadStationFrontTile", 2, ".i"); + SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::GetDriveThroughBackTile, "GetDriveThroughBackTile", 2, ".i"); + SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::GetBuildCost, "GetBuildCost", 3, ".ii"); + SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::GetMaintenanceCostFactor, "GetMaintenanceCostFactor", 2, ".i"); + + SQGSRoad.PostRegister(engine); +}
new file mode 100644 --- /dev/null +++ b/src/script/api/game/game_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 <http://www.gnu.org/licenses/>. + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_signlist.hpp" +#include "../template/template_signlist.hpp.sq" + + +template <> const char *GetClassName<ScriptSignList, ST_GS>() { return "GSSignList"; } + +void SQGSSignList_Register(Squirrel *engine) +{ + DefSQClass<ScriptSignList, ST_GS> SQGSSignList("GSSignList"); + SQGSSignList.PreRegister(engine, "GSList"); + SQGSSignList.AddConstructor<void (ScriptSignList::*)(), 1>(engine, "x"); + + SQGSSignList.PostRegister(engine); +}
new file mode 100644 --- /dev/null +++ b/src/script/api/game/game_tile.hpp.sq @@ -0,0 +1,109 @@ +/* $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 <http://www.gnu.org/licenses/>. + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_tile.hpp" +#include "../template/template_tile.hpp.sq" + + +template <> const char *GetClassName<ScriptTile, ST_GS>() { return "GSTile"; } + +void SQGSTile_Register(Squirrel *engine) +{ + DefSQClass<ScriptTile, ST_GS> SQGSTile("GSTile"); + SQGSTile.PreRegister(engine); + SQGSTile.AddConstructor<void (ScriptTile::*)(), 1>(engine, "x"); + + SQGSTile.DefSQConst(engine, ScriptTile::ERR_TILE_BASE, "ERR_TILE_BASE"); + SQGSTile.DefSQConst(engine, ScriptTile::ERR_TILE_TOO_HIGH, "ERR_TILE_TOO_HIGH"); + SQGSTile.DefSQConst(engine, ScriptTile::ERR_TILE_TOO_LOW, "ERR_TILE_TOO_LOW"); + SQGSTile.DefSQConst(engine, ScriptTile::ERR_AREA_ALREADY_FLAT, "ERR_AREA_ALREADY_FLAT"); + SQGSTile.DefSQConst(engine, ScriptTile::ERR_EXCAVATION_WOULD_DAMAGE, "ERR_EXCAVATION_WOULD_DAMAGE"); + SQGSTile.DefSQConst(engine, ScriptTile::CORNER_W, "CORNER_W"); + SQGSTile.DefSQConst(engine, ScriptTile::CORNER_S, "CORNER_S"); + SQGSTile.DefSQConst(engine, ScriptTile::CORNER_E, "CORNER_E"); + SQGSTile.DefSQConst(engine, ScriptTile::CORNER_N, "CORNER_N"); + SQGSTile.DefSQConst(engine, ScriptTile::CORNER_INVALID, "CORNER_INVALID"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_FLAT, "SLOPE_FLAT"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_W, "SLOPE_W"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_S, "SLOPE_S"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_E, "SLOPE_E"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_N, "SLOPE_N"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_STEEP, "SLOPE_STEEP"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_NW, "SLOPE_NW"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_SW, "SLOPE_SW"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_SE, "SLOPE_SE"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_NE, "SLOPE_NE"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_EW, "SLOPE_EW"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_NS, "SLOPE_NS"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_ELEVATED, "SLOPE_ELEVATED"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_NWS, "SLOPE_NWS"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_WSE, "SLOPE_WSE"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_SEN, "SLOPE_SEN"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_ENW, "SLOPE_ENW"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_STEEP_W, "SLOPE_STEEP_W"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_STEEP_S, "SLOPE_STEEP_S"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_STEEP_E, "SLOPE_STEEP_E"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_STEEP_N, "SLOPE_STEEP_N"); + SQGSTile.DefSQConst(engine, ScriptTile::SLOPE_INVALID, "SLOPE_INVALID"); + SQGSTile.DefSQConst(engine, ScriptTile::TRANSPORT_RAIL, "TRANSPORT_RAIL"); + SQGSTile.DefSQConst(engine, ScriptTile::TRANSPORT_ROAD, "TRANSPORT_ROAD"); + SQGSTile.DefSQConst(engine, ScriptTile::TRANSPORT_WATER, "TRANSPORT_WATER"); + SQGSTile.DefSQConst(engine, ScriptTile::TRANSPORT_AIR, "TRANSPORT_AIR"); + SQGSTile.DefSQConst(engine, ScriptTile::TRANSPORT_INVALID, "TRANSPORT_INVALID"); + SQGSTile.DefSQConst(engine, ScriptTile::BT_FOUNDATION, "BT_FOUNDATION"); + SQGSTile.DefSQConst(engine, ScriptTile::BT_TERRAFORM, "BT_TERRAFORM"); + SQGSTile.DefSQConst(engine, ScriptTile::BT_BUILD_TREES, "BT_BUILD_TREES"); + SQGSTile.DefSQConst(engine, ScriptTile::BT_CLEAR_GRASS, "BT_CLEAR_GRASS"); + SQGSTile.DefSQConst(engine, ScriptTile::BT_CLEAR_ROUGH, "BT_CLEAR_ROUGH"); + SQGSTile.DefSQConst(engine, ScriptTile::BT_CLEAR_ROCKY, "BT_CLEAR_ROCKY"); + SQGSTile.DefSQConst(engine, ScriptTile::BT_CLEAR_FIELDS, "BT_CLEAR_FIELDS"); + SQGSTile.DefSQConst(engine, ScriptTile::BT_CLEAR_HOUSE, "BT_CLEAR_HOUSE"); + + ScriptError::RegisterErrorMap(STR_ERROR_ALREADY_AT_SEA_LEVEL, ScriptTile::ERR_TILE_TOO_HIGH); + ScriptError::RegisterErrorMap(STR_ERROR_ALREADY_AT_SEA_LEVEL, ScriptTile::ERR_TILE_TOO_LOW); + ScriptError::RegisterErrorMap(STR_ERROR_ALREADY_LEVELLED, ScriptTile::ERR_AREA_ALREADY_FLAT); + ScriptError::RegisterErrorMap(STR_ERROR_EXCAVATION_WOULD_DAMAGE, ScriptTile::ERR_EXCAVATION_WOULD_DAMAGE); + + ScriptError::RegisterErrorMapString(ScriptTile::ERR_TILE_TOO_HIGH, "ERR_TILE_TOO_HIGH"); + ScriptError::RegisterErrorMapString(ScriptTile::ERR_TILE_TOO_LOW, "ERR_TILE_TOO_LOW"); + ScriptError::RegisterErrorMapString(ScriptTile::ERR_AREA_ALREADY_FLAT, "ERR_AREA_ALREADY_FLAT"); + ScriptError::RegisterErrorMapString(ScriptTile::ERR_EXCAVATION_WOULD_DAMAGE, "ERR_EXCAVATION_WOULD_DAMAGE"); + + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::IsBuildableRectangle, "IsBuildableRectangle", 4, ".iii"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::IsWaterTile, "IsWaterTile", 2, ".i"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::IsCoastTile, "IsCoastTile", 2, ".i"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::IsStationTile, "IsStationTile", 2, ".i"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::IsSteepSlope, "IsSteepSlope", 2, ".i"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::IsHalftileSlope, "IsHalftileSlope", 2, ".i"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::HasTreeOnTile, "HasTreeOnTile", 2, ".i"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::IsFarmTile, "IsFarmTile", 2, ".i"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::IsRockTile, "IsRockTile", 2, ".i"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::IsRoughTile, "IsRoughTile", 2, ".i"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::IsSnowTile, "IsSnowTile", 2, ".i"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::IsDesertTile, "IsDesertTile", 2, ".i"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::GetSlope, "GetSlope", 2, ".i"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::GetComplementSlope, "GetComplementSlope", 2, ".i"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::GetMinHeight, "GetMinHeight", 2, ".i"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::GetMaxHeight, "GetMaxHeight", 2, ".i"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::GetCornerHeight, "GetCornerHeight", 3, ".ii"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::GetOwner, "GetOwner", 2, ".i"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::HasTransportType, "HasTransportType", 3, ".ii"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::GetCargoAcceptance, "GetCargoAcceptance", 6, ".iiiii"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::GetCargoProduction, "GetCargoProduction", 6, ".iiiii"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::GetDistanceManhattanToTile, "GetDistanceManhattanToTile", 3, ".ii"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::GetDistanceSquareToTile, "GetDistanceSquareToTile", 3, ".ii"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::IsWithinTownInfluence, "IsWithinTownInfluence", 3, ".ii"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::GetTownAuthority, "GetTownAuthority", 2, ".i"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::GetClosestTown, "GetClosestTown", 2, ".i"); + SQGSTile.DefSQStaticMethod(engine, &ScriptTile::GetBuildCost, "GetBuildCost", 2, ".i"); + + SQGSTile.PostRegister(engine); +}
new file mode 100644 --- /dev/null +++ b/src/script/api/game/game_town.hpp.sq @@ -0,0 +1,63 @@ +/* $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 <http://www.gnu.org/licenses/>. + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_town.hpp" +#include "../template/template_town.hpp.sq" + + +template <> const char *GetClassName<ScriptTown, ST_GS>() { return "GSTown"; } + +void SQGSTown_Register(Squirrel *engine) +{ + DefSQClass<ScriptTown, ST_GS> SQGSTown("GSTown"); + SQGSTown.PreRegister(engine); + SQGSTown.AddConstructor<void (ScriptTown::*)(), 1>(engine, "x"); + + SQGSTown.DefSQConst(engine, ScriptTown::TOWN_RATING_NONE, "TOWN_RATING_NONE"); + SQGSTown.DefSQConst(engine, ScriptTown::TOWN_RATING_APPALLING, "TOWN_RATING_APPALLING"); + SQGSTown.DefSQConst(engine, ScriptTown::TOWN_RATING_VERY_POOR, "TOWN_RATING_VERY_POOR"); + SQGSTown.DefSQConst(engine, ScriptTown::TOWN_RATING_POOR, "TOWN_RATING_POOR"); + SQGSTown.DefSQConst(engine, ScriptTown::TOWN_RATING_MEDIOCRE, "TOWN_RATING_MEDIOCRE"); + SQGSTown.DefSQConst(engine, ScriptTown::TOWN_RATING_GOOD, "TOWN_RATING_GOOD"); + SQGSTown.DefSQConst(engine, ScriptTown::TOWN_RATING_VERY_GOOD, "TOWN_RATING_VERY_GOOD"); + SQGSTown.DefSQConst(engine, ScriptTown::TOWN_RATING_EXCELLENT, "TOWN_RATING_EXCELLENT"); + SQGSTown.DefSQConst(engine, ScriptTown::TOWN_RATING_OUTSTANDING, "TOWN_RATING_OUTSTANDING"); + SQGSTown.DefSQConst(engine, ScriptTown::TOWN_RATING_INVALID, "TOWN_RATING_INVALID"); + SQGSTown.DefSQConst(engine, ScriptTown::ROAD_LAYOUT_ORIGINAL, "ROAD_LAYOUT_ORIGINAL"); + SQGSTown.DefSQConst(engine, ScriptTown::ROAD_LAYOUT_BETTER_ROADS, "ROAD_LAYOUT_BETTER_ROADS"); + SQGSTown.DefSQConst(engine, ScriptTown::ROAD_LAYOUT_2x2, "ROAD_LAYOUT_2x2"); + SQGSTown.DefSQConst(engine, ScriptTown::ROAD_LAYOUT_3x3, "ROAD_LAYOUT_3x3"); + SQGSTown.DefSQConst(engine, ScriptTown::ROAD_LAYOUT_INVALID, "ROAD_LAYOUT_INVALID"); + + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetTownCount, "GetTownCount", 1, "."); + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::IsValidTown, "IsValidTown", 2, ".i"); + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetName, "GetName", 2, ".i"); + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetPopulation, "GetPopulation", 2, ".i"); + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetHouseCount, "GetHouseCount", 2, ".i"); + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetLocation, "GetLocation", 2, ".i"); + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetLastMonthProduction, "GetLastMonthProduction", 3, ".ii"); + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetLastMonthSupplied, "GetLastMonthSupplied", 3, ".ii"); + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetLastMonthTransportedPercentage, "GetLastMonthTransportedPercentage", 3, ".ii"); + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetLastMonthReceived, "GetLastMonthReceived", 3, ".ii"); + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetCargoGoal, "GetCargoGoal", 3, ".ii"); + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetGrowthRate, "GetGrowthRate", 2, ".i"); + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetDistanceManhattanToTile, "GetDistanceManhattanToTile", 3, ".ii"); + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetDistanceSquareToTile, "GetDistanceSquareToTile", 3, ".ii"); + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::IsWithinTownInfluence, "IsWithinTownInfluence", 3, ".ii"); + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::IsCity, "IsCity", 2, ".i"); + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetRoadReworkDuration, "GetRoadReworkDuration", 2, ".i"); + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetExclusiveRightsDuration, "GetExclusiveRightsDuration", 2, ".i"); + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetRating, "GetRating", 3, ".ii"); + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetAllowedNoise, "GetAllowedNoise", 2, ".i"); + SQGSTown.DefSQStaticMethod(engine, &ScriptTown::GetRoadLayout, "GetRoadLayout", 2, ".i"); + + SQGSTown.PostRegister(engine); +}
new file mode 100644 --- /dev/null +++ b/src/script/api/game/game_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 <http://www.gnu.org/licenses/>. + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_townlist.hpp" +#include "../template/template_townlist.hpp.sq" + + +template <> const char *GetClassName<ScriptTownList, ST_GS>() { return "GSTownList"; } + +void SQGSTownList_Register(Squirrel *engine) +{ + DefSQClass<ScriptTownList, ST_GS> SQGSTownList("GSTownList"); + SQGSTownList.PreRegister(engine, "GSList"); + SQGSTownList.AddConstructor<void (ScriptTownList::*)(), 1>(engine, "x"); + + SQGSTownList.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptTownEffectList, ST_GS>() { return "GSTownEffectList"; } + +void SQGSTownEffectList_Register(Squirrel *engine) +{ + DefSQClass<ScriptTownEffectList, ST_GS> SQGSTownEffectList("GSTownEffectList"); + SQGSTownEffectList.PreRegister(engine, "GSList"); + SQGSTownEffectList.AddConstructor<void (ScriptTownEffectList::*)(), 1>(engine, "x"); + + SQGSTownEffectList.PostRegister(engine); +}
new file mode 100644 --- /dev/null +++ b/src/script/api/game/game_vehicle.hpp.sq @@ -0,0 +1,134 @@ +/* $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 <http://www.gnu.org/licenses/>. + */ + +/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */ + +#include "../script_vehicle.hpp" +#include "../template/template_vehicle.hpp.sq" + + +template <> const char *GetClassName<ScriptVehicle, ST_GS>() { return "GSVehicle"; } + +void SQGSVehicle_Register(Squirrel *engine) +{ + DefSQClass<ScriptVehicle, ST_GS> SQGSVehicle("GSVehicle"); + SQGSVehicle.PreRegister(engine); + SQGSVehicle.AddConstructor<void (ScriptVehicle::*)(), 1>(engine, "x"); + + SQGSVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_BASE, "ERR_VEHICLE_BASE"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_TOO_MANY, "ERR_VEHICLE_TOO_MANY"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_NOT_AVAILABLE, "ERR_VEHICLE_NOT_AVAILABLE"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_BUILD_DISABLED, "ERR_VEHICLE_BUILD_DISABLED"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_WRONG_DEPOT, "ERR_VEHICLE_WRONG_DEPOT"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT, "ERR_VEHICLE_CANNOT_SEND_TO_DEPOT"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_CANNOT_START_STOP, "ERR_VEHICLE_CANNOT_START_STOP"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_CANNOT_TURN, "ERR_VEHICLE_CANNOT_TURN"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_CANNOT_REFIT, "ERR_VEHICLE_CANNOT_REFIT"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_IS_DESTROYED, "ERR_VEHICLE_IS_DESTROYED"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT, "ERR_VEHICLE_NOT_IN_DEPOT"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_IN_FLIGHT, "ERR_VEHICLE_IN_FLIGHT"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_NO_POWER, "ERR_VEHICLE_NO_POWER"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::ERR_VEHICLE_TOO_LONG, "ERR_VEHICLE_TOO_LONG"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::VT_RAIL, "VT_RAIL"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::VT_ROAD, "VT_ROAD"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::VT_WATER, "VT_WATER"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::VT_AIR, "VT_AIR"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::VT_INVALID, "VT_INVALID"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::VS_RUNNING, "VS_RUNNING"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::VS_STOPPED, "VS_STOPPED"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::VS_IN_DEPOT, "VS_IN_DEPOT"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::VS_AT_STATION, "VS_AT_STATION"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::VS_BROKEN, "VS_BROKEN"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::VS_CRASHED, "VS_CRASHED"); + SQGSVehicle.DefSQConst(engine, ScriptVehicle::VS_INVALID, "VS_INVALID"); + + SQGSVehicle.DefSQConst(engine, ScriptVehicle::VEHICLE_INVALID, "VEHICLE_INVALID"); + + ScriptError::RegisterErrorMap(STR_ERROR_TOO_MANY_VEHICLES_IN_GAME, ScriptVehicle::ERR_VEHICLE_TOO_MANY); + ScriptError::RegisterErrorMap(STR_ERROR_AIRCRAFT_NOT_AVAILABLE, ScriptVehicle::ERR_VEHICLE_NOT_AVAILABLE); + ScriptError::RegisterErrorMap(STR_ERROR_ROAD_VEHICLE_NOT_AVAILABLE, ScriptVehicle::ERR_VEHICLE_NOT_AVAILABLE); + ScriptError::RegisterErrorMap(STR_ERROR_SHIP_NOT_AVAILABLE, ScriptVehicle::ERR_VEHICLE_NOT_AVAILABLE); + ScriptError::RegisterErrorMap(STR_ERROR_RAIL_VEHICLE_NOT_AVAILABLE, ScriptVehicle::ERR_VEHICLE_NOT_AVAILABLE); + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_BUY_TRAIN, ScriptVehicle::ERR_VEHICLE_BUILD_DISABLED); + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_BUY_ROAD_VEHICLE, ScriptVehicle::ERR_VEHICLE_BUILD_DISABLED); + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_BUY_SHIP, ScriptVehicle::ERR_VEHICLE_BUILD_DISABLED); + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_BUY_AIRCRAFT, ScriptVehicle::ERR_VEHICLE_BUILD_DISABLED); + ScriptError::RegisterErrorMap(STR_ERROR_DEPOT_WRONG_DEPOT_TYPE, ScriptVehicle::ERR_VEHICLE_WRONG_DEPOT); + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_SEND_TRAIN_TO_DEPOT, ScriptVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT); + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_SEND_ROAD_VEHICLE_TO_DEPOT, ScriptVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT); + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_SEND_SHIP_TO_DEPOT, ScriptVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT); + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_SEND_AIRCRAFT_TO_HANGAR, ScriptVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT); + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_STOP_START_TRAIN, ScriptVehicle::ERR_VEHICLE_CANNOT_START_STOP); + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_STOP_START_ROAD_VEHICLE, ScriptVehicle::ERR_VEHICLE_CANNOT_START_STOP); + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_STOP_START_SHIP, ScriptVehicle::ERR_VEHICLE_CANNOT_START_STOP); + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_STOP_START_AIRCRAFT, ScriptVehicle::ERR_VEHICLE_CANNOT_START_STOP); + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_MAKE_ROAD_VEHICLE_TURN, ScriptVehicle::ERR_VEHICLE_CANNOT_TURN); + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_REVERSE_DIRECTION_TRAIN, ScriptVehicle::ERR_VEHICLE_CANNOT_TURN); + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_REVERSE_DIRECTION_RAIL_VEHICLE, ScriptVehicle::ERR_VEHICLE_CANNOT_TURN); + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_REVERSE_DIRECTION_RAIL_VEHICLE_MULTIPLE_UNITS, ScriptVehicle::ERR_VEHICLE_CANNOT_TURN); + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_REFIT_TRAIN, ScriptVehicle::ERR_VEHICLE_CANNOT_REFIT); + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_REFIT_ROAD_VEHICLE, ScriptVehicle::ERR_VEHICLE_CANNOT_REFIT); + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_REFIT_SHIP, ScriptVehicle::ERR_VEHICLE_CANNOT_REFIT); + ScriptError::RegisterErrorMap(STR_ERROR_CAN_T_REFIT_AIRCRAFT, ScriptVehicle::ERR_VEHICLE_CANNOT_REFIT); + ScriptError::RegisterErrorMap(STR_ERROR_VEHICLE_IS_DESTROYED, ScriptVehicle::ERR_VEHICLE_IS_DESTROYED); + ScriptError::RegisterErrorMap(STR_ERROR_AIRCRAFT_MUST_BE_STOPPED_INSIDE_HANGAR, ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT); + ScriptError::RegisterErrorMap(STR_ERROR_ROAD_VEHICLE_MUST_BE_STOPPED_INSIDE_DEPOT, ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT); + ScriptError::RegisterErrorMap(STR_ERROR_TRAIN_MUST_BE_STOPPED_INSIDE_DEPOT, ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT); + ScriptError::RegisterErrorMap(STR_ERROR_SHIP_MUST_BE_STOPPED_INSIDE_DEPOT, ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT); + ScriptError::RegisterErrorMap(STR_ERROR_AIRCRAFT_IS_IN_FLIGHT, ScriptVehicle::ERR_VEHICLE_IN_FLIGHT); + ScriptError::RegisterErrorMap(STR_ERROR_TRAIN_START_NO_POWER, ScriptVehicle::ERR_VEHICLE_NO_POWER); + ScriptError::RegisterErrorMap(STR_ERROR_TRAIN_TOO_LONG, ScriptVehicle::ERR_VEHICLE_TOO_LONG); + + ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_TOO_MANY, "ERR_VEHICLE_TOO_MANY"); + ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_NOT_AVAILABLE, "ERR_VEHICLE_NOT_AVAILABLE"); + ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_BUILD_DISABLED, "ERR_VEHICLE_BUILD_DISABLED"); + ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_WRONG_DEPOT, "ERR_VEHICLE_WRONG_DEPOT"); + ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT, "ERR_VEHICLE_CANNOT_SEND_TO_DEPOT"); + ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_CANNOT_START_STOP, "ERR_VEHICLE_CANNOT_START_STOP"); + ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_CANNOT_TURN, "ERR_VEHICLE_CANNOT_TURN"); + ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_CANNOT_REFIT, "ERR_VEHICLE_CANNOT_REFIT"); + ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_IS_DESTROYED, "ERR_VEHICLE_IS_DESTROYED"); + ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT, "ERR_VEHICLE_NOT_IN_DEPOT"); + ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_IN_FLIGHT, "ERR_VEHICLE_IN_FLIGHT"); + ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_NO_POWER, "ERR_VEHICLE_NO_POWER"); + ScriptError::RegisterErrorMapString(ScriptVehicle::ERR_VEHICLE_TOO_LONG, "ERR_VEHICLE_TOO_LONG"); + + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::IsValidVehicle, "IsValidVehicle", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetNumWagons, "GetNumWagons", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetName, "GetName", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetLocation, "GetLocation", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetEngineType, "GetEngineType", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetWagonEngineType, "GetWagonEngineType", 3, ".ii"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetUnitNumber, "GetUnitNumber", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetAge, "GetAge", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetWagonAge, "GetWagonAge", 3, ".ii"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetMaxAge, "GetMaxAge", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetAgeLeft, "GetAgeLeft", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetCurrentSpeed, "GetCurrentSpeed", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetState, "GetState", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetRunningCost, "GetRunningCost", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetProfitThisYear, "GetProfitThisYear", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetProfitLastYear, "GetProfitLastYear", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetCurrentValue, "GetCurrentValue", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetVehicleType, "GetVehicleType", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetRoadType, "GetRoadType", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::IsInDepot, "IsInDepot", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::IsStoppedInDepot, "IsStoppedInDepot", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetRefitCapacity, "GetRefitCapacity", 3, ".ii"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetCapacity, "GetCapacity", 3, ".ii"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetLength, "GetLength", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetCargoLoad, "GetCargoLoad", 3, ".ii"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetGroupID, "GetGroupID", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::IsArticulated, "IsArticulated", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::HasSharedOrders, "HasSharedOrders", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetReliability, "GetReliability", 2, ".i"); + SQGSVehicle.DefSQStaticMethod(engine, &ScriptVehicle::GetMaximumOrderDistance, "GetMaximumOrderDistance", 2, ".i"); + + SQGSVehicle.PostRegister(engine); +}
--- a/src/script/api/script_airport.cpp +++ b/src/script/api/script_airport.cpp @@ -94,7 +94,7 @@ if (!::IsTileType(tile, MP_STATION)) return -1; const Station *st = ::Station::GetByTile(tile); - if (st->owner != _current_company) return -1; + if (st->owner != _current_company && _current_company != OWNER_DEITY) return -1; if ((st->facilities & FACIL_AIRPORT) == 0) return -1; return st->airport.GetNumHangars(); @@ -107,7 +107,7 @@ if (GetNumHangars(tile) < 1) return INVALID_TILE; const Station *st = ::Station::GetByTile(tile); - if (st->owner != _current_company) return INVALID_TILE; + if (st->owner != _current_company && _current_company != OWNER_DEITY) return INVALID_TILE; if ((st->facilities & FACIL_AIRPORT) == 0) return INVALID_TILE; return st->airport.GetHangarTile(0);
--- a/src/script/api/script_airport.hpp +++ b/src/script/api/script_airport.hpp @@ -17,7 +17,7 @@ /** * Class that handles all airport related functions. - * @api ai + * @api ai game */ class ScriptAirport : public ScriptObject { public: @@ -150,6 +150,7 @@ * @exception ScriptStation::ERR_STATION_TOO_LARGE * @exception ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION * @return Whether the airport has been/can be build or not. + * @api -game */ static bool BuildAirport(TileIndex tile, AirportType type, StationID station_id); @@ -159,6 +160,7 @@ * @pre ScriptMap::IsValidTile(tile). * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY * @return Whether the airport has been/can be removed or not. + * @api -game */ static bool RemoveAirport(TileIndex tile);
--- a/src/script/api/script_base.hpp +++ b/src/script/api/script_base.hpp @@ -16,7 +16,7 @@ /** * Class that handles some basic functions. - * @api ai + * @api ai game * * @note The random functions are not called Random and RandomRange, because * RANDOM_DEBUG does some tricky stuff, which messes with those names.
--- a/src/script/api/script_cargo.hpp +++ b/src/script/api/script_cargo.hpp @@ -18,7 +18,7 @@ /** * Class that handles all cargo related functions. - * @api ai + * @api ai game */ class ScriptCargo : public ScriptObject { public:
--- a/src/script/api/script_company.hpp +++ b/src/script/api/script_company.hpp @@ -16,7 +16,7 @@ /** * Class that handles all company related functions. - * @api ai + * @api ai game */ class ScriptCompany : public ScriptObject { public: @@ -58,6 +58,7 @@ * Check if a CompanyID is your CompanyID, to ease up checks. * @param company The company index to check. * @return True if and only if this company is your CompanyID. + * @api -game */ static bool IsMine(CompanyID company); @@ -68,6 +69,7 @@ * @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(const char *name); @@ -85,6 +87,7 @@ * @pre 'name' must have at least one character. * @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE * @return True if the name was changed. + * @api -game */ static bool SetPresidentName(const char *name); @@ -102,6 +105,7 @@ * @pre GetPresidentGender(ScriptCompany.COMPANY_SELF) != gender. * @return True if the gender was changed. * @note When successful a random face will be created. + * @api -game */ static bool SetPresidentGender(Gender gender); @@ -120,6 +124,7 @@ * @pre 'loan' must be below GetMaxLoanAmount(). * @pre 'loan' - GetLoanAmount() + GetBankBalance() must be non-negative. * @return True if the loan could be set to your requested amount. + * @api -game */ static bool SetLoanAmount(int32 loan); @@ -129,6 +134,7 @@ * @pre 'loan' must be non-negative. * @pre 'loan' must be below GetMaxLoanAmount(). * @return True if we could allocate a minimum of 'loan' loan. + * @api -game */ static bool SetMinimumLoanAmount(int32 loan); @@ -222,6 +228,7 @@ * @return True if the HQ could be build. * @note An HQ can not be removed, only by water or rebuilding; If an HQ is * build again, the old one is removed. + * @api -game */ static bool BuildCompanyHQ(TileIndex tile); @@ -238,6 +245,7 @@ * Set whether autorenew is enabled for your company. * @param autorenew The new autorenew status. * @return True if autorenew status has been modified. + * @api -game */ static bool SetAutoRenewStatus(bool autorenew); @@ -253,6 +261,7 @@ * Set the number of months before/after max age to autorenew an engine for your company. * @param months The new months between autorenew. * @return True if autorenew months has been modified. + * @api -game */ static bool SetAutoRenewMonths(int16 months); @@ -268,6 +277,7 @@ * Set the minimum money needed to autorenew an engine for your company. * @param money The new minimum required money for autorenew to work. * @return True if autorenew money has been modified. + * @api -game */ static bool SetAutoRenewMoney(uint32 money);
--- a/src/script/api/script_date.hpp +++ b/src/script/api/script_date.hpp @@ -16,7 +16,7 @@ /** * Class that handles all date related (calculation) functions. - * @api ai + * @api ai game * * @note Months and days of month are 1-based; the first month of the * year is 1 and the first day of the month is also 1.
--- a/src/script/api/script_gamesettings.hpp +++ b/src/script/api/script_gamesettings.hpp @@ -16,7 +16,7 @@ /** * Class that handles all game settings related functions. - * @api ai + * @api ai game * * @note ScriptGameSettings::IsValid and ScriptGameSettings::GetValue are functions * that rely on the settings as OpenTTD stores them in savegame and @@ -65,6 +65,7 @@ * Checks whether the given vehicle-type is disabled for AIs. * @param vehicle_type The vehicle-type to check. * @return True if the vehicle-type is disabled. + * @api -game */ static bool IsDisabledVehicleType(ScriptVehicle::VehicleType vehicle_type); };
--- a/src/script/api/script_industry.hpp +++ b/src/script/api/script_industry.hpp @@ -16,7 +16,7 @@ /** * Class that handles all industry related functions. - * @api ai + * @api ai game */ class ScriptIndustry : public ScriptObject { public:
--- a/src/script/api/script_industrylist.hpp +++ b/src/script/api/script_industrylist.hpp @@ -16,7 +16,7 @@ /** * Creates a list of industries that are currently on the map. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptIndustryList : public ScriptList { @@ -26,7 +26,7 @@ /** * Creates a list of industries that accepts a given cargo. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptIndustryList_CargoAccepting : public ScriptList { @@ -40,7 +40,7 @@ /** * Creates a list of industries that can produce a given cargo. * @note It also contains industries that currently produces 0 units of the cargo. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptIndustryList_CargoProducing : public ScriptList {
--- a/src/script/api/script_industrytype.hpp +++ b/src/script/api/script_industrytype.hpp @@ -16,7 +16,7 @@ /** * Class that handles all industry-type related functions. - * @api ai + * @api ai game */ class ScriptIndustryType : public ScriptObject { public: @@ -112,6 +112,7 @@ * @param tile The tile to build the industry on. * @pre CanBuildIndustry(industry_type). * @return True if the industry was successfully build. + * @api -game */ static bool BuildIndustry(IndustryType industry_type, TileIndex tile); @@ -123,6 +124,7 @@ * @return True if no error occurred while trying to prospect. * @note Even if true is returned there is no guarantee a new industry is build. * @note If true is returned the money is paid, whether a new industry was build or not. + * @api -game */ static bool ProspectIndustry(IndustryType industry_type);
--- a/src/script/api/script_industrytypelist.hpp +++ b/src/script/api/script_industrytypelist.hpp @@ -16,7 +16,7 @@ /** * Creates a list of valid industry types. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptIndustryTypeList : public ScriptList {
--- a/src/script/api/script_infrastructure.hpp +++ b/src/script/api/script_infrastructure.hpp @@ -18,7 +18,7 @@ /** * Class that handles all company infrastructure related functions. - * @api ai + * @api ai game */ class ScriptInfrastructure : public ScriptObject { public:
--- a/src/script/api/script_map.hpp +++ b/src/script/api/script_map.hpp @@ -17,7 +17,7 @@ /** * Class that handles all map related functions. - * @api ai + * @api ai game */ class ScriptMap : public ScriptObject { public:
--- a/src/script/api/script_marine.hpp +++ b/src/script/api/script_marine.hpp @@ -16,7 +16,7 @@ /** * Class that handles all marine related functions. - * @api ai + * @api ai game */ class ScriptMarine : public ScriptObject { public: @@ -105,6 +105,7 @@ * @return Whether the water depot has been/can be build or not. * @note A WaterDepot is 1 tile in width, and 2 tiles in length. * @note The depot will be built towards the south from 'tile', not necessarily towards 'front'. + * @api -game */ static bool BuildWaterDepot(TileIndex tile, TileIndex front); @@ -119,6 +120,7 @@ * @exception ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION * @exception ScriptStation::ERR_STATION_TOO_MANY_STATIONS * @return Whether the dock has been/can be build or not. + * @api -game */ static bool BuildDock(TileIndex tile, StationID station_id); @@ -130,6 +132,7 @@ * @exception ScriptError::ERR_SITE_UNSUITABLE * @exception ScriptStation::ERR_STATION_TOO_MANY_STATIONS * @return Whether the buoy has been/can be build or not. + * @api -game */ static bool BuildBuoy(TileIndex tile); @@ -140,6 +143,7 @@ * @exception ScriptError::ERR_LAND_SLOPED_WRONG * @exception ScriptError::ERR_SITE_UNSUITABLE * @return Whether the lock has been/can be build or not. + * @api -game */ static bool BuildLock(TileIndex tile); @@ -152,6 +156,7 @@ * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY * @exception ScriptError::ERR_ALREADY_BUILT * @return Whether the canal has been/can be build or not. + * @api -game */ static bool BuildCanal(TileIndex tile); @@ -161,6 +166,7 @@ * @pre ScriptMap::IsValidTile(tile). * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY * @return Whether the water depot has been/can be removed or not. + * @api -game */ static bool RemoveWaterDepot(TileIndex tile); @@ -170,6 +176,7 @@ * @pre ScriptMap::IsValidTile(tile). * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY * @return Whether the dock has been/can be removed or not. + * @api -game */ static bool RemoveDock(TileIndex tile); @@ -179,6 +186,7 @@ * @pre ScriptMap::IsValidTile(tile). * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY * @return Whether the buoy has been/can be removed or not. + * @api -game */ static bool RemoveBuoy(TileIndex tile); @@ -188,6 +196,7 @@ * @pre ScriptMap::IsValidTile(tile). * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY * @return Whether the lock has been/can be removed or not. + * @api -game */ static bool RemoveLock(TileIndex tile); @@ -197,6 +206,7 @@ * @pre ScriptMap::IsValidTile(tile). * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY * @return Whether the canal has been/can be removed or not. + * @api -game */ static bool RemoveCanal(TileIndex tile);
--- a/src/script/api/script_road.hpp +++ b/src/script/api/script_road.hpp @@ -16,7 +16,7 @@ /** * Class that handles all road related functions. - * @api ai + * @api ai game */ class ScriptRoad : public ScriptObject { public: @@ -118,6 +118,7 @@ * Check if a given RoadType is available. * @param road_type The RoadType to check for. * @return True if this RoadType can be used. + * @api -game */ static bool IsRoadTypeAvailable(RoadType road_type); @@ -185,6 +186,7 @@ * @return 0 when the build parts do not connect, 1 when they do connect once * they are build or 2 when building the first part automatically * builds the second part. -1 means the preconditions are not met. + * @api -game */ static int32 CanBuildConnectedRoadParts(ScriptTile::Slope slope, struct Array *existing, TileIndex start, TileIndex end); @@ -206,6 +208,7 @@ * @return 0 when the build parts do not connect, 1 when they do connect once * they are build or 2 when building the first part automatically * builds the second part. -1 means the preconditions are not met. + * @api -game */ static int32 CanBuildConnectedRoadPartsHere(TileIndex tile, TileIndex start, TileIndex end); @@ -263,6 +266,7 @@ * @exception ScriptError::ERR_VEHICLE_IN_THE_WAY * @note Construction will fail if an obstacle is found between the start and end tiles. * @return Whether the road has been/can be build or not. + * @api -game */ static bool BuildRoad(TileIndex start, TileIndex end); @@ -290,6 +294,7 @@ * @exception ScriptError::ERR_VEHICLE_IN_THE_WAY * @note Construction will fail if an obstacle is found between the start and end tiles. * @return Whether the road has been/can be build or not. + * @api -game */ static bool BuildOneWayRoad(TileIndex start, TileIndex end); @@ -313,6 +318,7 @@ * @exception ScriptError::ERR_VEHICLE_IN_THE_WAY * @note Construction will fail if an obstacle is found between the start and end tiles. * @return Whether the road has been/can be build or not. + * @api -game */ static bool BuildRoadFull(TileIndex start, TileIndex end); @@ -341,6 +347,7 @@ * @exception ScriptError::ERR_VEHICLE_IN_THE_WAY * @note Construction will fail if an obstacle is found between the start and end tiles. * @return Whether the road has been/can be build or not. + * @api -game */ static bool BuildOneWayRoadFull(TileIndex start, TileIndex end); @@ -355,6 +362,7 @@ * @exception ScriptError::ERR_FLAT_LAND_REQUIRED * @exception ScriptError::ERR_AREA_NOT_CLEAR * @return Whether the road depot has been/can be build or not. + * @api -game */ static bool BuildRoadDepot(TileIndex tile, TileIndex front); @@ -379,6 +387,7 @@ * @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 BuildRoadStation(TileIndex tile, TileIndex front, RoadVehicleType road_veh_type, StationID station_id); @@ -403,6 +412,7 @@ * @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 BuildDriveThroughRoadStation(TileIndex tile, TileIndex front, RoadVehicleType road_veh_type, StationID station_id); @@ -420,6 +430,7 @@ * @exception ScriptError::ERR_VEHICLE_IN_THE_WAY * @exception ScriptRoad::ERR_ROAD_WORKS_IN_PROGRESS * @return Whether the road has been/can be removed or not. + * @api -game */ static bool RemoveRoad(TileIndex start, TileIndex end); @@ -438,6 +449,7 @@ * @exception ScriptError::ERR_VEHICLE_IN_THE_WAY * @exception ScriptRoad::ERR_ROAD_WORKS_IN_PROGRESS * @return Whether the road has been/can be removed or not. + * @api -game */ static bool RemoveRoadFull(TileIndex start, TileIndex end); @@ -449,6 +461,7 @@ * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY * @exception ScriptError::ERR_VEHICLE_IN_THE_WAY * @return Whether the road depot has been/can be removed or not. + * @api -game */ static bool RemoveRoadDepot(TileIndex tile); @@ -460,6 +473,7 @@ * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY * @exception ScriptError::ERR_VEHICLE_IN_THE_WAY * @return Whether the station has been/can be removed or not. + * @api -game */ static bool RemoveRoadStation(TileIndex tile);
--- a/src/script/api/script_signlist.hpp +++ b/src/script/api/script_signlist.hpp @@ -16,7 +16,7 @@ /** * Create a list of signs your company has created. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptSignList : public ScriptList {
--- a/src/script/api/script_tile.hpp +++ b/src/script/api/script_tile.hpp @@ -19,7 +19,7 @@ /** * Class that handles all tile related functions. - * @api ai + * @api ai game */ class ScriptTile : public ScriptObject { public: @@ -130,6 +130,7 @@ * as you can build tram-rails on road-tiles. * @note For rail you also might want to check for ScriptRoad::IsRoad(), * as in some cases you can build rails on road-tiles. + * @api -game */ static bool IsBuildable(TileIndex tile); @@ -376,6 +377,7 @@ * @exception ScriptError::ERR_TOO_CLOSE_TO_EDGE * @exception ScriptTile::ERR_TILE_TOO_HIGH * @return 0 means failed, 1 means success. + * @api -game */ static bool RaiseTile(TileIndex tile, int32 slope); @@ -392,6 +394,7 @@ * @exception ScriptError::ERR_TOO_CLOSE_TO_EDGE * @exception ScriptTile::ERR_TILE_TOO_LOW * @return 0 means failed, 1 means success. + * @api -game */ static bool LowerTile(TileIndex tile, int32 slope); @@ -410,6 +413,7 @@ * successfully leveled already. * @note This function may return true in ScriptTestMode, although it fails in * ScriptExecMode. + * @api -game */ static bool LevelTiles(TileIndex start_tile, TileIndex end_tile); @@ -419,6 +423,7 @@ * @pre ScriptMap::IsValidTile(tile). * @exception ScriptError::ERR_AREA_NOT_CLEAR * @return True if and only if the tile was demolished. + * @api -game */ static bool DemolishTile(TileIndex tile); @@ -427,6 +432,7 @@ * @param tile The tile to build a tree on. * @pre ScriptMap::IsValidTile(tile). * @return True if and only if a tree was added on the tile. + * @api -game */ static bool PlantTree(TileIndex tile); @@ -439,6 +445,7 @@ * @pre width >= 1 && width <= 20. * @pre height >= 1 && height <= 20. * @return True if and only if a tree was added on any of the tiles in the rectangle. + * @api -game */ static bool PlantTreeRectangle(TileIndex tile, uint width, uint height);
--- a/src/script/api/script_town.hpp +++ b/src/script/api/script_town.hpp @@ -18,12 +18,13 @@ /** * Class that handles all town related functions. - * @api ai + * @api ai game */ class ScriptTown : public ScriptObject { public: /** * Actions that one can perform on a town. + * @api -game */ enum TownAction { /* Note: these values represent part of the in-game order of the _town_action_proc array */ @@ -248,6 +249,7 @@ * @param town_id The town to check. * @pre IsValidTown(town_id). * @return True if the town has a statue. + * @api -game */ static bool HasStatue(TownID town_id); @@ -275,6 +277,7 @@ * @return The company that has the exclusive rights. The value * ScriptCompany::COMPANY_INVALID means that there are currently no * exclusive rights given out to anyone. + * @api -game */ static ScriptCompany::CompanyID GetExclusiveRightsCompany(TownID town_id); @@ -294,6 +297,7 @@ * @param town_action The action to perform on the town. * @pre IsValidTown(town_id). * @return True if and only if the action can performed. + * @api -game */ static bool IsActionAvailable(TownID town_id, TownAction town_action); @@ -304,6 +308,7 @@ * @pre IsValidTown(town_id). * @pre IsActionAvailable(town_id, town_action). * @return True if the action succeeded. + * @api -game */ static bool PerformTownAction(TownID town_id, TownAction town_action);
--- a/src/script/api/script_townlist.hpp +++ b/src/script/api/script_townlist.hpp @@ -16,7 +16,7 @@ /** * Creates a list of towns that are currently on the map. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptTownList : public ScriptList { @@ -26,7 +26,7 @@ /** * Creates a list of all TownEffects known in the game. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptTownEffectList : public ScriptList {
--- a/src/script/api/script_vehicle.cpp +++ b/src/script/api/script_vehicle.cpp @@ -28,7 +28,7 @@ /* static */ bool ScriptVehicle::IsValidVehicle(VehicleID vehicle_id) { const Vehicle *v = ::Vehicle::GetIfValid(vehicle_id); - return v != NULL && v->owner == _current_company && (v->IsPrimaryVehicle() || (v->type == VEH_TRAIN && ::Train::From(v)->IsFreeWagon())); + return v != NULL && (v->owner == _current_company || _current_company == OWNER_DEITY) && (v->IsPrimaryVehicle() || (v->type == VEH_TRAIN && ::Train::From(v)->IsFreeWagon())); } /* static */ int32 ScriptVehicle::GetNumWagons(VehicleID vehicle_id)
--- a/src/script/api/script_vehicle.hpp +++ b/src/script/api/script_vehicle.hpp @@ -16,7 +16,7 @@ /** * Class that handles all vehicle related functions. - * @api ai + * @api ai game */ class ScriptVehicle : public ScriptObject { public: @@ -119,6 +119,7 @@ * @pre 'name' must have at most 30 characters. * @exception ScriptError::ERR_NAME_IS_NOT_UNIQUE * @return True if and only if the name was changed. + * @api -game */ static bool SetName(VehicleID vehicle_id, const char *name); @@ -307,6 +308,7 @@ * @note In Test Mode it means you can't assign orders yet to this vehicle, * as the vehicle isn't really built yet. Build it for real first before * assigning orders. + * @api -game */ static VehicleID BuildVehicle(TileIndex depot, EngineID engine_id); @@ -323,6 +325,7 @@ * @return The VehicleID of the new vehicle, or an invalid VehicleID when * it failed. Check the return value using IsValidVehicle. In test-mode * 0 is returned if it was successful; any other value indicates failure. + * @api -game */ static VehicleID CloneVehicle(TileIndex depot, VehicleID vehicle_id, bool share_orders); @@ -338,6 +341,7 @@ * @pre GetVehicleType(source_vehicle_id) == VT_RAIL. * @pre dest_vehicle_id == -1 || GetVehicleType(dest_vehicle_id) == VT_RAIL. * @return Whether or not moving the wagon succeeded. + * @api -game */ static bool MoveWagon(VehicleID source_vehicle_id, int source_wagon, int dest_vehicle_id, int dest_wagon); @@ -353,6 +357,7 @@ * @pre GetVehicleType(source_vehicle_id) == VT_RAIL. * @pre dest_vehicle_id == -1 || GetVehicleType(dest_vehicle_id) == VT_RAIL. * @return Whether or not moving the wagons succeeded. + * @api -game */ static bool MoveWagonChain(VehicleID source_vehicle_id, int source_wagon, int dest_vehicle_id, int dest_wagon); @@ -380,6 +385,7 @@ * @exception ScriptVehicle::ERR_VEHICLE_IS_DESTROYED * @exception ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT * @return True if and only if the refit succeeded. + * @api -game */ static bool RefitVehicle(VehicleID vehicle_id, CargoID cargo); @@ -392,6 +398,7 @@ * @exception ScriptVehicle::ERR_VEHICLE_IS_DESTROYED * @exception ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT * @return True if and only if the vehicle has been sold. + * @api -game */ static bool SellVehicle(VehicleID vehicle_id); @@ -406,6 +413,7 @@ * @exception ScriptVehicle::ERR_VEHICLE_IS_DESTROYED * @exception ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT * @return True if and only if the wagon has been sold. + * @api -game */ static bool SellWagon(VehicleID vehicle_id, int wagon); @@ -420,6 +428,7 @@ * @exception ScriptVehicle::ERR_VEHICLE_IS_DESTROYED * @exception ScriptVehicle::ERR_VEHICLE_NOT_IN_DEPOT * @return True if and only if the wagons have been sold. + * @api -game */ static bool SellWagonChain(VehicleID vehicle_id, int wagon); @@ -430,6 +439,7 @@ * @pre IsValidVehicle(vehicle_id). * @exception ScriptVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT * @return True if the current order was changed. + * @api -game */ static bool SendVehicleToDepot(VehicleID vehicle_id); @@ -440,6 +450,7 @@ * @pre IsValidVehicle(vehicle_id). * @exception ScriptVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT * @return True if the current order was changed. + * @api -game */ static bool SendVehicleToDepotForServicing(VehicleID vehicle_id); @@ -451,6 +462,7 @@ * @exception (For aircraft only): ScriptVehicle::ERR_VEHICLE_IN_FLIGHT * @exception (For trains only): ScriptVehicle::ERR_VEHICLE_NO_POWER * @return True if and only if the vehicle has been started or stopped. + * @api -game */ static bool StartStopVehicle(VehicleID vehicle_id); @@ -462,6 +474,7 @@ * @return True if and only if the vehicle has started to turn. * @note Vehicles cannot always be reversed. For example busses and trucks need to be running * and not be inside a depot. + * @api -game */ static bool ReverseVehicle(VehicleID vehicle_id);