|
OpenTTD Source 20260218-master-g2123fca5ea
|
All static information from an AI like name, version, etc. More...
#include <ai_info.hpp>
Public Member Functions | |
| bool | CanLoadFromVersion (int version) const |
| Check if we can start this AI. | |
| bool | UseAsRandomAI () const |
| Use this AI as a random AI. | |
| const std::string & | GetAPIVersion () const |
| Get the API version this AI is written for. | |
| Public Member Functions inherited from ScriptInfo | |
| const std::string & | GetAuthor () const |
| Get the Author of the script. | |
| const std::string & | GetName () const |
| Get the Name of the script. | |
| const std::string & | GetShortName () const |
| Get the 4 character long short name of the script. | |
| const std::string & | GetDescription () const |
| Get the description of the script. | |
| int | GetVersion () const |
| Get the version of the script. | |
| const std::string & | GetDate () const |
| Get the last-modified date of the script. | |
| const std::string & | GetInstanceName () const |
| Get the name of the instance of the script to create. | |
| const std::string & | GetURL () const |
| Get the website for this script. | |
| const std::string & | GetMainScript () const |
| Get the filename of the main.nut script. | |
| const std::string & | GetTarFile () const |
| Get the filename of the tar the script is in. | |
| bool | CheckMethod (std::string_view name) const |
| Check if a given method exists. | |
| virtual class ScriptScanner * | GetScanner () |
| Get the scanner which has found this ScriptInfo. | |
| bool | GetSettings () |
| Get the settings of the Script. | |
| const ScriptConfigItemList * | GetConfigList () const |
| Get the config list for this Script. | |
| const ScriptConfigItem * | GetConfigItem (std::string_view name) const |
| Get the description of a certain Script config option. | |
| SQInteger | AddSetting (HSQUIRRELVM vm) |
| Set a setting. | |
| SQInteger | AddLabels (HSQUIRRELVM vm) |
| Add labels for a setting. | |
| int | GetSettingDefaultValue (const std::string &name) const |
| Get the default value for a setting. | |
| virtual bool | IsDeveloperOnly () const |
| Can this script be selected by developers only? | |
Static Public Member Functions | |
| static void | RegisterAPI (Squirrel &engine) |
| Register the functions of this class. | |
| static SQInteger | Constructor (HSQUIRRELVM vm) |
| Create an AI, using this AIInfo as start-template. | |
| static SQInteger | DummyConstructor (HSQUIRRELVM vm) |
| Create a dummy-AI. | |
| Static Public Member Functions inherited from ScriptInfo | |
| static SQInteger | Constructor (HSQUIRRELVM vm, ScriptInfo &info) |
| Process the creation of a FileInfo object. | |
Static Public Attributes | |
| static constexpr std::string_view | ApiVersions [] { "0.7", "1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "1.10", "1.11", "12", "13", "14", "15", "16" } |
| All valid AI API versions, in order. | |
Private Attributes | |
| int | min_loadable_version |
| The AI can load savegame data if the version is equal or greater than this. | |
| bool | use_as_random |
| Should this AI be used when the user wants a "random AI"? | |
| std::string | api_version |
| API version used by this AI. | |
Additional Inherited Members | |
| Protected Attributes inherited from ScriptInfo | |
| class Squirrel * | engine = nullptr |
| Engine used to register for Squirrel. | |
| HSQOBJECT | SQ_instance {} |
| The Squirrel instance created for this info. | |
| ScriptConfigItemList | config_list {} |
| List of settings from this Script. | |
All static information from an AI like name, version, etc.
Definition at line 16 of file ai_info.hpp.
| AIInfo::AIInfo | ( | ) |
Definition at line 116 of file ai_info.cpp.
| bool AIInfo::CanLoadFromVersion | ( | int | version | ) | const |
Check if we can start this AI.
| version | The version to check. |
true if this script can load the data from that version. Definition at line 122 of file ai_info.cpp.
References ScriptInfo::GetVersion(), min_loadable_version, and ScriptInfo::version.
Referenced by AIScannerInfo::FindInfo().
|
static |
Create an AI, using this AIInfo as start-template.
| vm | The virtual machine to push the instance to. |
Definition at line 58 of file ai_info.cpp.
References api_version, CheckAPIVersion(), ScriptInfo::Constructor(), ScriptInfo::engine, ScriptInfo::GetName(), ScriptInfo::GetScanner(), ScriptInfo::GetVersion(), MAX_GET_OPS, Squirrel::MethodExists(), min_loadable_version, ScriptScanner::RegisterScript(), ScriptInfo::SQ_instance, and use_as_random.
Referenced by RegisterAPI().
|
static |
Create a dummy-AI.
| vm | The virtual machine to push the instance to. |
Definition at line 98 of file ai_info.cpp.
References api_version, ApiVersions, ScriptInfo::Constructor(), ScriptInfo::GetScanner(), and AIScannerInfo::SetDummyAI().
Referenced by RegisterAPI().
|
inline |
Get the API version this AI is written for.
Definition at line 60 of file ai_info.hpp.
References api_version.
Referenced by AIInstance::Initialize().
|
static |
Register the functions of this class.
| engine | The engine to register to. |
Definition at line 33 of file ai_info.cpp.
References ScriptInfo::AddLabels(), ScriptInfo::AddSetting(), Boolean, Constructor(), DefSQClass< CL, ST >::DefSQAdvancedMethod(), Developer, DummyConstructor(), ScriptInfo::engine, and InGame.
Referenced by AIScannerInfo::RegisterAPI().
|
inline |
true when it can be used as random AI, false when the user must specifically request it. Definition at line 54 of file ai_info.hpp.
References use_as_random.
|
private |
API version used by this AI.
Definition at line 65 of file ai_info.hpp.
Referenced by Constructor(), DummyConstructor(), and GetAPIVersion().
|
staticconstexpr |
All valid AI API versions, in order.
Definition at line 19 of file ai_info.hpp.
Referenced by CheckAPIVersion(), DummyConstructor(), and AIInstance::RegisterAPI().
|
private |
The AI can load savegame data if the version is equal or greater than this.
Definition at line 63 of file ai_info.hpp.
Referenced by CanLoadFromVersion(), and Constructor().
|
private |
Should this AI be used when the user wants a "random AI"?
Definition at line 64 of file ai_info.hpp.
Referenced by Constructor(), and UseAsRandomAI().