[Scummvm-cvs-logs] SF.net SVN: scummvm:[35191] scummvm/trunk/engines/tucker

cyx at users.sourceforge.net cyx at users.sourceforge.net
Sun Nov 30 13:23:24 CET 2008


Revision: 35191
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35191&view=rev
Author:   cyx
Date:     2008-11-30 12:23:24 +0000 (Sun, 30 Nov 2008)

Log Message:
-----------
fixed listSaves ordering

Modified Paths:
--------------
    scummvm/trunk/engines/tucker/detection.cpp
    scummvm/trunk/engines/tucker/tucker.h

Modified: scummvm/trunk/engines/tucker/detection.cpp
===================================================================
--- scummvm/trunk/engines/tucker/detection.cpp	2008-11-30 11:52:54 UTC (rev 35190)
+++ scummvm/trunk/engines/tucker/detection.cpp	2008-11-30 12:23:24 UTC (rev 35191)
@@ -125,26 +125,32 @@
 	virtual SaveStateList listSaves(const char *target) const {
 		Common::String pattern = Tucker::generateGameStateFileName(target, 0, true);
 		Common::StringList filenames = g_system->getSavefileManager()->listSavefiles(pattern.c_str());
-		sort(filenames.begin(), filenames.end());
+		bool slotsTable[Tucker::kLastSaveSlot + 1];
+		memset(slotsTable, 0, sizeof(slotsTable));
 		SaveStateList saveList;
 		for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
 			int slot;
 			const char *ext = strrchr(file->c_str(), '.');
-			if (ext && (slot = atoi(ext + 1)) >= 0) {
+			if (ext && (slot = atoi(ext + 1)) >= 0 && slot <= Tucker::kLastSaveSlot) {
 				Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(file->c_str());
 				if (in) {
-					char description[64];
-					snprintf(description, sizeof(description), "savegm.%02d", slot);
-					saveList.push_back(SaveStateDescriptor(slot, description));
+					slotsTable[slot] = true;
 					delete in;
 				}
 			}
 		}
+		for (int slot = 0; slot <= Tucker::kLastSaveSlot; ++slot) {
+			if (slotsTable[slot]) {
+				char description[64];
+				snprintf(description, sizeof(description), "savegm.%02d", slot);
+				saveList.push_back(SaveStateDescriptor(slot, description));
+			}
+		}
 		return saveList;
 	}
 
 	virtual int getMaximumSaveSlot() const {
-		return 99;
+		return Tucker::kLastSaveSlot;
 	}
 
 	virtual void removeSaveState(const char *target, int slot) const {

Modified: scummvm/trunk/engines/tucker/tucker.h
===================================================================
--- scummvm/trunk/engines/tucker/tucker.h	2008-11-30 11:52:54 UTC (rev 35190)
+++ scummvm/trunk/engines/tucker/tucker.h	2008-11-30 12:23:24 UTC (rev 35191)
@@ -176,7 +176,8 @@
 	kFadePaletteStep = 5,
 	kStartupLocation = 1,
 	kDefaultCharSpeechSoundCounter = 1,
-	kMaxSoundVolume = 127
+	kMaxSoundVolume = 127,
+	kLastSaveSlot = 99
 };
 
 enum Verb {


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