ai_config.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef AI_CONFIG_HPP
00013 #define AI_CONFIG_HPP
00014
00015 #include <map>
00016 #include "ai_info.hpp"
00017 #include "../core/string_compare_type.hpp"
00018
00019 class AIConfig {
00020 private:
00021 typedef std::map<const char *, int, StringCompare> SettingValueList;
00022
00023 public:
00024 AIConfig() :
00025 name(NULL),
00026 version(-1),
00027 info(NULL),
00028 config_list(NULL)
00029 {}
00030 AIConfig(const AIConfig *config);
00031 ~AIConfig();
00032
00038 void ChangeAI(const char *name, int version = -1);
00039
00046 bool ResetInfo();
00047
00051 class AIInfo *GetInfo();
00052
00056 const AIConfigItemList *GetConfigList();
00057
00061 static AIConfig *GetConfig(CompanyID company, bool forceNewgameSetting = false);
00062
00070 int GetSetting(const char *name);
00071
00075 void SetSetting(const char *name, int value);
00076
00080 void ResetSettings();
00081
00085 void AddRandomDeviation();
00086
00090 bool HasAI();
00091
00095 const char *GetName();
00096
00100 int GetVersion();
00101
00106 void StringToSettings(const char *value);
00107
00112 void SettingsToString(char *string, size_t size);
00113
00114 private:
00115 const char *name;
00116 int version;
00117 class AIInfo *info;
00118 SettingValueList settings;
00119 AIConfigItemList *config_list;
00120 };
00121
00122 #endif