ai_info.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef AI_INFO
00013 #define AI_INFO
00014
00015 #include <list>
00016 #include "../core/smallmap_type.hpp"
00017 #include "../script/script_info.hpp"
00018
00019 enum AIConfigFlags {
00020 AICONFIG_NONE = 0x0,
00021 AICONFIG_RANDOM = 0x1,
00022 AICONFIG_BOOLEAN = 0x2,
00023 AICONFIG_INGAME = 0x4,
00024 };
00025
00026 typedef SmallMap<int, char *> LabelMapping;
00027
00028 struct AIConfigItem {
00029 const char *name;
00030 const char *description;
00031 int min_value;
00032 int max_value;
00033 int custom_value;
00034 int easy_value;
00035 int medium_value;
00036 int hard_value;
00037 int random_deviation;
00038 int step_size;
00039 AIConfigFlags flags;
00040 LabelMapping *labels;
00041 };
00042
00043 extern AIConfigItem _start_date_config;
00044
00045 typedef std::list<AIConfigItem> AIConfigItemList;
00046
00047 class AIFileInfo : public ScriptFileInfo {
00048 public:
00052 static SQInteger Constructor(HSQUIRRELVM vm, AIFileInfo *info);
00053
00054 protected:
00055 class AIScanner *base;
00056 };
00057
00058 class AIInfo : public AIFileInfo {
00059 public:
00060 static const char *GetClassName() { return "AIInfo"; }
00061
00062 AIInfo();
00063 ~AIInfo();
00064
00068 static SQInteger Constructor(HSQUIRRELVM vm);
00069 static SQInteger DummyConstructor(HSQUIRRELVM vm);
00070
00074 bool GetSettings();
00075
00079 const AIConfigItemList *GetConfigList() const;
00080
00084 const AIConfigItem *GetConfigItem(const char *name) const;
00085
00089 bool CanLoadFromVersion(int version) const;
00090
00094 SQInteger AddSetting(HSQUIRRELVM vm);
00095
00099 SQInteger AddLabels(HSQUIRRELVM vm);
00100
00104 int GetSettingDefaultValue(const char *name) const;
00105
00109 bool UseAsRandomAI() const { return this->use_as_random; }
00110
00114 const char *GetAPIVersion() const { return this->api_version; }
00115
00116 private:
00117 AIConfigItemList config_list;
00118 int min_loadable_version;
00119 bool use_as_random;
00120 const char *api_version;
00121 };
00122
00123 class AILibrary : public AIFileInfo {
00124 public:
00125 AILibrary() : AIFileInfo(), category(NULL) {};
00126 ~AILibrary();
00127
00131 static SQInteger Constructor(HSQUIRRELVM vm);
00132
00133 static SQInteger Import(HSQUIRRELVM vm);
00134
00138 const char *GetCategory() const { return this->category; }
00139
00140 private:
00141 const char *category;
00142 };
00143
00144 #endif