Public Member Functions | Static Public Member Functions | Protected Member Functions

# AIConfig Class Reference

Inheritance diagram for AIConfig:

## 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.
## 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.

## Detailed Description

Definition at line 18 of file ai_config.hpp.

## Member Function Documentation

int AIConfig::GetSetting | ( | const char * | name | ) | const`[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).

Returns:
  The (default) value of the setting, or -1 if the setting was not found.

Reimplemented from ScriptConfig.

Definition at line 78 of file ai_config.cpp.

References DifficultySettings::diff_level, GameSettings::difficulty, GetGameSettings(), ScriptConfig::info, and ScriptConfig::settings.

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.

Parameters:

  | force_exact_match | If true try to find the exact same version as specified. If false any version is ok.

Returns:
  `true` if the reset was successful, `false` if the AI was no longer found.

Definition at line 56 of file ai_config.cpp.

References AI::FindInfo(), ScriptConfig::info, ScriptConfig::name, and ScriptConfig::version.

Referenced by AI::ResetConfig().

The documentation for this class was generated from the following files:

- src/ai/ai_config.hpp
- src/ai/ai_config.cpp