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
This commit is contained in:
Filippos Karapetis 2010-08-29 11:08:27 +00:00
parent 9e9db758fb
commit 6a058892fb

View File

@ -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);