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 #ifdef ENABLE_AI
00015
00016 #include <map>
00017 #include "ai_info.hpp"
00018 #include "../core/string_compare_type.hpp"
00019 #include "../company_type.h"
00020
00021 class AIConfig {
00022 private:
00023 typedef std::map<const char *, int, StringCompare> SettingValueList;
00024
00025 public:
00026 AIConfig() :
00027 name(NULL),
00028 version(-1),
00029 info(NULL),
00030 config_list(NULL),
00031 is_random_ai(false)
00032 {}
00033 AIConfig(const AIConfig *config);
00034 ~AIConfig();
00035
00044 void ChangeAI(const char *name, int version = -1, bool force_exact_match = false, bool is_random = false);
00045
00052 bool ResetInfo();
00053
00057 class AIInfo *GetInfo() const;
00058
00062 const AIConfigItemList *GetConfigList();
00063
00067 static AIConfig *GetConfig(CompanyID company, bool forceNewgameSetting = false);
00068
00076 int GetSetting(const char *name) const;
00077
00081 void SetSetting(const char *name, int value);
00082
00086 void ResetSettings();
00087
00091 void AddRandomDeviation();
00092
00096 bool HasAI() const;
00097
00101 bool IsRandomAI() const;
00102
00106 const char *GetName() const;
00107
00111 int GetVersion() const;
00112
00117 void StringToSettings(const char *value);
00118
00123 void SettingsToString(char *string, size_t size) const;
00124
00125 private:
00126 const char *name;
00127 int version;
00128 class AIInfo *info;
00129 SettingValueList settings;
00130 AIConfigItemList *config_list;
00131 bool is_random_ai;
00132 };
00133
00134 #endif
00135 #endif