summaryrefslogtreecommitdiff
path: root/src/ai/ai_info.hpp
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2011-11-29 23:26:35 +0000
committertruebrain <truebrain@openttd.org>2011-11-29 23:26:35 +0000
commit34d7f01cccfbb4dcd09f0b68ded513f495fa69ed (patch)
treef7d152f88f52d5c883538a5218138fa3a256dc1e /src/ai/ai_info.hpp
parentc38c16773ca0bc5c928486b18318eb5b147f8ff0 (diff)
downloadopenttd-34d7f01cccfbb4dcd09f0b68ded513f495fa69ed.tar.xz
(svn r23364) -Codechange: refactor AIConfig, moving it mostly to Scriptconfig
Diffstat (limited to 'src/ai/ai_info.hpp')
-rw-r--r--src/ai/ai_info.hpp71
1 files changed, 4 insertions, 67 deletions
diff --git a/src/ai/ai_info.hpp b/src/ai/ai_info.hpp
index 82ca6f925..924ddd2e0 100644
--- a/src/ai/ai_info.hpp
+++ b/src/ai/ai_info.hpp
@@ -14,40 +14,8 @@
#ifdef ENABLE_AI
-#include <list>
-#include "../core/smallmap_type.hpp"
#include "../script/script_info.hpp"
-
-/** Bitmask of flags for AI settings. */
-enum AIConfigFlags {
- AICONFIG_NONE = 0x0, ///< No flags set.
- AICONFIG_RANDOM = 0x1, ///< When randomizing the AI, pick any value between min_value and max_value when on custom difficulty setting.
- AICONFIG_BOOLEAN = 0x2, ///< This value is a boolean (either 0 (false) or 1 (true) ).
- AICONFIG_INGAME = 0x4, ///< This setting can be changed while the AI is running.
- AICONFIG_AI_DEVELOPER = 0x8, ///< This setting will only be visible when the ai development tools are active.
-};
-
-typedef SmallMap<int, char *> LabelMapping; ///< Map-type used to map the setting numbers to labels.
-
-/** Info about a single AI setting. */
-struct AIConfigItem {
- const char *name; ///< The name of the configuration setting.
- const char *description; ///< The description of the configuration setting.
- int min_value; ///< The minimal value this configuration setting can have.
- int max_value; ///< The maximal value this configuration setting can have.
- int custom_value; ///< The default value on custom difficulty setting.
- int easy_value; ///< The default value on easy difficulty setting.
- int medium_value; ///< The default value on medium difficulty setting.
- int hard_value; ///< The default value on hard difficulty setting.
- int random_deviation; ///< The maximum random deviation from the default value.
- int step_size; ///< The step size in the gui.
- AIConfigFlags flags; ///< Flags for the configuration setting.
- LabelMapping *labels; ///< Text labels for the integer values.
-};
-
-extern AIConfigItem _start_date_config;
-
-typedef std::list<AIConfigItem> AIConfigItemList; ///< List of AIConfig items.
+#include "../script/script_config.hpp"
/** All static information from an AI like name, version, etc. */
class AIInfo : public ScriptInfo {
@@ -71,41 +39,11 @@ public:
static SQInteger DummyConstructor(HSQUIRRELVM vm);
/**
- * Get the settings of the AI.
- */
- bool GetSettings();
-
- /**
- * Get the config list for this AI.
- */
- const AIConfigItemList *GetConfigList() const;
-
- /**
- * Get the description of a certain ai config option.
- */
- const AIConfigItem *GetConfigItem(const char *name) const;
-
- /**
* Check if we can start this AI.
*/
bool CanLoadFromVersion(int version) const;
/**
- * Set a setting.
- */
- SQInteger AddSetting(HSQUIRRELVM vm);
-
- /**
- * Add labels for a setting.
- */
- SQInteger AddLabels(HSQUIRRELVM vm);
-
- /**
- * Get the default value for a setting.
- */
- int GetSettingDefaultValue(const char *name) const;
-
- /**
* Use this AI as a random AI.
*/
bool UseAsRandomAI() const { return this->use_as_random; }
@@ -116,10 +54,9 @@ public:
const char *GetAPIVersion() const { return this->api_version; }
private:
- AIConfigItemList config_list; ///< List of settings from this AI.
- int min_loadable_version; ///< The AI can load savegame data if the version is equal or greater than this.
- bool use_as_random; ///< Should this AI be used when the user wants a "random AI"?
- const char *api_version; ///< API version used by this AI.
+ int min_loadable_version; ///< The AI can load savegame data if the version is equal or greater than this.
+ bool use_as_random; ///< Should this AI be used when the user wants a "random AI"?
+ const char *api_version; ///< API version used by this AI.
};
/** All static information from an AI library like name, version, etc. */