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
commit2462e8dc9d7e3a5a76c96d3c0229019a48e9bfdd (patch)
tree4bda69fe090f594da5db5f68bc1faa76c77adef4
parent695765fde79e9b30670d11cf65b74224816cb509 (diff)
downloadopenttd-2462e8dc9d7e3a5a76c96d3c0229019a48e9bfdd.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]);
}