diff options
author | Paul Gilbert | 2018-12-28 20:45:45 -0800 |
---|---|---|
committer | Paul Gilbert | 2018-12-28 20:45:45 -0800 |
commit | f218400d3b75ee1cf537e2ca9db23bc417475c10 (patch) | |
tree | 9df92800bb53d36da552dae2d5798d7b34ca0fd3 /engines/glk/scott | |
parent | 787a62c62d3a5864f0d221ca9acf12b8b332239b (diff) | |
download | scummvm-rg350-f218400d3b75ee1cf537e2ca9db23bc417475c10.tar.gz scummvm-rg350-f218400d3b75ee1cf537e2ca9db23bc417475c10.tar.bz2 scummvm-rg350-f218400d3b75ee1cf537e2ca9db23bc417475c10.zip |
GLK: Simplify arrays of valid extensions in detection code
Suggested by Sev as a way to avoid having both arrays and array sizes
Diffstat (limited to 'engines/glk/scott')
-rw-r--r-- | engines/glk/scott/detection.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
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)) { |