From f66baa444ff5575b2b40e3bfd514cdb463f6f560 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Fri, 25 Dec 2020 19:38:18 +0100 Subject: Codechange: use C++11 constructs for for-each loops (#8432) --- src/game/game_scanner.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/game') diff --git a/src/game/game_scanner.cpp b/src/game/game_scanner.cpp index 6bcba4455..1935b7813 100644 --- a/src/game/game_scanner.cpp +++ b/src/game/game_scanner.cpp @@ -60,11 +60,10 @@ GameInfo *GameScannerInfo::FindInfo(const char *nameParam, int versionParam, boo /* See if there is a compatible Game script 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++) { - GameInfo *i = static_cast((*it).second); + for (const auto &item : this->info_list) { + GameInfo *i = static_cast(item.second); if (strcasecmp(game_name, i->GetName()) == 0 && i->CanLoadFromVersion(versionParam) && (version == -1 || i->GetVersion() > version)) { - version = (*it).second->GetVersion(); + version = item.second->GetVersion(); info = i; } } @@ -97,8 +96,8 @@ GameLibrary *GameScannerLibrary::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((*iter).second); + return static_cast((*it).second); } -- cgit v1.2.3-54-g00ecf