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 
8 /** @file ai_config.hpp AIConfig stores the configuration settings of every AI. */
9 
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:
18 	/**
19 	 * Get the config of a company.
20 	 */
21 	static AIConfig *GetConfig(CompanyID company, ScriptSettingSource source = SSS_DEFAULT);
22 
AIConfig()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 
35 	/**
36 	 * When ever the AI Scanner is reloaded, all infos become invalid. This
37 	 *  function tells AIConfig about this.
38 	 * @param force_exact_match If true try to find the exact same version
39 	 *   as specified. If false any version is ok.
40 	 * @return \c true if the reset was successful, \c false if the AI was no longer
41 	 *  found.
42 	 */
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 */
52