summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2009-01-13 00:08:38 +0000
committertruebrain <truebrain@openttd.org>2009-01-13 00:08:38 +0000
commita2b24a8362c99874162ab4718f2624df3aa54c18 (patch)
tree4bda69fe090f594da5db5f68bc1faa76c77adef4
parentc8f9cbca53759b7e77736d43bf77aa868e1e900e (diff)
downloadopenttd-a2b24a8362c99874162ab4718f2624df3aa54c18.tar.xz
(svn r15043) -Fix: just try to change the AI, and see if that succeeded, instead of hoping you understand the internals of a change AI routine (to avoid possible mistakes in the future)
-rw-r--r--src/console_cmds.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index 19352684e..3f23b7c71 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -890,12 +890,11 @@ DEF_CONSOLE_CMD(ConStartAI)
AIConfig *config = AIConfig::GetConfig((CompanyID)n);
if (argc >= 2) {
- class AIInfo *info = AI::GetCompanyInfo(argv[1]);
- if (info == NULL) {
+ config->ChangeAI(argv[1]);
+ if (!config->HasAI()) {
IConsoleWarning("Failed to load the specified AI");
return true;
}
- config->ChangeAI(argv[1]);
if (argc == 3) {
config->StringToSettings(argv[2]);
}