diff options
author | rubidium <rubidium@openttd.org> | 2010-01-07 00:09:27 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-01-07 00:09:27 +0000 |
commit | 0e404038f27544fe7ebad2127b1651cd471732b6 (patch) | |
tree | 2ff838abb0b51b6374b89c68770e32acb03208cc /src/ai/ai_config.cpp | |
parent | 1967084bc3800615e6584d9d3115e0109a0e40da (diff) | |
download | openttd-0e404038f27544fe7ebad2127b1651cd471732b6.tar.xz |
(svn r18747) -Codechange: add some constness to the AI code
Diffstat (limited to 'src/ai/ai_config.cpp')
-rw-r--r-- | src/ai/ai_config.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/ai/ai_config.cpp b/src/ai/ai_config.cpp index e92d3978d..aec2760d5 100644 --- a/src/ai/ai_config.cpp +++ b/src/ai/ai_config.cpp @@ -70,7 +70,7 @@ AIConfig::~AIConfig() if (this->config_list != NULL) delete this->config_list; } -AIInfo *AIConfig::GetInfo() +AIInfo *AIConfig::GetInfo() const { return this->info; } @@ -103,9 +103,9 @@ AIConfig *AIConfig::GetConfig(CompanyID company, bool forceNewgameSetting) return *config; } -int AIConfig::GetSetting(const char *name) +int AIConfig::GetSetting(const char *name) const { - SettingValueList::iterator it = this->settings.find(name); + SettingValueList::const_iterator it = this->settings.find(name); /* Return the default value if the setting is not set, or if we are in a not-custom difficult level */ if (it == this->settings.end() || ((_game_mode == GM_MENU) ? _settings_newgame.difficulty.diff_level : _settings_game.difficulty.diff_level) != 3) { if (this->info == NULL) { @@ -162,17 +162,17 @@ void AIConfig::AddRandomDeviation() } } -bool AIConfig::HasAI() +bool AIConfig::HasAI() const { return this->info != NULL; } -const char *AIConfig::GetName() +const char *AIConfig::GetName() const { return this->name; } -int AIConfig::GetVersion() +int AIConfig::GetVersion() const { return this->version; } @@ -203,10 +203,10 @@ void AIConfig::StringToSettings(const char *value) free(value_copy); } -void AIConfig::SettingsToString(char *string, size_t size) +void AIConfig::SettingsToString(char *string, size_t size) const { string[0] = '\0'; - for (SettingValueList::iterator it = this->settings.begin(); it != this->settings.end(); it++) { + for (SettingValueList::const_iterator it = this->settings.begin(); it != this->settings.end(); it++) { char no[10]; snprintf(no, sizeof(no), "%d", (*it).second); |