From 1884ba20bc1b6b02a256e444af04f96e7bc22778 Mon Sep 17 00:00:00 2001 From: yexo Date: Mon, 23 Feb 2009 20:57:55 +0000 Subject: (svn r15562) -Change: Use GetName() to determine the unique AI name instead of GetInstanceName() to make branching of AIs easier. --- src/ai/ai_core.cpp | 2 +- src/ai/ai_gui.cpp | 2 +- src/ai/ai_scanner.cpp | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ai/ai_core.cpp b/src/ai/ai_core.cpp index f4f703614..2081e6436 100644 --- a/src/ai/ai_core.cpp +++ b/src/ai/ai_core.cpp @@ -37,7 +37,7 @@ info = AI::ai_scanner->SelectRandomAI(); assert(info != NULL); /* Load default data and store the name in the settings */ - AIConfig::GetConfig(company)->ChangeAI(info->GetInstanceName()); + AIConfig::GetConfig(company)->ChangeAI(info->GetName()); } _current_company = company; diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 5aae9938c..34d001e8d 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -115,7 +115,7 @@ struct AIListWindow : public Window { } else { AIInfoList::const_iterator it = this->ai_info_list->begin(); for (int i = 0; i < this->selected; i++) it++; - AIConfig::GetConfig(slot)->ChangeAI((*it).second->GetInstanceName(), (*it).second->GetVersion()); + AIConfig::GetConfig(slot)->ChangeAI((*it).second->GetName(), (*it).second->GetVersion()); } InvalidateWindow(WC_GAME_OPTIONS, 0); } diff --git a/src/ai/ai_scanner.cpp b/src/ai/ai_scanner.cpp index 7e4e878d4..860a8d7cd 100644 --- a/src/ai/ai_scanner.cpp +++ b/src/ai/ai_scanner.cpp @@ -307,12 +307,12 @@ void AIScanner::RegisterLibrary(AILibrary *library) void AIScanner::RegisterAI(AIInfo *info) { char ai_name[1024]; - snprintf(ai_name, sizeof(ai_name), "%s.%d", info->GetInstanceName(), info->GetVersion()); + snprintf(ai_name, sizeof(ai_name), "%s.%d", info->GetName(), info->GetVersion()); strtolower(ai_name); /* Check if GetShortName follows the rules */ if (strlen(info->GetShortName()) != 4) { - DEBUG(ai, 0, "The AI '%s' returned a string from GetShortName() which is not four characaters. Unable to load the AI.", info->GetInstanceName()); + DEBUG(ai, 0, "The AI '%s' returned a string from GetShortName() which is not four characaters. Unable to load the AI.", info->GetName()); delete info; return; } @@ -342,7 +342,7 @@ void AIScanner::RegisterAI(AIInfo *info) /* Add the AI to the 'unique' AI list, where only the highest version of the * AI is registered. */ - snprintf(ai_name, sizeof(ai_name), "%s", info->GetInstanceName()); + snprintf(ai_name, sizeof(ai_name), "%s", info->GetName()); strtolower(ai_name); if (this->info_single_list.find(ai_name) == this->info_single_list.end()) { this->info_single_list[strdup(ai_name)] = info; @@ -406,7 +406,7 @@ AIInfo *AIScanner::FindInfo(const char *nameParam, int versionParam) AIInfoList::iterator it = this->info_list.begin(); for (; it != this->info_list.end(); it++) { char ai_name_compare[1024]; - snprintf(ai_name_compare, sizeof(ai_name_compare), "%s", (*it).second->GetInstanceName()); + snprintf(ai_name_compare, sizeof(ai_name_compare), "%s", (*it).second->GetName()); strtolower(ai_name_compare); if (strcasecmp(ai_name, ai_name_compare) == 0 && (*it).second->CanLoadFromVersion(versionParam)) { @@ -424,7 +424,7 @@ char *AIScanner::GetAIConsoleList(char *p, const char *last) AIInfoList::iterator it = this->info_list.begin(); for (; it != this->info_list.end(); it++) { AIInfo *i = (*it).second; - p += seprintf(p, last, "%10s (v%d): %s\n", i->GetInstanceName(), i->GetVersion(), i->GetDescription()); + p += seprintf(p, last, "%10s (v%d): %s\n", i->GetName(), i->GetVersion(), i->GetDescription()); } p += seprintf(p, last, "\n"); -- cgit v1.2.3-54-g00ecf