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 #include "../company_type.h"
00019
00020 class AIConfig {
00021 private:
00022 typedef std::map<const char *, int, StringCompare> SettingValueList;
00023
00024 public:
00025 AIConfig() :
00026 name(NULL),
00027 version(-1),
00028 info(NULL),
00029 config_list(NULL),
00030 is_random_ai(false)
00031 {}
00032 AIConfig(const AIConfig *config);
00033 ~AIConfig();
00034
00041 void ChangeAI(const char *name, int version = -1, bool is_random = false);
00042
00049 bool ResetInfo();
00050
00054 class AIInfo *GetInfo() const;
00055
00059 const AIConfigItemList *GetConfigList();
00060
00064 static AIConfig *GetConfig(CompanyID company, bool forceNewgameSetting = false);
00065
00073 int GetSetting(const char *name) const;
00074
00078 void SetSetting(const char *name, int value);
00079
00083 void ResetSettings();
00084
00088 void AddRandomDeviation();
00089
00093 bool HasAI() const;
00094
00098 bool IsRandomAI() const;
00099
00103 const char *GetName() const;
00104
00108 int GetVersion() const;
00109
00114 void StringToSettings(const char *value);
00115
00120 void SettingsToString(char *string, size_t size) const;
00121
00122 private:
00123 const char *name;
00124 int version;
00125 class AIInfo *info;
00126 SettingValueList settings;
00127 AIConfigItemList *config_list;
00128 bool is_random_ai;
00129 };
00130
00131 #endif