ai_config.hpp
Go to the documentation of this file.00001
00002
00005 #ifndef AI_CONFIG_HPP
00006 #define AI_CONFIG_HPP
00007
00008 #include <map>
00009 #include "ai_info.hpp"
00010 #include "../core/string_compare_type.hpp"
00011
00012 class AIConfig {
00013 private:
00014 typedef std::map<const char *, int, StringCompare> SettingValueList;
00015
00016 public:
00017 AIConfig() :
00018 name(NULL),
00019 version(-1),
00020 info(NULL),
00021 config_list(NULL)
00022 {}
00023 AIConfig(const AIConfig *config);
00024 ~AIConfig();
00025
00031 void ChangeAI(const char *name, int version = -1);
00032
00039 bool ResetInfo();
00040
00044 class AIInfo *GetInfo();
00045
00049 const AIConfigItemList *GetConfigList();
00050
00054 static AIConfig *GetConfig(CompanyID company, bool forceNewgameSetting = false);
00055
00063 int GetSetting(const char *name);
00064
00068 void SetSetting(const char *name, int value);
00069
00073 void ResetSettings();
00074
00078 void AddRandomDeviation();
00079
00083 bool HasAI();
00084
00088 const char *GetName();
00089
00093 int GetVersion();
00094
00099 void StringToSettings(const char *value);
00100
00105 void SettingsToString(char *string, size_t size);
00106
00107 private:
00108 const char *name;
00109 int version;
00110 class AIInfo *info;
00111 SettingValueList settings;
00112 AIConfigItemList *config_list;
00113 };
00114
00115 #endif