From 6a058892fbc00821c05703a1aa980ee763c3e673 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 29 Aug 2010 11:08:27 +0000 Subject: SCI: Throw a warning in QFG import screens for unmatched files The original SCI games supported up to 12 characters for file names, thus we use the file name returned as a mask to find the actual file, as we don't wrap/unwrap save file names in these screens. If no files match, or if more than 1 files match, throw a warning. svn-id: r52437 --- engines/sci/engine/kfile.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'engines/sci') diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index 99567d5d6e..fa5bee0003 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -823,7 +823,16 @@ reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv) { Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager(); Common::StringArray saveNames = saveFileMan->listSavefiles(pattern); - name = saveNames.size() > 0 ? saveNames[0] : name; + + // There should be exactly one match for this search, otherwise throw a warning + if (saveNames.size() == 0) { + warning("QFG No matches for %s", pattern.c_str()); + } else if (saveNames.size() == 1) { + name = saveNames[0]; + } else { + warning("More than 1 matches for %s, using the first one", pattern.c_str()); + name = saveNames[0]; + } } return file_open(s, name.c_str(), mode); -- cgit v1.2.3