Files
@ r10764:5b98d3dd6146
Branch filter:
Location: cpp/openttd-patchpack/source/src/ai/ai_config.hpp
r10764:5b98d3dd6146
2.2 KiB
text/x-c++hdr
(svn r15097) -Update: WebTranslator2 update to 2009-01-15 18:47:56
brazilian_portuguese - 8 fixed by tucalipe (8)
danish - 4 fixed, 1 changed by beruic (5)
dutch - 6 fixed by habell (6)
english_US - 76 fixed by WhiteRabbit (76)
french - 7 fixed, 1 changed by glx (8)
greek - 9 fixed, 2 changed by doukas (11)
indonesian - 13 changed by fanioz (13)
norwegian_nynorsk - 24 fixed by runarlu (24)
polish - 5 fixed by xaxa (5)
brazilian_portuguese - 8 fixed by tucalipe (8)
danish - 4 fixed, 1 changed by beruic (5)
dutch - 6 fixed by habell (6)
english_US - 76 fixed by WhiteRabbit (76)
french - 7 fixed, 1 changed by glx (8)
greek - 9 fixed, 2 changed by doukas (11)
indonesian - 13 changed by fanioz (13)
norwegian_nynorsk - 24 fixed by runarlu (24)
polish - 5 fixed by xaxa (5)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | /* $Id$ */
/** @file ai_config.hpp AIConfig stores the configuration settings of every AI. */
#ifndef AI_CONFIG_HPP
#define AI_CONFIG_HPP
#include <map>
#ifndef AI_HPP
struct ltstr { bool operator()(const char *s1, const char *s2) const { return strcmp(s1, s2) < 0; } };
#endif /* AI_HPP */
class AIConfig {
private:
typedef std::map<const char *, int, ltstr> SettingValueList;
public:
AIConfig() :
name(NULL),
version(-1),
info(NULL)
{}
AIConfig(const AIConfig *config);
~AIConfig();
/**
* Set another AI to be loaded in this slot.
* @param name The name of the AI.
* @param version The version of the AI to load, or -1 of latest.
*/
void ChangeAI(const char *name, int version = -1);
/**
* When ever the AI Scanner is reloaded, all infos become invalid. This
* function tells AIConfig about this.
* @return True if the reset was successfull, false if the AI was no longer
* found.
*/
bool ResetInfo();
/**
* Get the AIInfo linked to this AIConfig.
*/
class AIInfo *GetInfo();
/**
* Get the config of a company.
*/
static AIConfig *GetConfig(CompanyID company, bool forceNewgameSetting = false);
/**
* Get the value of a setting for this config. It might fallback to his
* 'info' to find the default value (if not set or if not-custom difficulty
* level).
* @return The (default) value of the setting, or -1 if the setting was not
* found.
*/
int GetSetting(const char *name);
/**
* Set the value of a setting for this config.
*/
void SetSetting(const char *name, int value);
/**
* Randomize all settings the AI requested to be randomized.
*/
void AddRandomDeviation();
/**
* Is this config attached to an AI?
*/
bool HasAI();
/**
* Get the name of the AI.
*/
const char *GetName();
/**
* Get the version of the AI.
*/
int GetVersion();
/**
* Convert a string which is stored in the config file or savegames to
* custom settings of this AI.
*/
void StringToSettings(const char *value);
/**
* Convert the custom settings to a string that can be stored in the config
* file or savegames.
*/
void SettingsToString(char *string, int size);
private:
const char *name;
int version;
class AIInfo *info;
SettingValueList settings;
};
#endif /* AI_CONFIG_HPP */
|