[Scummvm-cvs-logs] SF.net SVN: scummvm:[34790] scummvm/trunk/engines/sword2/saveload.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Mon Oct 13 06:24:20 CEST 2008


Revision: 34790
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34790&view=rev
Author:   eriktorbjorn
Date:     2008-10-13 04:24:18 +0000 (Mon, 13 Oct 2008)

Log Message:
-----------
Use the save file manager's listSavefiles() function to find out if any savegames
exist at all. (The old method was to potentially try and open a hundred files,
though it would stop after finding the first one.)

Modified Paths:
--------------
    scummvm/trunk/engines/sword2/saveload.cpp

Modified: scummvm/trunk/engines/sword2/saveload.cpp
===================================================================
--- scummvm/trunk/engines/sword2/saveload.cpp	2008-10-12 22:25:35 UTC (rev 34789)
+++ scummvm/trunk/engines/sword2/saveload.cpp	2008-10-13 04:24:18 UTC (rev 34790)
@@ -388,15 +388,14 @@
 }
 
 bool Sword2Engine::saveExists() {
-	for (int i = 0; i <= 99; i++)
-		if (saveExists(i))
-			return true;
-	return false;
+	Common::String pattern = _targetName + ".???";
+	Common::StringList filenames = _saveFileMan->listSavefiles(pattern.c_str());
+
+	return !filenames.empty();
 }
 
 bool Sword2Engine::saveExists(uint16 slotNo) {
 	char *saveFileName = getSaveFileName(slotNo);
-
 	Common::InSaveFile *in;
 
 	if (!(in = _saveFileMan->openForLoading(saveFileName))) {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list