summaryrefslogtreecommitdiff
path: root/src/ai/ai_config.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-01-09 14:41:22 +0000
committerrubidium <rubidium@openttd.org>2010-01-09 14:41:22 +0000
commitf65f276d10e528ffe2581656cfa8066a20002995 (patch)
tree40c36e7a0eb0070dbb4cb04eda09480fee9d0bbf /src/ai/ai_config.cpp
parent7f6016031e8367c8ce53a4017e5dadd47dc1974e (diff)
downloadopenttd-f65f276d10e528ffe2581656cfa8066a20002995.tar.xz
(svn r18763) -Feature [FS#3095]: rerandomise AIs on reloading (via the debug window) when they were randomly chosen
Diffstat (limited to 'src/ai/ai_config.cpp')
-rw-r--r--src/ai/ai_config.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ai/ai_config.cpp b/src/ai/ai_config.cpp
index aec2760d5..4b725728a 100644
--- a/src/ai/ai_config.cpp
+++ b/src/ai/ai_config.cpp
@@ -16,12 +16,13 @@
#include "ai.hpp"
#include "ai_config.hpp"
-void AIConfig::ChangeAI(const char *name, int version)
+void AIConfig::ChangeAI(const char *name, int version, bool is_random_ai)
{
free((void *)this->name);
this->name = (name == NULL) ? NULL : strdup(name);
this->info = (name == NULL) ? NULL : AI::FindInfo(this->name, version);
this->version = (info == NULL) ? -1 : info->GetVersion();
+ this->is_random_ai = is_random_ai;
if (this->config_list != NULL) delete this->config_list;
this->config_list = (info == NULL) ? NULL : new AIConfigItemList();
if (this->config_list != NULL) this->config_list->push_back(_start_date_config);
@@ -56,6 +57,7 @@ AIConfig::AIConfig(const AIConfig *config)
this->info = config->info;
this->version = config->version;
this->config_list = NULL;
+ this->is_random_ai = config->is_random_ai;
for (SettingValueList::const_iterator it = config->settings.begin(); it != config->settings.end(); it++) {
this->settings[strdup((*it).first)] = (*it).second;
@@ -167,6 +169,11 @@ bool AIConfig::HasAI() const
return this->info != NULL;
}
+bool AIConfig::IsRandomAI() const
+{
+ return this->is_random_ai;
+}
+
const char *AIConfig::GetName() const
{
return this->name;