|
|
@ -70,7 +70,7 @@ AIConfig::~AIConfig()
|
|
|
|
if (this->config_list != NULL) delete this->config_list;
|
|
|
|
if (this->config_list != NULL) delete this->config_list;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AIInfo *AIConfig::GetInfo()
|
|
|
|
AIInfo *AIConfig::GetInfo() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return this->info;
|
|
|
|
return this->info;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -103,9 +103,9 @@ AIConfig *AIConfig::GetConfig(CompanyID company, bool forceNewgameSetting)
|
|
|
|
return *config;
|
|
|
|
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 */
|
|
|
|
/* 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 (it == this->settings.end() || ((_game_mode == GM_MENU) ? _settings_newgame.difficulty.diff_level : _settings_game.difficulty.diff_level) != 3) {
|
|
|
|
if (this->info == NULL) {
|
|
|
|
if (this->info == NULL) {
|
|
|
@ -162,17 +162,17 @@ void AIConfig::AddRandomDeviation()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool AIConfig::HasAI()
|
|
|
|
bool AIConfig::HasAI() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return this->info != NULL;
|
|
|
|
return this->info != NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const char *AIConfig::GetName()
|
|
|
|
const char *AIConfig::GetName() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return this->name;
|
|
|
|
return this->name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int AIConfig::GetVersion()
|
|
|
|
int AIConfig::GetVersion() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return this->version;
|
|
|
|
return this->version;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -203,10 +203,10 @@ void AIConfig::StringToSettings(const char *value)
|
|
|
|
free(value_copy);
|
|
|
|
free(value_copy);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void AIConfig::SettingsToString(char *string, size_t size)
|
|
|
|
void AIConfig::SettingsToString(char *string, size_t size) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string[0] = '\0';
|
|
|
|
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];
|
|
|
|
char no[10];
|
|
|
|
snprintf(no, sizeof(no), "%d", (*it).second);
|
|
|
|
snprintf(no, sizeof(no), "%d", (*it).second);
|
|
|
|
|
|
|
|
|
|
|
|