summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fileio.cpp9
-rw-r--r--src/game/game_text.cpp11
-rw-r--r--src/script/script_scanner.cpp9
-rw-r--r--src/tar_type.h2
4 files changed, 13 insertions, 18 deletions
diff --git a/src/fileio.cpp b/src/fileio.cpp
index f2a2b14f3..651fddff9 100644
--- a/src/fileio.cpp
+++ b/src/fileio.cpp
@@ -1345,12 +1345,12 @@ static uint ScanPath(FileScanner *fs, const char *extension, const char *path, s
* @param extension the extension of files to search for.
* @param tar the tar to search in.
*/
-static uint ScanTar(FileScanner *fs, const char *extension, TarFileList::iterator tar)
+static uint ScanTar(FileScanner *fs, const char *extension, const TarFileList::value_type &tar)
{
uint num = 0;
- const auto &filename = (*tar).first;
+ const auto &filename = tar.first;
- if (MatchesExtension(extension, filename.c_str()) && fs->AddFile(filename, 0, (*tar).second.tar_filename)) num++;
+ if (MatchesExtension(extension, filename.c_str()) && fs->AddFile(filename, 0, tar.second.tar_filename)) num++;
return num;
}
@@ -1369,7 +1369,6 @@ uint FileScanner::Scan(const char *extension, Subdirectory sd, bool tars, bool r
this->subdir = sd;
Searchpath sp;
- TarFileList::iterator tar;
uint num = 0;
FOR_ALL_SEARCHPATHS(sp) {
@@ -1381,7 +1380,7 @@ uint FileScanner::Scan(const char *extension, Subdirectory sd, bool tars, bool r
}
if (tars && sd != NO_DIRECTORY) {
- FOR_ALL_TARS(tar, sd) {
+ for (const auto &tar : _tar_filelist[sd]) {
num += ScanTar(this, extension, tar);
}
}
diff --git a/src/game/game_text.cpp b/src/game/game_text.cpp
index 24f41c93a..ce20c1ee7 100644
--- a/src/game/game_text.cpp
+++ b/src/game/game_text.cpp
@@ -249,16 +249,15 @@ GameStrings *LoadTranslations()
if (!tar_filename.empty() && (iter = _tar_list[GAME_DIR].find(tar_filename)) != _tar_list[GAME_DIR].end()) {
/* The main script is in a tar file, so find all files that
* are in the same tar and add them to the langfile scanner. */
- TarFileList::iterator tar;
- FOR_ALL_TARS(tar, GAME_DIR) {
+ for (const auto &tar : _tar_filelist[GAME_DIR]) {
/* Not in the same tar. */
- if (tar->second.tar_filename != iter->first) continue;
+ if (tar.second.tar_filename != iter->first) continue;
/* Check the path and extension. */
- if (tar->first.size() <= ldir.size() || tar->first.compare(0, ldir.size(), ldir) != 0) continue;
- if (tar->first.compare(tar->first.size() - 4, 4, ".txt") != 0) continue;
+ if (tar.first.size() <= ldir.size() || tar.first.compare(0, ldir.size(), ldir) != 0) continue;
+ if (tar.first.compare(tar.first.size() - 4, 4, ".txt") != 0) continue;
- scanner.AddFile(tar->first, 0, tar_filename);
+ scanner.AddFile(tar.first, 0, tar_filename);
}
} else {
/* Scan filesystem */
diff --git a/src/script/script_scanner.cpp b/src/script/script_scanner.cpp
index 8b48809bf..bdde99f6c 100644
--- a/src/script/script_scanner.cpp
+++ b/src/script/script_scanner.cpp
@@ -224,16 +224,15 @@ static bool IsSameScript(const ContentInfo *ci, bool md5sum, ScriptInfo *info, S
if (!tar_filename.empty() && (iter = _tar_list[dir].find(tar_filename)) != _tar_list[dir].end()) {
/* The main script is in a tar file, so find all files that
* are in the same tar and add them to the MD5 checksumming. */
- TarFileList::iterator tar;
- FOR_ALL_TARS(tar, dir) {
+ for (const auto &tar : _tar_filelist[dir]) {
/* Not in the same tar. */
- if (tar->second.tar_filename != iter->first) continue;
+ if (tar.second.tar_filename != iter->first) continue;
/* Check the extension. */
- const char *ext = strrchr(tar->first.c_str(), '.');
+ const char *ext = strrchr(tar.first.c_str(), '.');
if (ext == nullptr || strcasecmp(ext, ".nut") != 0) continue;
- checksum.AddFile(tar->first, 0, tar_filename);
+ checksum.AddFile(tar.first, 0, tar_filename);
}
} else {
char path[MAX_PATH];
diff --git a/src/tar_type.h b/src/tar_type.h
index c4e72df85..4266f2362 100644
--- a/src/tar_type.h
+++ b/src/tar_type.h
@@ -28,6 +28,4 @@ typedef std::map<std::string, TarFileListEntry> TarFileList;
extern std::array<TarList, NUM_SUBDIRS> _tar_list;
extern TarFileList _tar_filelist[NUM_SUBDIRS];
-#define FOR_ALL_TARS(tar, sd) for (tar = _tar_filelist[sd].begin(); tar != _tar_filelist[sd].end(); tar++)
-
#endif /* TAR_TYPE_H */