OpenTTD
ai_config.hpp
Go to the documentation of this file.
1 /* $Id$ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * 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.
6  * 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.
7  * 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/>.
8  */
9 
12 #ifndef AI_CONFIG_HPP
13 #define AI_CONFIG_HPP
14 
15 #include "../script/script_config.hpp"
16 #include "../company_type.h"
17 
18 class AIConfig : public ScriptConfig {
19 public:
23  static AIConfig *GetConfig(CompanyID company, ScriptSettingSource source = SSS_DEFAULT);
24 
25  AIConfig() :
26  ScriptConfig()
27  {}
28 
29  AIConfig(const AIConfig *config);
30 
31  class AIInfo *GetInfo() const;
32 
33  /* virtual */ int GetSetting(const char *name) const;
34  /* virtual */ void SetSetting(const char *name, int value);
35 
44  bool ResetInfo(bool force_exact_match);
45 
46 protected:
47  /* virtual */ void PushExtraConfigList();
48  /* virtual */ void ClearConfigList();
49  /* virtual */ ScriptInfo *FindInfo(const char *name, int version, bool force_exact_match);
50 };
51 
52 #endif /* AI_CONFIG_HPP */
Script settings.
Get the Script config from the current game mode.
bool ResetInfo(bool force_exact_match)
When ever the AI Scanner is reloaded, all infos become invalid.
Definition: ai_config.cpp:69
void ClearConfigList()
Routine that clears the config list.
Definition: ai_config.cpp:80
int GetSetting(const char *name) const
Get the value of a setting for this config.
Definition: ai_config.cpp:91
void SetSetting(const char *name, int value)
Set the value of a setting for this config.
Definition: ai_config.cpp:112
All static information from an Script like name, version, etc.
Definition: script_info.hpp:32
ScriptSettingSource
Where to get the config from, either default (depends on current game mode) or force either newgame o...
static AIConfig * GetConfig(CompanyID company, ScriptSettingSource source=SSS_DEFAULT)
Get the config of a company.
Definition: ai_config.cpp:47
ScriptInfo * FindInfo(const char *name, int version, bool force_exact_match)
This function should call back to the Scanner in charge of this Config, to find the ScriptInfo belong...
Definition: ai_config.cpp:64
All static information from an AI like name, version, etc.
Definition: ai_info.hpp:18
int version
Version of the Script.
void PushExtraConfigList()
In case you have mandatory non-Script-definable config entries in your list, add them to this functio...
Definition: ai_config.cpp:75
const char * name
Name of the Script.
Owner
Enum for all companies/owners.
Definition: company_type.h:20