OpenTTD Source  20240917-master-g9ab0a47812
ai_config.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * 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.
4  * 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.
5  * 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/>.
6  */
7 
10 #ifndef AI_CONFIG_HPP
11 #define AI_CONFIG_HPP
12 
13 #include "../script/script_config.hpp"
14 #include "../company_type.h"
15 
16 class AIConfig : public ScriptConfig {
17 public:
21  static AIConfig *GetConfig(CompanyID company, ScriptSettingSource source = SSS_DEFAULT);
22 
23  AIConfig() :
24  ScriptConfig()
25  {}
26 
27  AIConfig(const AIConfig *config) :
28  ScriptConfig(config)
29  {}
30 
31  class AIInfo *GetInfo() const;
32 
41  bool ResetInfo(bool force_exact_match);
42 
43 protected:
44  ScriptInfo *FindInfo(const std::string &name, int version, bool force_exact_match) override;
45 };
46 
47 #endif /* AI_CONFIG_HPP */
AIConfig
Definition: ai_config.hpp:16
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:18
ScriptConfig::SSS_DEFAULT
@ SSS_DEFAULT
Get the Script config from the current game mode.
Definition: script_config.hpp:94
AIConfig::GetConfig
static AIConfig * GetConfig(CompanyID company, ScriptSettingSource source=SSS_DEFAULT)
Get the config of a company.
Definition: ai_config.cpp:20
ScriptConfig::version
int version
Version of the Script.
Definition: script_config.hpp:174
AIConfig::FindInfo
ScriptInfo * FindInfo(const std::string &name, int version, bool force_exact_match) override
This function should call back to the Scanner in charge of this Config, to find the ScriptInfo belong...
Definition: ai_config.cpp:43
ScriptConfig
Script settings.
Definition: script_config.hpp:49
ScriptConfig::name
std::string name
Name of the Script.
Definition: script_config.hpp:173
AIInfo
All static information from an AI like name, version, etc.
Definition: ai_info.hpp:16
ScriptInfo
All static information from an Script like name, version, etc.
Definition: script_info.hpp:30
AIConfig::ResetInfo
bool ResetInfo(bool force_exact_match)
When ever the AI Scanner is reloaded, all infos become invalid.
Definition: ai_config.cpp:48
ScriptConfig::ScriptSettingSource
ScriptSettingSource
Where to get the config from, either default (depends on current game mode) or force either newgame o...
Definition: script_config.hpp:93