From e36a4be7ce1efd6c7fff6e3c1f3f583d2bc5c189 Mon Sep 17 00:00:00 2001 From: sluicebox Date: Fri, 30 Aug 2019 18:00:25 -0700 Subject: SCI: Fix addAsVirtualFiles creating titles with no files Fixes QFG game titles appearing on import screens when no character files exist but save files exist that match fileMask --- engines/sci/engine/file.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/engine/file.cpp b/engines/sci/engine/file.cpp index 5821313ac7..c311810997 100644 --- a/engines/sci/engine/file.cpp +++ b/engines/sci/engine/file.cpp @@ -474,10 +474,9 @@ void DirSeeker::addAsVirtualFiles(Common::String title, Common::String fileMask) // Sort all filenames alphabetically Common::sort(foundFiles.begin(), foundFiles.end()); - _files.push_back(title); - _virtualFiles.push_back(""); Common::StringArray::iterator it; Common::StringArray::iterator it_end = foundFiles.end(); + bool titleAdded = false; for (it = foundFiles.begin(); it != it_end; it++) { Common::String regularFilename = *it; @@ -488,6 +487,13 @@ void DirSeeker::addAsVirtualFiles(Common::String title, Common::String fileMask) delete testfile; if (testfileSize > 1024) // check, if larger than 1k. in that case its a saved game. continue; // and we dont want to have those in the list + + if (!titleAdded) { + _files.push_back(title); + _virtualFiles.push_back(""); + titleAdded = true; + } + // We need to remove the prefix for display purposes _files.push_back(wrappedFilename); // but remember the actual name as well -- cgit v1.2.3