diff options
-rw-r--r-- | engines/scumm/plugin.cpp | 15 | ||||
-rw-r--r-- | engines/scumm/resource.cpp | 6 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 5 |
3 files changed, 13 insertions, 13 deletions
diff --git a/engines/scumm/plugin.cpp b/engines/scumm/plugin.cpp index 00384cf4ac..93b641bc2a 100644 --- a/engines/scumm/plugin.cpp +++ b/engines/scumm/plugin.cpp @@ -996,7 +996,7 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) { int substLastIndex = 0; - while (substLastIndex != -1) { + do { // Iterate over all files in the given directory for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { if (!file->isDirectory()) { @@ -1166,9 +1166,9 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) { } } - substLastIndex = findSubstResFileName(subst, tempName, substLastIndex + 1); + substLastIndex = findSubstResFileName(subst, tempName, substLastIndex); applySubstResFileName(subst, tempName, detectName, sizeof(detectName)); - } + } while (subst.winName != 0); } } @@ -1272,7 +1272,7 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) { strcpy(tempName, detectName); int substLastIndex = 0; - while (substLastIndex != -1) { + do { // FIXME: Repeatedly calling File::exists like this is a bad idea. // Instead, use the fs.h code to get a list of all files in that // directory and simply check whether that filename is contained @@ -1282,11 +1282,12 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) { break; } - substLastIndex = findSubstResFileName(subst, tempName, substLastIndex + 1); + substLastIndex = findSubstResFileName(subst, tempName, substLastIndex); applySubstResFileName(subst, tempName, detectName, sizeof(detectName)); - } + } while (subst.winName != 0); + if (found) { - if (substLastIndex != 0) + if (subst.winName != 0) debug(5, "Generated filename substitute: %s -> %s", tempName, detectName); break; } diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp index 7e98b6bf43..cd51174170 100644 --- a/engines/scumm/resource.cpp +++ b/engines/scumm/resource.cpp @@ -258,13 +258,13 @@ bool ScummEngine::openFile(BaseScummFile &file, const char *filename, bool resou if (_substResFileNameBundle.winName == 0) { int substLastIndex = 0; - while (substLastIndex != -1) { + do { if (file.openSubFile(name)) break; - substLastIndex = findSubstResFileName(_substResFileNameBundle, filename, substLastIndex + 1); + substLastIndex = findSubstResFileName(_substResFileNameBundle, filename, substLastIndex); applySubstResFileName(_substResFileNameBundle, filename, name, sizeof(name)); - } + } while (_substResFileNameBundle.winName != 0); if (_substResFileNameBundle.winName != 0) { debug(5, "Generated substitute in Mac bundle: [%s -> %s]", filename, _substResFileNameBundle.winName); diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 1bb6fa205c..0f0ef5eadb 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -79,7 +79,6 @@ ScummEngine *g_scumm = 0; static SubstResFileNames substResFileNameTable[] = { - { "Intentionally/left/blank", "", kGenMacNoParens }, { "00.LFL", "Maniac Mansion (E).prg", kGenAsIs }, { "00.LFL", "Maniac Mansion (F).prg", kGenAsIs }, { "00.LFL", "Maniac Mansion (SW).prg", kGenAsIs }, @@ -350,7 +349,7 @@ bool applySubstResFileName(const SubstResFileNames &subst, const char *filename, } int findSubstResFileName(SubstResFileNames &subst, const char *filename, int index) { - if (index <= 0) + if (index < 0) return -1; size_t len = strlen(filename); @@ -370,7 +369,7 @@ int findSubstResFileName(SubstResFileNames &subst, const char *filename, int ind for (i = index; substResFileNameTable[i].winName; i++) { if (!scumm_strnicmp(filename, substResFileNameTable[i].winName, len)) { subst = substResFileNameTable[i]; - return i; + return i+1; } } subst = substResFileNameTable[i]; |