changeset 10711:185f0238d14c draft

(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)
author truebrain <truebrain@openttd.org>
date Tue, 13 Jan 2009 00:08:38 +0000
parents 72ab9b498760
children 382f744bb239
files src/console_cmds.cpp
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -890,12 +890,11 @@
 
 	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]);
 		}