[Scummvm-cvs-logs] SF.net SVN: scummvm:[33857] scummvm/branches/gsoc2008-rtl/gui/launcher.cpp

cpage88 at users.sourceforge.net cpage88 at users.sourceforge.net
Thu Aug 14 08:51:04 CEST 2008


Revision: 33857
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33857&view=rev
Author:   cpage88
Date:     2008-08-14 06:51:04 +0000 (Thu, 14 Aug 2008)

Log Message:
-----------
Added implementation for deleting savestates from the launcher for engines which do NOT use an index file.  Implementation for those engines that do to come

Modified Paths:
--------------
    scummvm/branches/gsoc2008-rtl/gui/launcher.cpp

Modified: scummvm/branches/gsoc2008-rtl/gui/launcher.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/gui/launcher.cpp	2008-08-14 06:15:18 UTC (rev 33856)
+++ scummvm/branches/gsoc2008-rtl/gui/launcher.cpp	2008-08-14 06:51:04 UTC (rev 33857)
@@ -29,6 +29,7 @@
 #include "common/events.h"
 #include "common/fs.h"
 #include "common/util.h"
+#include "common/savefile.h"
 #include "common/system.h"
 
 #include "gui/about.h"
@@ -936,6 +937,7 @@
 }
 
 void LauncherDialog::loadGame(int item) {
+	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
 	String gameId = ConfMan.get("gameid", _domains[item]);
 	if (gameId.empty())
 		gameId = _domains[item];
@@ -943,19 +945,27 @@
 	const EnginePlugin *plugin = 0;
 	GameDescriptor game = EngineMan.findGame(gameId, &plugin);
 
+	String description = _domains[item];
+	description.toLowercase();
+
 	int idx;
 	if (plugin) {
 		do {
 			_loadDialog->setList(generateSavegameList(item, plugin));
+			SaveStateList saveList = (*plugin)->listSaves(description.c_str());
 			idx = _loadDialog->runModal();
 			if (idx >= 0) {
 				// Delete the savegame
 				if (_loadDialog->delSave()) {
-					printf("Deleting slot: %d\n", idx);
+					String filename = saveList[idx].filename();
+					printf("Deleting file: %s\n", filename.c_str());
+					saveFileMan->removeSavefile(filename.c_str());
 				}
 				// Load the savegame
 				else {
-					ConfMan.setInt("save_slot", idx);
+					int slot = atoi(saveList[idx].save_slot().c_str());
+					printf("Loading slot: %d\n", slot);
+					ConfMan.setInt("save_slot", slot);
 					ConfMan.setActiveDomain(_domains[item]);
 					close();
 				}
@@ -969,10 +979,6 @@
 }
 
 Common::StringList LauncherDialog::generateSavegameList(int item, const EnginePlugin *plugin) {
-	String gameId = ConfMan.get("gameid", _domains[item]);
-	if (gameId.empty())
-		gameId = _domains[item];
-
 	String description = _domains[item];
 	description.toLowercase();
 	


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