summaryrefslogtreecommitdiff
path: root/src/console_cmds.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/console_cmds.cpp')
-rw-r--r--src/console_cmds.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index 2f678b2fc..e87232b36 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -1172,7 +1172,24 @@ DEF_CONSOLE_CMD(ConStartAI)
AIConfig *config = AIConfig::GetConfig((CompanyID)n);
if (argc >= 2) {
- config->Change(argv[1], -1, true);
+ config->Change(argv[1], -1, false);
+
+ /* If the name is not found, and there is a dot in the name,
+ * try again with the assumption everything right of the dot is
+ * the version the user wants to load. */
+ if (!config->HasScript()) {
+ char *name = stredup(argv[1]);
+ char *e = strrchr(name, '.');
+ if (e != nullptr) {
+ *e = '\0';
+ e++;
+
+ int version = atoi(e);
+ config->Change(name, version, true);
+ }
+ free(name);
+ }
+
if (!config->HasScript()) {
IConsoleWarning("Failed to load the specified AI");
return true;