OpenTTD
|
Public Member Functions | |
AIConfig (const AIConfig *config) | |
class AIInfo * | GetInfo () const |
Get the ScriptInfo linked to this ScriptConfig. | |
int | GetSetting (const char *name) const |
Get the value of a setting for this config. | |
void | SetSetting (const char *name, int value) |
Set the value of a setting for this config. | |
bool | ResetInfo (bool force_exact_match) |
When ever the AI Scanner is reloaded, all infos become invalid. | |
![]() | |
ScriptConfig (const ScriptConfig *config) | |
Create a new Script config that is a copy of an existing config. | |
virtual | ~ScriptConfig () |
Delete an Script configuration. | |
void | Change (const char *name, int version=-1, bool force_exact_match=false, bool is_random=false) |
Set another Script to be loaded in this slot. | |
const ScriptConfigItemList * | GetConfigList () |
Get the config list for this ScriptConfig. | |
void | AnchorUnchangeableSettings () |
As long as the default of a setting has not been changed, the value of the setting is not stored. | |
void | ResetSettings () |
Reset all settings to their default value. | |
void | AddRandomDeviation () |
Randomize all settings the Script requested to be randomized. | |
bool | HasScript () const |
Is this config attached to an Script? In other words, is there a Script that is assigned to this slot. | |
bool | IsRandom () const |
Is the current Script a randomly chosen Script? | |
const char * | GetName () const |
Get the name of the Script. | |
int | GetVersion () const |
Get the version of the Script. | |
void | StringToSettings (const char *value) |
Convert a string which is stored in the config file or savegames to custom settings of this Script. | |
void | SettingsToString (char *string, const char *last) const |
Convert the custom settings to a string that can be stored in the config file or savegames. | |
const char * | GetTextfile (TextfileType type, CompanyID slot) const |
Search a textfile file next to this script. |
Static Public Member Functions | |
static AIConfig * | GetConfig (CompanyID company, ScriptSettingSource source=SSS_DEFAULT) |
Get the config of a company. |
Protected Member Functions | |
void | PushExtraConfigList () |
In case you have mandatory non-Script-definable config entries in your list, add them to this function. | |
void | ClearConfigList () |
Routine that clears the config list. | |
ScriptInfo * | FindInfo (const char *name, int version, bool force_exact_match) |
This function should call back to the Scanner in charge of this Config, to find the ScriptInfo belonging to a name+version. |
Additional Inherited Members | |
![]() | |
enum | ScriptSettingSource { SSS_DEFAULT, SSS_FORCE_NEWGAME, SSS_FORCE_GAME } |
Where to get the config from, either default (depends on current game mode) or force either newgame or normal. More... | |
![]() | |
typedef std::map< const char *, int, StringCompare > | SettingValueList |
List with name=>value pairs of all script-specific settings. | |
![]() | |
const char * | name |
Name of the Script. | |
int | version |
Version of the Script. | |
class ScriptInfo * | info |
ScriptInfo object for related to this Script version. | |
SettingValueList | settings |
List with all setting=>value pairs that are configure for this Script. | |
ScriptConfigItemList * | config_list |
List with all settings defined by this Script. | |
bool | is_random |
True if the AI in this slot was randomly chosen. |
Definition at line 18 of file ai_config.hpp.
|
virtual |
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).
Reimplemented from ScriptConfig.
Definition at line 82 of file ai_config.cpp.
References GetGameSettings(), ScriptConfig::info, ScriptConfig::settings, SP_CUSTOM, SP_EASY, SP_HARD, and SP_MEDIUM.
Referenced by ClearConfigList(), AIInstance::GetSetting(), and AI::GetStartNextTime().
bool AIConfig::ResetInfo | ( | bool | force_exact_match | ) |
When ever the AI Scanner is reloaded, all infos become invalid.
This function tells AIConfig about this.
force_exact_match | If true try to find the exact same version as specified. If false any version is ok. |
true
if the reset was successful, false
if the AI was no longer found. Definition at line 60 of file ai_config.cpp.
References AI::FindInfo(), ScriptConfig::info, ScriptConfig::name, and ScriptConfig::version.
Referenced by AI::ResetConfig().