Codechange: use C++11 constructs for for-each loops (#8432)
This commit is contained in:
@@ -61,8 +61,8 @@ void AIScannerInfo::RegisterAPI(class Squirrel *engine)
|
||||
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 char *nameParam, int versionParam, bool fo
|
||||
|
||||
/* 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(const char *library, int version)
|
||||
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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user