diff options
Diffstat (limited to 'src')
52 files changed, 240 insertions, 57 deletions
diff --git a/src/ai/api/squirrel_export.awk b/src/ai/api/squirrel_export.awk index f3896ba5c..dcfd4f893 100644 --- a/src/ai/api/squirrel_export.awk +++ b/src/ai/api/squirrel_export.awk @@ -40,6 +40,39 @@ function dump_class_templates(name) } } +function dump_fileheader() +{ + # Break the Id tag, so SVN doesn't replace it + print "/* $I" "d$ */" + print "" + print "/*" + print " * This file is part of OpenTTD." + print " * 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." + print " * 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." + print " * 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/>." + print " */" + print "" + print "/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */" + print "" + print "#include \"../../script/api/" filename "\"" +} + +function reset_reader() +{ + enum_size = 0 + enum_value_size = 0 + enum_string_to_error_size = 0 + enum_error_to_string_size = 0 + struct_size = 0 + method_size = 0 + static_method_size = 0 + virtual_class = "false" + cls = "" + start_squirrel_define_on_next_line = "false" + cls_level = 0 + cls_in_api = "" +} + BEGIN { enum_size = 0 enum_value_size = 0 @@ -52,26 +85,35 @@ BEGIN { virtual_class = "false" super_cls = "" cls = "" + api_selected = "" + cls_in_api = "" start_squirrel_define_on_next_line = "false" + has_fileheader = "false" cls_level = 0 RS = "\r|\n" } /@file/ { - # Break it, so SVN doesn't replace it - print "/* $I" "d$ */" - print "" - print "/*" - print " * This file is part of OpenTTD." - print " * 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." - print " * 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." - print " * 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/>." - print " */" - print "" - print "/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */" - print "" - gsub("^" tolower(api) "_", "script_", $3) - print "#include \"../../script/api/" $3 "\"" + filename = $3 + gsub("^" tolower(api) "_", "script_", filename) +} + +/^([ ]*)\* @api/ { + # By default, classes are not selected + if (cls_level == 0) api_selected = "false" + + gsub("^([ ]*)", "", $0) + gsub("* @api ", "", $0) + + if ($0 == "none") { + api_selected = "false" + } else if ($0 == "-all") { + api_selected = "false" + } else if (match($0, "-" tolower(api))) { + api_selected = "false" + } else if (match($0, tolower(api))) { + api_selected = "true" + } } # Remove the old squirrel stuff @@ -84,10 +126,16 @@ BEGIN { # We only want to have public functions exported for now /^( *)class/ { if (cls_level == 0) { + if (api_selected == "") { + print "Class '"$2"' has no @api. It won't be published to any API." > "/dev/stderr" + api_selected = "false" + } public = "false" cls_param[0] = "" cls_param[1] = 1 cls_param[2] = "x" + cls_in_api = api_selected + api_selected = "" cls = $2 if (match($4, "public") || match($4, "protected") || match($4, "private")) { super_cls = $5 @@ -95,8 +143,13 @@ BEGIN { super_cls = $4 } } else if (cls_level == 1) { - struct_size++ - structs[struct_size] = cls "::" $2 + if (api_selected == "") api_selected = cls_in_api + + if (api_selected == "true") { + struct_size++ + structs[struct_size] = cls "::" $2 + } + api_selected = "" } cls_level++ next @@ -119,11 +172,6 @@ BEGIN { } { if (doxygen_skip == "true") next } -# Ignore functions that shouldn't be exported to squirrel -/^#ifndef EXPORT_SKIP/ { export_skip = "true"; next; } -/^#endif \/\* EXPORT_SKIP \*\// { export_skip = "false"; next; } -{ if (export_skip == "true") next } - # Ignore the comments /^#/ { next; } /\/\*.*\*\// { comment = "false"; next; } @@ -134,20 +182,42 @@ BEGIN { # We need to make specialized conversions for structs /^( *)struct/ { cls_level++ + + # Check if we want to publish this struct + if (api_selected == "") api_selected = cls_in_api + if (api_selected == "false") { + api_selected = "" + next + } + api_selected = "" + if (public == "false") next if (cls_level != 1) next + struct_size++ structs[struct_size] = cls "::" $2 + next } # We need to make specialized conversions for enums /^( *)enum/ { cls_level++ - if (public == "false") next; + + # Check if we want to publish this enum + if (api_selected == "") api_selected = cls_in_api + if (api_selected == "false") { + api_selected = "" + next + } + api_selected = "" + + if (public == "false") next + in_enum = "true" enum_size++ enums[enum_size] = cls "::" $2 + next } @@ -168,6 +238,16 @@ BEGIN { # Empty/white lines. When we may do the Squirrel export, do that export. /^([ ]*)$/ { if (start_squirrel_define_on_next_line == "false") next + + if (cls_in_api != "true") { + reset_reader() + next + } + if (has_fileheader == "false") { + dump_fileheader() + has_fileheader = "true" + } + spaces = " "; public = "false" namespace_opened = "false" @@ -310,17 +390,9 @@ BEGIN { print " SQ" api_cls ".PostRegister(engine);" print "}" - enum_size = 0 - enum_value_size = 0 - enum_string_to_error_size = 0 - enum_error_to_string_size = 0 - struct_size = 0 - method_size = 0 - static_method_size = 0 - virtual_class = "false" - cls = "" - start_squirrel_define_on_next_line = "false" - cls_level = 0 + reset_reader() + + next } # Skip non-public functions @@ -370,7 +442,13 @@ BEGIN { # Add a method to the list /^.*\(.*\).*$/ { if (cls_level != 1) next - if (match($0, "~")) next + if (match($0, "~")) { + if (api_selected != "") { + print "Destructor for '"cls"' has @api. Tag ignored." > "/dev/stderr" + api_selected = "" + } + next + } is_static = match($0, "static") if (match($0, "virtual")) { @@ -389,6 +467,10 @@ BEGIN { funcname = $2 if ($1 == cls && funcname == "") { + if (api_selected != "") { + print "Constructor for '"cls"' has @api. Tag ignored." > "/dev/stderr" + api_selected = "" + } cls_param[0] = param_s if (param_s == "") next } else if (funcname == "") next @@ -422,6 +504,14 @@ BEGIN { } } + # Check if we want to publish this function + if (api_selected == "") api_selected = cls_in_api + if (api_selected == "false") { + api_selected = "" + next + } + api_selected = "" + if ($1 == cls && funcname == "") { cls_param[1] = len; cls_param[2] = types; diff --git a/src/ai/api/squirrel_export.sh b/src/ai/api/squirrel_export.sh index 4cb66a7e2..891a522d7 100755 --- a/src/ai/api/squirrel_export.sh +++ b/src/ai/api/squirrel_export.sh @@ -26,13 +26,20 @@ apiuc=`echo ${apilc} | tr [a-z] [A-Z]` if [ -z "$1" ]; then for f in `ls ../../script/api/*.hpp`; do - bf=`basename $f | sed s/script/${apilc}/` - case "${bf}" in - # these files should not be changed by this script - "ai_controller.hpp" | "ai_object.hpp" | "ai_types.hpp" | "ai_changelog.hpp" | "ai_info_docs.hpp" ) continue; - esac + bf=`basename ${f} | sed s/script/${apilc}/` + + # ScriptController has custom code, and should not be generated + if [ "`basename ${f}`" = "script_controller.hpp" ]; then continue; fi + ${AWK} -v api=${apiuc} -f squirrel_export.awk ${f} > ${bf}.tmp - if ! [ -f "${bf}.sq" ] || [ -n "`diff -I '$Id' ${bf}.tmp ${bf}.sq 2> /dev/null || echo boo`" ]; then + + if [ "`wc -l ${bf}.tmp | cut -d\ -f1`" = "0" ]; then + if [ -f "${bf}.sq" ]; then + echo "Deleted: ${bf}.sq" + svn del --force ${bf}.sq > /dev/null 2>&1 + fi + rm -f ${bf}.tmp + elif ! [ -f "${bf}.sq" ] || [ -n "`diff -I '$Id' ${bf}.tmp ${bf}.sq 2> /dev/null || echo boo`" ]; then mv ${bf}.tmp ${bf}.sq echo "Updated: ${bf}.sq" svn add ${bf}.sq > /dev/null 2>&1 @@ -44,7 +51,13 @@ if [ -z "$1" ]; then done else ${AWK} -v api=${apiuc} -f squirrel_export.awk $1 > $1.tmp - if ! [ -f "${f}.sq" ] || [ -n "`diff -I '$Id' $1.sq $1.tmp 2> /dev/null || echo boo`" ]; then + if [ `wc -l $1.tmp | cut -d\ -f1` -eq "0" ]; then + if [ -f "$1.sq" ]; then + echo "Deleted: $1.sq" + svn del --force $1.sq > /dev/null 2>&1 + fi + rm -f $1.tmp + elif ! [ -f "${f}.sq" ] || [ -n "`diff -I '$Id' $1.sq $1.tmp 2> /dev/null || echo boo`" ]; then mv $1.tmp $1.sq echo "Updated: $1.sq" svn add $1.sq > /dev/null 2>&1 diff --git a/src/script/api/script_accounting.hpp b/src/script/api/script_accounting.hpp index dd4702052..f87d3749c 100644 --- a/src/script/api/script_accounting.hpp +++ b/src/script/api/script_accounting.hpp @@ -17,6 +17,7 @@ /** * Class that keeps track of the costs, so you can request how much a block of * commands did cost in total. Works in both Execute as in Test mode. + * @api ai * Example: * <pre> * { diff --git a/src/script/api/script_airport.hpp b/src/script/api/script_airport.hpp index 9121c33b2..d382e643b 100644 --- a/src/script/api/script_airport.hpp +++ b/src/script/api/script_airport.hpp @@ -16,6 +16,7 @@ /** * Class that handles all airport related functions. + * @api ai */ class ScriptAirport : public ScriptObject { public: diff --git a/src/script/api/script_base.hpp b/src/script/api/script_base.hpp index 9cffe74a7..4a963d08c 100644 --- a/src/script/api/script_base.hpp +++ b/src/script/api/script_base.hpp @@ -16,6 +16,7 @@ /** * Class that handles some basic functions. + * @api ai * * @note The random functions are not called Random and RandomRange, because * RANDOM_DEBUG does some tricky stuff, which messes with those names. diff --git a/src/script/api/script_basestation.hpp b/src/script/api/script_basestation.hpp index 8399067e3..b5d5e6f78 100644 --- a/src/script/api/script_basestation.hpp +++ b/src/script/api/script_basestation.hpp @@ -16,6 +16,7 @@ /** * Base class for stations and waypoints. + * @api ai */ class ScriptBaseStation : public ScriptObject { public: diff --git a/src/script/api/script_bridge.hpp b/src/script/api/script_bridge.hpp index b6d48f0e2..f18bebc41 100644 --- a/src/script/api/script_bridge.hpp +++ b/src/script/api/script_bridge.hpp @@ -16,6 +16,7 @@ /** * Class that handles all bridge related functions. + * @api ai */ class ScriptBridge : public ScriptObject { public: diff --git a/src/script/api/script_bridgelist.hpp b/src/script/api/script_bridgelist.hpp index 6bcdf8393..486974640 100644 --- a/src/script/api/script_bridgelist.hpp +++ b/src/script/api/script_bridgelist.hpp @@ -16,6 +16,7 @@ /** * Create a list of bridges. + * @api ai * @ingroup ScriptList */ class ScriptBridgeList : public ScriptList { @@ -25,6 +26,7 @@ public: /** * Create a list of bridges that can be built on a specific length. + * @api ai * @ingroup ScriptList */ class ScriptBridgeList_Length : public ScriptList { diff --git a/src/script/api/script_cargo.hpp b/src/script/api/script_cargo.hpp index 9379392b4..cd3fd8630 100644 --- a/src/script/api/script_cargo.hpp +++ b/src/script/api/script_cargo.hpp @@ -16,6 +16,7 @@ /** * Class that handles all cargo related functions. + * @api ai */ class ScriptCargo : public ScriptObject { public: diff --git a/src/script/api/script_cargolist.hpp b/src/script/api/script_cargolist.hpp index 964d46fca..ea82de139 100644 --- a/src/script/api/script_cargolist.hpp +++ b/src/script/api/script_cargolist.hpp @@ -16,6 +16,7 @@ /** * Creates a list of cargos that can be produced in the current game. + * @api ai * @ingroup ScriptList */ class ScriptCargoList : public ScriptList { @@ -27,6 +28,7 @@ public: * Creates a list of cargos that the given industry accepts. * @note This list also includes cargos that are temporarily not accepted * by this industry, @see ScriptIndustry::IsCargoAccepted. + * @api ai * @ingroup ScriptList */ class ScriptCargoList_IndustryAccepting : public ScriptList { @@ -39,6 +41,7 @@ public: /** * Creates a list of cargos that the given industry can produce. + * @api ai * @ingroup ScriptList */ class ScriptCargoList_IndustryProducing : public ScriptList { @@ -51,6 +54,7 @@ public: /** * Creates a list of cargos that the given station accepts. + * @api ai * @ingroup ScriptList */ class ScriptCargoList_StationAccepting : public ScriptList { diff --git a/src/script/api/script_company.hpp b/src/script/api/script_company.hpp index 4c35d7e9b..051d3126a 100644 --- a/src/script/api/script_company.hpp +++ b/src/script/api/script_company.hpp @@ -16,6 +16,7 @@ /** * Class that handles all company related functions. + * @api ai */ class ScriptCompany : public ScriptObject { public: diff --git a/src/script/api/script_controller.hpp b/src/script/api/script_controller.hpp index a027c903f..ab8bf8893 100644 --- a/src/script/api/script_controller.hpp +++ b/src/script/api/script_controller.hpp @@ -19,6 +19,7 @@ * The Controller, the class each Script should extend. It creates the Script, * makes sure the logic kicks in correctly, and that GetTick() has a valid * value. + * @api ai */ class ScriptController { friend class AIScanner; diff --git a/src/script/api/script_date.hpp b/src/script/api/script_date.hpp index b2cf326a9..67670e0ec 100644 --- a/src/script/api/script_date.hpp +++ b/src/script/api/script_date.hpp @@ -16,6 +16,7 @@ /** * Class that handles all date related (calculation) functions. + * @api ai * * @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. diff --git a/src/script/api/script_depotlist.hpp b/src/script/api/script_depotlist.hpp index 4067fc7e6..f24be369a 100644 --- a/src/script/api/script_depotlist.hpp +++ b/src/script/api/script_depotlist.hpp @@ -17,6 +17,7 @@ /** * Creates a list of the locations of the depots (and hangars) of which you are the owner. + * @api ai * @ingroup ScriptList */ class ScriptDepotList : public ScriptList { diff --git a/src/script/api/script_engine.hpp b/src/script/api/script_engine.hpp index b7bd9f700..e0d286939 100644 --- a/src/script/api/script_engine.hpp +++ b/src/script/api/script_engine.hpp @@ -18,6 +18,7 @@ /** * Class that handles all engine related functions. + * @api ai */ class ScriptEngine : public ScriptObject { public: diff --git a/src/script/api/script_enginelist.hpp b/src/script/api/script_enginelist.hpp index 5e9bb9941..78672c93e 100644 --- a/src/script/api/script_enginelist.hpp +++ b/src/script/api/script_enginelist.hpp @@ -17,6 +17,7 @@ /** * Create a list of engines based on a vehicle type. + * @api ai * @ingroup ScriptList */ class ScriptEngineList : public ScriptList { diff --git a/src/script/api/script_error.hpp b/src/script/api/script_error.hpp index cbc74005a..53c084fad 100644 --- a/src/script/api/script_error.hpp +++ b/src/script/api/script_error.hpp @@ -40,6 +40,7 @@ /** * Class that handles all error related functions. + * @api ai */ class ScriptError : public ScriptObject { public: @@ -142,10 +143,9 @@ public: */ static char *GetLastErrorString(); -#ifndef EXPORT_SKIP /** * Get the error based on the OpenTTD StringID. - * @note DO NOT INVOKE THIS METHOD YOURSELF! + * @api -all * @param internal_string_id The string to convert. * @return The NoAI equivalent error message. */ @@ -153,7 +153,7 @@ public: /** * Map an internal OpenTTD error message to its NoAI equivalent. - * @note DO NOT INVOKE THIS METHOD YOURSELF! The calls are autogenerated. + * @api -all * @param internal_string_id The OpenTTD StringID used for an error. * @param ai_error_msg The NoAI equivalent error message. */ @@ -161,12 +161,11 @@ public: /** * Map an internal OpenTTD error message to its NoAI equivalent. - * @note DO NOT INVOKE THIS METHOD YOURSELF! The calls are autogenerated. + * @api -all * @param ai_error_msg The NoAI error message representation. * @param message The string representation of this error message, used for debug purposes. */ static void RegisterErrorMapString(ScriptErrorType ai_error_msg, const char *message); -#endif /* EXPORT_SKIP */ private: typedef std::map<StringID, ScriptErrorType> ScriptErrorMap; ///< The type for mapping between error (internal OpenTTD) StringID to the AI error type. diff --git a/src/script/api/script_event.hpp b/src/script/api/script_event.hpp index eb15ded2e..ed7684943 100644 --- a/src/script/api/script_event.hpp +++ b/src/script/api/script_event.hpp @@ -18,6 +18,7 @@ * Class that handles all event related functions. * You can lookup the type, and than convert it to the real event-class. * That way you can request more detailed information about the event. + * @api ai */ class ScriptEvent : public ScriptObject { public: @@ -72,6 +73,7 @@ protected: /** * Class that handles all event related functions. + * @api ai * @note it is not needed to create an instance of ScriptEvent to access it, as * all members are static, and all data is stored AI-wide. */ @@ -89,20 +91,18 @@ public: */ static ScriptEvent *GetNextEvent(); -#ifndef EXPORT_SKIP /** * Insert an event to the queue for the company. * @param event The event to insert. - * @note DO NOT CALL YOURSELF; leave it to the internal AI programming. + * @api -all */ static void InsertEvent(ScriptEvent *event); /** * Free the event pointer. - * @note DO NOT CALL YOURSELF; leave it to the internal AI programming. + * @api -all */ static void FreeEventPointer(); -#endif /* EXPORT_SKIP */ private: /** diff --git a/src/script/api/script_event_types.hpp b/src/script/api/script_event_types.hpp index 163c9e54c..c3e4a87c0 100644 --- a/src/script/api/script_event_types.hpp +++ b/src/script/api/script_event_types.hpp @@ -18,6 +18,7 @@ /** * Event Vehicle Crash, indicating a vehicle of yours is crashed. * It contains the crash site, the crashed vehicle and the reason for the crash. + * @api ai */ class ScriptEventVehicleCrashed : public ScriptEvent { public: @@ -78,6 +79,7 @@ private: /** * Event Subsidy Offered, indicating someone offered a subsidy. + * @api ai */ class ScriptEventSubsidyOffer : public ScriptEvent { public: @@ -108,6 +110,7 @@ private: /** * Event Subsidy Offer Expired, indicating a subsidy will no longer be awarded. + * @api ai */ class ScriptEventSubsidyOfferExpired : public ScriptEvent { public: @@ -138,6 +141,7 @@ private: /** * Event Subidy Awarded, indicating a subsidy is awarded to some company. + * @api ai */ class ScriptEventSubsidyAwarded : public ScriptEvent { public: @@ -168,6 +172,7 @@ private: /** * Event Subsidy Expired, indicating a route that was once subsidized no longer is. + * @api ai */ class ScriptEventSubsidyExpired : public ScriptEvent { public: @@ -200,6 +205,7 @@ private: * Event Engine Preview, indicating a manufacturer offer you to test a new engine. * You can get the same information about the offered engine as a real user * would see in the offer window. And you can also accept the offer. + * @api ai */ class ScriptEventEnginePreview : public ScriptEvent { public: @@ -288,6 +294,7 @@ private: /** * Event Company New, indicating a new company has been created. + * @api ai */ class ScriptEventCompanyNew : public ScriptEvent { public: @@ -319,6 +326,7 @@ private: /** * Event Company In Trouble, indicating a company is in trouble and might go * bankrupt soon. + * @api ai */ class ScriptEventCompanyInTrouble : public ScriptEvent { public: @@ -349,6 +357,7 @@ private: /** * Event Company Ask Merger, indicating a company can be bought (cheaply) by you. + * @api ai */ class ScriptEventCompanyAskMerger : public ScriptEvent { public: @@ -396,6 +405,7 @@ private: /** * Event Company Merger, indicating a company has been bought by another * company. + * @api ai */ class ScriptEventCompanyMerger : public ScriptEvent { public: @@ -438,6 +448,7 @@ private: /** * Event Company Bankrupt, indicating a company has gone bankrupt. + * @api ai */ class ScriptEventCompanyBankrupt : public ScriptEvent { public: @@ -468,6 +479,7 @@ private: /** * Event Vehicle Lost, indicating a vehicle can't find its way to its destination. + * @api ai */ class ScriptEventVehicleLost : public ScriptEvent { public: @@ -498,6 +510,7 @@ private: /** * Event VehicleWaitingInDepot, indicating a vehicle has arrived a depot and is now waiting there. + * @api ai */ class ScriptEventVehicleWaitingInDepot : public ScriptEvent { public: @@ -528,6 +541,7 @@ private: /** * Event Vehicle Unprofitable, indicating a vehicle lost money last year. + * @api ai */ class ScriptEventVehicleUnprofitable : public ScriptEvent { public: @@ -558,6 +572,7 @@ private: /** * Event Industry Open, indicating a new industry has been created. + * @api ai */ class ScriptEventIndustryOpen : public ScriptEvent { public: @@ -588,6 +603,7 @@ private: /** * Event Industry Close, indicating an industry is going to be closed. + * @api ai */ class ScriptEventIndustryClose : public ScriptEvent { public: @@ -618,6 +634,7 @@ private: /** * Event Engine Available, indicating a new engine is available. + * @api ai */ class ScriptEventEngineAvailable : public ScriptEvent { public: @@ -648,6 +665,7 @@ private: /** * Event Station First Vehicle, indicating a station has been visited by a vehicle for the first time. + * @api ai */ class ScriptEventStationFirstVehicle : public ScriptEvent { public: @@ -687,6 +705,7 @@ private: /** * Event Disaster Zeppeliner Crashed, indicating a zeppeliner has crashed on an airport and is blocking the runway. + * @api ai */ class ScriptEventDisasterZeppelinerCrashed : public ScriptEvent { public: @@ -717,6 +736,7 @@ private: /** * Event Disaster Zeppeliner Cleared, indicating a previously crashed zeppeliner has been removed, and the airport is operating again. + * @api ai */ class ScriptEventDisasterZeppelinerCleared : public ScriptEvent { public: @@ -747,6 +767,7 @@ private: /** * Event Town Founded, indicating a new town has been created. + * @api ai */ class ScriptEventTownFounded : public ScriptEvent { public: diff --git a/src/script/api/script_execmode.hpp b/src/script/api/script_execmode.hpp index a3ce70d68..5fe5853af 100644 --- a/src/script/api/script_execmode.hpp +++ b/src/script/api/script_execmode.hpp @@ -20,6 +20,7 @@ * Execute. The original mode is stored and recovered from when ever the * instance is destroyed. * In Execute mode all commands you do are executed for real. + * @api ai */ class ScriptExecMode : public ScriptObject { private: diff --git a/src/script/api/script_gamesettings.hpp b/src/script/api/script_gamesettings.hpp index 8643df5de..4cf85c00f 100644 --- a/src/script/api/script_gamesettings.hpp +++ b/src/script/api/script_gamesettings.hpp @@ -16,6 +16,7 @@ /** * Class that handles all game settings related functions. + * @api ai * * @note ScriptGameSettings::IsValid and ScriptGameSettings::GetValue are functions * that rely on the settings as OpenTTD stores them in savegame and diff --git a/src/script/api/script_group.hpp b/src/script/api/script_group.hpp index 3eb3e06ca..8688ee328 100644 --- a/src/script/api/script_group.hpp +++ b/src/script/api/script_group.hpp @@ -16,6 +16,7 @@ /** * Class that handles all group related functions. + * @api ai */ class ScriptGroup : public ScriptObject { public: diff --git a/src/script/api/script_grouplist.hpp b/src/script/api/script_grouplist.hpp index 6ce66c16c..32e94d649 100644 --- a/src/script/api/script_grouplist.hpp +++ b/src/script/api/script_grouplist.hpp @@ -17,6 +17,7 @@ /** * Creates a list of groups of which you are the owner. * @note Neither ScriptGroup::GROUP_ALL nor ScriptGroup::GROUP_DEFAULT is in this list. + * @api ai * @ingroup ScriptList */ class ScriptGroupList : public ScriptList { diff --git a/src/script/api/script_industry.hpp b/src/script/api/script_industry.hpp index 747d29061..cd739c29e 100644 --- a/src/script/api/script_industry.hpp +++ b/src/script/api/script_industry.hpp @@ -16,6 +16,7 @@ /** * Class that handles all industry related functions. + * @api ai */ class ScriptIndustry : public ScriptObject { public: diff --git a/src/script/api/script_industrylist.hpp b/src/script/api/script_industrylist.hpp index f36d72d06..c88ffd7cf 100644 --- a/src/script/api/script_industrylist.hpp +++ b/src/script/api/script_industrylist.hpp @@ -16,6 +16,7 @@ /** * Creates a list of industries that are currently on the map. + * @api ai * @ingroup ScriptList */ class ScriptIndustryList : public ScriptList { @@ -25,6 +26,7 @@ public: /** * Creates a list of industries that accepts a given cargo. + * @api ai * @ingroup ScriptList */ class ScriptIndustryList_CargoAccepting : public ScriptList { @@ -38,6 +40,7 @@ public: /** * 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 * @ingroup ScriptList */ class ScriptIndustryList_CargoProducing : public ScriptList { diff --git a/src/script/api/script_industrytype.hpp b/src/script/api/script_industrytype.hpp index a8ee5aef3..185d0289c 100644 --- a/src/script/api/script_industrytype.hpp +++ b/src/script/api/script_industrytype.hpp @@ -16,6 +16,7 @@ /** * Class that handles all industry-type related functions. + * @api ai */ class ScriptIndustryType : public ScriptObject { public: diff --git a/src/script/api/script_industrytypelist.hpp b/src/script/api/script_industrytypelist.hpp index bc3676da1..8a64f838a 100644 --- a/src/script/api/script_industrytypelist.hpp +++ b/src/script/api/script_industrytypelist.hpp @@ -16,6 +16,7 @@ /** * Creates a list of valid industry types. + * @api ai * @ingroup ScriptList */ class ScriptIndustryTypeList : public ScriptList { diff --git a/src/script/api/script_list.hpp b/src/script/api/script_list.hpp index 75dc7ac69..c38315763 100644 --- a/src/script/api/script_list.hpp +++ b/src/script/api/script_list.hpp @@ -21,6 +21,7 @@ class ScriptListSorter; /** * Class that creates a list which can keep item/value pairs, which you can walk. + * @api ai */ class ScriptList : public ScriptObject { public: diff --git a/src/script/api/script_log.hpp b/src/script/api/script_log.hpp index ba5a5f025..a3a1cd9bf 100644 --- a/src/script/api/script_log.hpp +++ b/src/script/api/script_log.hpp @@ -16,6 +16,7 @@ /** * Class that handles all log related functions. + * @api ai */ class ScriptLog : public ScriptObject { /* ScriptController needs access to Enum and Log, in order to keep the flow from @@ -23,10 +24,10 @@ class ScriptLog : public ScriptObject { friend class ScriptController; public: -#ifndef EXPORT_SKIP /** * Log levels; The value is also feed to DEBUG() lvl. * This has no use for you, as AI writer. + * @api -all */ enum ScriptLogType { LOG_SQ_ERROR = 0, ///< Squirrel printed an error. @@ -39,6 +40,7 @@ public: /** * Internal representation of the log-data inside the AI. * This has no use for you, as AI writer. + * @api -all */ struct LogData { char **lines; ///< The log-lines. @@ -47,7 +49,6 @@ public: int pos; ///< Current position in lines. int used; ///< Total amount of used log-lines. }; -#endif /* EXPORT_SKIP */ /** * Print an Info message to the logs. @@ -67,13 +68,11 @@ public: */ static void Error(const char *message); -#ifndef EXPORT_SKIP /** * Free the log pointer. - * @note DO NOT CALL YOURSELF; leave it to the internal AI programming. + * @api -all */ static void FreeLogPointer(); -#endif /* EXPORT_SKIP */ private: /** diff --git a/src/script/api/script_map.hpp b/src/script/api/script_map.hpp index bb944952c..db91585e7 100644 --- a/src/script/api/script_map.hpp +++ b/src/script/api/script_map.hpp @@ -17,6 +17,7 @@ /** * Class that handles all map related functions. + * @api ai */ class ScriptMap : public ScriptObject { public: diff --git a/src/script/api/script_marine.hpp b/src/script/api/script_marine.hpp index 93776159b..97e1fd6d4 100644 --- a/src/script/api/script_marine.hpp +++ b/src/script/api/script_marine.hpp @@ -16,6 +16,7 @@ /** * Class that handles all marine related functions. + * @api ai */ class ScriptMarine : public ScriptObject { public: diff --git a/src/script/api/script_object.hpp b/src/script/api/script_object.hpp index 6e6e96d8b..d9ccd8fba 100644 --- a/src/script/api/script_object.hpp +++ b/src/script/api/script_object.hpp @@ -29,10 +29,10 @@ typedef bool (ScriptModeProc)(); * your script, as it doesn't publish any public functions. It is used * internally to have a common place to handle general things, like internal * command processing, and command-validation checks. + * @api none */ class ScriptObject : public SimpleCountedObject { friend class ScriptInstance; -#ifndef DOXYGEN_AI_DOCS protected: /** * A class that handles the current active instance. By instantiating it at @@ -239,7 +239,6 @@ private: * @param group_id The new GroupID. */ static void SetNewGroupID(GroupID group_id); -#endif /* DOXYGEN_AI_DOCS */ }; #endif /* SCRIPT_OBJECT_HPP */ diff --git a/src/script/api/script_order.hpp b/src/script/api/script_order.hpp index ca92d41fc..5cf08f74b 100644 --- a/src/script/api/script_order.hpp +++ b/src/script/api/script_order.hpp @@ -16,6 +16,7 @@ /** * Class that handles all order related functions. + * @api ai */ class ScriptOrder : public ScriptObject { public: diff --git a/src/script/api/script_rail.hpp b/src/script/api/script_rail.hpp index 0fac99a74..b7d7db923 100644 --- a/src/script/api/script_rail.hpp +++ b/src/script/api/script_rail.hpp @@ -16,6 +16,7 @@ /** * Class that handles all rail related functions. + * @api ai */ class ScriptRail : public ScriptObject { public: diff --git a/src/script/api/script_railtypelist.hpp b/src/script/api/script_railtypelist.hpp index 7a662e2fd..723f1452d 100644 --- a/src/script/api/script_railtypelist.hpp +++ b/src/script/api/script_railtypelist.hpp @@ -16,6 +16,7 @@ /** * Creates a list of all available railtypes. + * @api ai * @ingroup ScriptList */ class ScriptRailTypeList : public ScriptList { diff --git a/src/script/api/script_road.hpp b/src/script/api/script_road.hpp index 87a049929..1139adafb 100644 --- a/src/script/api/script_road.hpp +++ b/src/script/api/script_road.hpp @@ -16,6 +16,7 @@ /** * Class that handles all road related functions. + * @api ai */ class ScriptRoad : public ScriptObject { public: diff --git a/src/script/api/script_sign.hpp b/src/script/api/script_sign.hpp index 81ab35360..a4f2ba0b2 100644 --- a/src/script/api/script_sign.hpp +++ b/src/script/api/script_sign.hpp @@ -16,6 +16,7 @@ /** * Class that handles all sign related functions. + * @api ai */ class ScriptSign : public ScriptObject { public: diff --git a/src/script/api/script_signlist.hpp b/src/script/api/script_signlist.hpp index 5540e269d..7d9703629 100644 --- a/src/script/api/script_signlist.hpp +++ b/src/script/api/script_signlist.hpp @@ -16,6 +16,7 @@ /** * Create a list of signs your company has created. + * @api ai * @ingroup ScriptList */ class ScriptSignList : public ScriptList { diff --git a/src/script/api/script_station.hpp b/src/script/api/script_station.hpp index 0d013708a..29896681c 100644 --- a/src/script/api/script_station.hpp +++ b/src/script/api/script_station.hpp @@ -17,6 +17,7 @@ /** * Class that handles all station related functions. + * @api ai */ class ScriptStation : public ScriptBaseStation { public: diff --git a/src/script/api/script_stationlist.hpp b/src/script/api/script_stationlist.hpp index 84d509d2e..49269d29f 100644 --- a/src/script/api/script_stationlist.hpp +++ b/src/script/api/script_stationlist.hpp @@ -17,6 +17,7 @@ /** * Creates a list of stations of which you are the owner. + * @api ai * @ingroup ScriptList */ class ScriptStationList : public ScriptList { @@ -29,6 +30,7 @@ public: /** * Creates a list of stations which the vehicle has in its orders. + * @api ai * @ingroup ScriptList */ class ScriptStationList_Vehicle : public ScriptList { diff --git a/src/script/api/script_subsidy.hpp b/src/script/api/script_subsidy.hpp index f9b397774..674b0e14d 100644 --- a/src/script/api/script_subsidy.hpp +++ b/src/script/api/script_subsidy.hpp @@ -16,6 +16,7 @@ /** * Class that handles all subsidy related functions. + * @api ai */ class ScriptSubsidy : public ScriptObject { public: diff --git a/src/script/api/script_subsidylist.hpp b/src/script/api/script_subsidylist.hpp index 254446ca7..05342df2e 100644 --- a/src/script/api/script_subsidylist.hpp +++ b/src/script/api/script_subsidylist.hpp @@ -16,6 +16,7 @@ /** * Creates a list of all current subsidies. + * @api ai * @ingroup ScriptList */ class ScriptSubsidyList : public ScriptList { diff --git a/src/script/api/script_testmode.hpp b/src/script/api/script_testmode.hpp index a1b9e6bbf..a447ed814 100644 --- a/src/script/api/script_testmode.hpp +++ b/src/script/api/script_testmode.hpp @@ -22,6 +22,7 @@ * In Test mode all the commands you execute aren't really executed. The * system only checks if it would be able to execute your requests, and what * the cost would be. + * @api ai */ class ScriptTestMode : public ScriptObject { private: diff --git a/src/script/api/script_tile.hpp b/src/script/api/script_tile.hpp index 38ec6a55e..f1d40529a 100644 --- a/src/script/api/script_tile.hpp +++ b/src/script/api/script_tile.hpp @@ -17,6 +17,7 @@ /** * Class that handles all tile related functions. + * @api ai */ class ScriptTile : public ScriptObject { public: diff --git a/src/script/api/script_tilelist.hpp b/src/script/api/script_tilelist.hpp index e9daacc5d..990237c4f 100644 --- a/src/script/api/script_tilelist.hpp +++ b/src/script/api/script_tilelist.hpp @@ -17,6 +17,7 @@ /** * Creates an empty list, in which you can add tiles. + * @api ai * @ingroup ScriptList */ class ScriptTileList : public ScriptList { @@ -57,6 +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 * @ingroup ScriptList */ class ScriptTileList_IndustryAccepting : public ScriptTileList { @@ -73,6 +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 * @ingroup ScriptList */ class ScriptTileList_IndustryProducing : public ScriptTileList { @@ -89,6 +92,7 @@ public: /** * Creates a list of tiles which have the requested StationType of the * StationID. + * @api ai * @ingroup ScriptList */ class ScriptTileList_StationType : public ScriptTileList { diff --git a/src/script/api/script_town.hpp b/src/script/api/script_town.hpp index ceddacaca..83da1d796 100644 --- a/src/script/api/script_town.hpp +++ b/src/script/api/script_town.hpp @@ -17,6 +17,7 @@ /** * Class that handles all town related functions. + * @api ai */ class ScriptTown : public ScriptObject { public: diff --git a/src/script/api/script_townlist.hpp b/src/script/api/script_townlist.hpp index 4923df8de..f26e53401 100644 --- a/src/script/api/script_townlist.hpp +++ b/src/script/api/script_townlist.hpp @@ -16,6 +16,7 @@ /** * Creates a list of towns that are currently on the map. + * @api ai * @ingroup ScriptList */ class ScriptTownList : public ScriptList { @@ -25,6 +26,7 @@ public: /** * Creates a list of all TownEffects known in the game. + * @api ai * @ingroup ScriptList */ class ScriptTownEffectList : public ScriptList { diff --git a/src/script/api/script_tunnel.hpp b/src/script/api/script_tunnel.hpp index 3a6ec7b55..5ca9ee8b3 100644 --- a/src/script/api/script_tunnel.hpp +++ b/src/script/api/script_tunnel.hpp @@ -16,6 +16,7 @@ /** * Class that handles all tunnel related functions. + * @api ai */ class ScriptTunnel : public ScriptObject { public: diff --git a/src/script/api/script_vehicle.hpp b/src/script/api/script_vehicle.hpp index 168bac437..024192b4d 100644 --- a/src/script/api/script_vehicle.hpp +++ b/src/script/api/script_vehicle.hpp @@ -16,6 +16,7 @@ /** * Class that handles all vehicle related functions. + * @api ai */ class ScriptVehicle : public ScriptObject { public: diff --git a/src/script/api/script_vehiclelist.hpp b/src/script/api/script_vehiclelist.hpp index b4f0204ea..9ede0ec48 100644 --- a/src/script/api/script_vehiclelist.hpp +++ b/src/script/api/script_vehiclelist.hpp @@ -17,6 +17,7 @@ /** * Creates a list of vehicles of which you are the owner. + * @api ai * @ingroup ScriptList */ class ScriptVehicleList : public ScriptList { @@ -26,6 +27,7 @@ public: /** * Creates a list of vehicles that have orders to a given station. + * @api ai * @ingroup ScriptList */ class ScriptVehicleList_Station : public ScriptList { @@ -43,6 +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 * @ingroup ScriptList */ class ScriptVehicleList_Depot : public ScriptList { @@ -55,6 +58,7 @@ public: /** * Creates a list of vehicles that share orders. + * @api ai * @ingroup ScriptList */ class ScriptVehicleList_SharedOrders : public ScriptList { @@ -67,6 +71,7 @@ public: /** * Creates a list of vehicles that are in a group. + * @api ai * @ingroup ScriptList */ class ScriptVehicleList_Group : public ScriptList { @@ -79,6 +84,7 @@ public: /** * Creates a list of vehicles that are in the default group. + * @api ai * @ingroup ScriptList */ class ScriptVehicleList_DefaultGroup : public ScriptList { diff --git a/src/script/api/script_waypoint.hpp b/src/script/api/script_waypoint.hpp index e0224fa7b..645cc2daf 100644 --- a/src/script/api/script_waypoint.hpp +++ b/src/script/api/script_waypoint.hpp @@ -16,6 +16,7 @@ /** * Class that handles all waypoint related functions. + * @api ai */ class ScriptWaypoint : public ScriptBaseStation { public: diff --git a/src/script/api/script_waypointlist.hpp b/src/script/api/script_waypointlist.hpp index 8670879cb..18afbb8c8 100644 --- a/src/script/api/script_waypointlist.hpp +++ b/src/script/api/script_waypointlist.hpp @@ -17,6 +17,7 @@ /** * Creates a list of waypoints of which you are the owner. + * @api ai * @ingroup ScriptList */ class ScriptWaypointList : public ScriptList { @@ -29,6 +30,7 @@ public: /** * Creates a list of waypoints which the vehicle has in its orders. + * @api ai * @ingroup ScriptList */ class ScriptWaypointList_Vehicle : public ScriptList { |