File diff r24499:98a439b5214f → r24500:deda806a71a7
src/ai/ai_scanner.cpp
Show inline comments
 
@@ -61,8 +61,8 @@ void AIScannerInfo::RegisterAPI(class Sq
 
AIInfo *AIScannerInfo::SelectRandomAI() const
 
{
 
	uint num_random_ais = 0;
 
	for (ScriptInfoList::const_iterator it = this->info_single_list.begin(); it != this->info_single_list.end(); it++) {
 
		AIInfo *i = static_cast<AIInfo *>((*it).second);
 
	for (const auto &item : info_single_list) {
 
		AIInfo *i = static_cast<AIInfo *>(item.second);
 
		if (i->UseAsRandomAI()) num_random_ais++;
 
	}
 

	
 
@@ -121,11 +121,10 @@ AIInfo *AIScannerInfo::FindInfo(const ch
 

	
 
	/* See if there is a compatible AI which goes by that name, with the highest
 
	 *  version which allows loading the requested version */
 
	ScriptInfoList::iterator it = this->info_list.begin();
 
	for (; it != this->info_list.end(); it++) {
 
		AIInfo *i = static_cast<AIInfo *>((*it).second);
 
	for (const auto &item : this->info_list) {
 
		AIInfo *i = static_cast<AIInfo *>(item.second);
 
		if (strcasecmp(ai_name, i->GetName()) == 0 && i->CanLoadFromVersion(versionParam) && (version == -1 || i->GetVersion() > version)) {
 
			version = (*it).second->GetVersion();
 
			version = item.second->GetVersion();
 
			info = i;
 
		}
 
	}
 
@@ -158,8 +157,8 @@ AILibrary *AIScannerLibrary::FindLibrary
 
	strtolower(library_name);
 

	
 
	/* Check if the library + version exists */
 
	ScriptInfoList::iterator iter = this->info_list.find(library_name);
 
	if (iter == this->info_list.end()) return nullptr;
 
	ScriptInfoList::iterator it = this->info_list.find(library_name);
 
	if (it == this->info_list.end()) return nullptr;
 

	
 
	return static_cast<AILibrary *>((*iter).second);
 
	return static_cast<AILibrary *>((*it).second);
 
}