aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/glk/alan2/detection.cpp6
-rw-r--r--engines/glk/frotz/detection.cpp7
-rw-r--r--engines/glk/glulxe/detection.cpp6
-rw-r--r--engines/glk/magnetic/detection.cpp6
-rw-r--r--engines/glk/scott/detection.cpp11
5 files changed, 22 insertions, 14 deletions
diff --git a/engines/glk/alan2/detection.cpp b/engines/glk/alan2/detection.cpp
index d51a109c5e..175c3d61fc 100644
--- a/engines/glk/alan2/detection.cpp
+++ b/engines/glk/alan2/detection.cpp
@@ -46,7 +46,7 @@ Alan2Descriptor Alan2MetaEngine::findGame(const char *gameId) {
}
bool Alan2MetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
- const char *const EXTENSIONS[2] = { ".acd", ".dat" };
+ const char *const EXTENSIONS[] = { ".acd", ".dat", nullptr };
// Loop through the files of the folder
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
@@ -55,8 +55,8 @@ bool Alan2MetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g
continue;
Common::String filename = file->getName();
bool hasExt = false;
- for (int idx = 0; idx < 2 && !hasExt; ++idx)
- hasExt = filename.hasSuffixIgnoreCase(EXTENSIONS[idx]);
+ for (const char *const *ext = &EXTENSIONS[0]; *ext && !hasExt; ++ext)
+ hasExt = filename.hasSuffixIgnoreCase(*ext);
if (!hasExt)
continue;
diff --git a/engines/glk/frotz/detection.cpp b/engines/glk/frotz/detection.cpp
index 2ec48f9087..fbe7126116 100644
--- a/engines/glk/frotz/detection.cpp
+++ b/engines/glk/frotz/detection.cpp
@@ -47,7 +47,8 @@ PlainGameDescriptor FrotzMetaEngine::findGame(const char *gameId) {
}
bool FrotzMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
- const char *const EXTENSIONS[11] = { ".z1", ".z2", ".z3", ".z4", ".z5", ".z6", ".z7", ".z8", ".zblorb", ".dat", ".zip" };
+ const char *const EXTENSIONS[] = { ".z1", ".z2", ".z3", ".z4", ".z5", ".z6", ".z7", ".z8",
+ ".zblorb", ".dat", ".zip", nullptr };
// Loop through the files of the folder
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
@@ -56,8 +57,8 @@ bool FrotzMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &g
continue;
Common::String filename = file->getName();
bool hasExt = false;
- for (int idx = 0; idx < 11 && !hasExt; ++idx)
- hasExt = filename.hasSuffixIgnoreCase(EXTENSIONS[idx]);
+ for (const char *const *ext = &EXTENSIONS[0]; *ext && !hasExt; ++ext)
+ hasExt = filename.hasSuffixIgnoreCase(*ext);
if (!hasExt)
continue;
diff --git a/engines/glk/glulxe/detection.cpp b/engines/glk/glulxe/detection.cpp
index fb701131ef..09b6e97d0b 100644
--- a/engines/glk/glulxe/detection.cpp
+++ b/engines/glk/glulxe/detection.cpp
@@ -46,7 +46,7 @@ GlulxeDescriptor GlulxeMetaEngine::findGame(const char *gameId) {
}
bool GlulxeMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
- const char *const EXTENSIONS[3] = { ".ulx", ".blb", ".gblorb" };
+ const char *const EXTENSIONS[] = { ".ulx", ".blb", ".gblorb", nullptr };
// Loop through the files of the folder
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
@@ -55,8 +55,8 @@ bool GlulxeMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &
continue;
Common::String filename = file->getName();
bool hasExt = false;
- for (int idx = 0; idx < 3 && !hasExt; ++idx)
- hasExt = filename.hasSuffixIgnoreCase(EXTENSIONS[idx]);
+ for (const char *const *ext = &EXTENSIONS[0]; *ext && !hasExt; ++ext)
+ hasExt = filename.hasSuffixIgnoreCase(*ext);
if (!hasExt)
continue;
diff --git a/engines/glk/magnetic/detection.cpp b/engines/glk/magnetic/detection.cpp
index 91d63ccace..f7021065bc 100644
--- a/engines/glk/magnetic/detection.cpp
+++ b/engines/glk/magnetic/detection.cpp
@@ -46,7 +46,7 @@ MagneticDescriptor MagneticMetaEngine::findGame(const char *gameId) {
}
bool MagneticMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
- const char *const EXTENSIONS[1] = { ".magnetic" };
+ const char *const EXTENSIONS[] = { ".magnetic", nullptr };
// Loop through the files of the folder
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
@@ -55,8 +55,8 @@ bool MagneticMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames
continue;
Common::String filename = file->getName();
bool hasExt = false;
- for (int idx = 0; idx < 1 && !hasExt; ++idx)
- hasExt = filename.hasSuffixIgnoreCase(EXTENSIONS[idx]);
+ for (const char *const *ext = &EXTENSIONS[0]; *ext && !hasExt; ++ext)
+ hasExt = filename.hasSuffixIgnoreCase(*ext);
if (!hasExt)
continue;
diff --git a/engines/glk/scott/detection.cpp b/engines/glk/scott/detection.cpp
index 30feb59e37..c41825140c 100644
--- a/engines/glk/scott/detection.cpp
+++ b/engines/glk/scott/detection.cpp
@@ -44,14 +44,21 @@ PlainGameDescriptor ScottMetaEngine::findGame(const char *gameId) {
}
bool ScottMetaEngine::detectGames(const Common::FSList &fslist, DetectedGames &gameList) {
+ const char *const EXTENSIONS[] = { ".saga", ".dat", ".blb", ".blorb", nullptr };
Common::File gameFile;
Common::String md5;
// Loop through the files of the folder
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
Common::String name = file->getName();
- if (file->isDirectory() || !(name.hasSuffixIgnoreCase(".saga")
- || name.hasSuffixIgnoreCase(".dat") || name.hasSuffixIgnoreCase(".blb")))
+ if (file->isDirectory())
+ continue;
+
+ Common::String filename = file->getName();
+ bool hasExt = false;
+ for (const char *const *ext = &EXTENSIONS[0]; *ext && !hasExt; ++ext)
+ hasExt = filename.hasSuffixIgnoreCase(*ext);
+ if (!hasExt)
continue;
if (gameFile.open(*file)) {