(svn r18747) -Codechange: add some constness to the AI code
This commit is contained in:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user