summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2020-12-25 19:38:18 +0100
committerGitHub <noreply@github.com>2020-12-25 19:38:18 +0100
commitf66baa444ff5575b2b40e3bfd514cdb463f6f560 (patch)
treef0977f8443106be749dac7a84fb01c2eebaedd45 /src/game
parent9add62796c91c8eb7dd971cb21c8cdeba49cadfa (diff)
downloadopenttd-f66baa444ff5575b2b40e3bfd514cdb463f6f560.tar.xz
Codechange: use C++11 constructs for for-each loops (#8432)
Diffstat (limited to 'src/game')
-rw-r--r--src/game/game_scanner.cpp13
1 files changed, 6 insertions, 7 deletions
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<GameInfo *>((*it).second);
+ for (const auto &item : this->info_list) {
+ GameInfo *i = static_cast<GameInfo *>(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<GameLibrary *>((*iter).second);
+ return static_cast<GameLibrary *>((*it).second);
}