OpenTTD Source  12.0-beta2
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 
29  class AIInfo *GetInfo() const;
30 
31  int GetSetting(const char *name) const override;
32  void SetSetting(const char *name, int value) override;
33  void AddRandomDeviation() override;
34 
43  bool ResetInfo(bool force_exact_match);
44 
45 protected:
46  void PushExtraConfigList() override;
47  void ClearConfigList() override;
48  ScriptInfo *FindInfo(const char *name, int version, bool force_exact_match) override;
49 };
50 
51 #endif /* AI_CONFIG_HPP */
AIConfig
Definition: ai_config.hpp:16
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:18
AIConfig::AddRandomDeviation
void AddRandomDeviation() override
Randomize all settings the Script requested to be randomized.
Definition: ai_config.cpp:129
AIConfig::ClearConfigList
void ClearConfigList() override
Routine that clears the config list.
Definition: ai_config.cpp:78
AIConfig::PushExtraConfigList
void PushExtraConfigList() override
In case you have mandatory non-Script-definable config entries in your list, add them to this functio...
Definition: ai_config.cpp:73
ScriptConfig::SSS_DEFAULT
@ SSS_DEFAULT
Get the Script config from the current game mode.
Definition: script_config.hpp:103
AIConfig::GetConfig
static AIConfig * GetConfig(CompanyID company, ScriptSettingSource source=SSS_DEFAULT)
Get the config of a company.
Definition: ai_config.cpp:45
ScriptConfig::version
int version
Version of the Script.
Definition: script_config.hpp:190
AIConfig::FindInfo
ScriptInfo * FindInfo(const char *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:62
AIConfig::SetSetting
void SetSetting(const char *name, int value) override
Set the value of a setting for this config.
Definition: ai_config.cpp:110
ScriptConfig
Script settings.
Definition: script_config.hpp:55
AIInfo
All static information from an AI like name, version, etc.
Definition: ai_info.hpp:16
ScriptConfig::name
const char * name
Name of the Script.
Definition: script_config.hpp:189
ScriptInfo
All static information from an Script like name, version, etc.
Definition: script_info.hpp:30
AIConfig::GetSetting
int GetSetting(const char *name) const override
Get the value of a setting for this config.
Definition: ai_config.cpp:89
AIConfig::ResetInfo
bool ResetInfo(bool force_exact_match)
When ever the AI Scanner is reloaded, all infos become invalid.
Definition: ai_config.cpp:67
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:102