[Scummvm-cvs-logs] CVS: scummvm/bs2 save_rest.cpp,1.13,1.14 save_rest.h,1.1,1.2 sword2.cpp,1.27,1.28

Oliver Kiehl olki at users.sourceforge.net
Sun Sep 14 14:46:05 CEST 2003


Update of /cvsroot/scummvm/scummvm/bs2
In directory sc8-pr-cvs1:/tmp/cvs-serv2258

Modified Files:
	save_rest.cpp save_rest.h sword2.cpp 
Log Message:
if saveslot specified with -x doesn't exist, show restore menu


Index: save_rest.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/save_rest.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- save_rest.cpp	13 Sep 2003 21:20:05 -0000	1.13
+++ save_rest.cpp	14 Sep 2003 21:45:42 -0000	1.14
@@ -468,6 +468,19 @@
 	return(SR_OK);
 }
 
+bool SaveExists(uint16 slotNo) {
+	char saveFileName[MAX_FILENAME_LEN];
+	SaveFileManager *mgr = g_system->get_savefile_manager();
+
+	sprintf(saveFileName, "%s.%.3d", g_sword2->_game_name, slotNo);	// construct filename
+
+	if (!(mgr->open_savefile(saveFileName, g_sword2->getSavePath(), false)))
+		return(false);
+	delete mgr;
+
+	return(true);
+}
+
 //------------------------------------------------------------------------------------
 //------------------------------------------------------------------------------------
 void GetPlayerStructures(void)		// James27feb97

Index: save_rest.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/save_rest.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- save_rest.h	28 Jul 2003 01:44:38 -0000	1.1
+++ save_rest.h	14 Sep 2003 21:45:42 -0000	1.2
@@ -29,6 +29,7 @@
 uint32	SaveGame(uint16 slotNo, uint8 *description);
 uint32	RestoreGame(uint16 slotNo);
 uint32	GetSaveDescription(uint16 slotNo, uint8 *description);
+bool	SaveExists(uint16 slotNo);
 void	FillSaveBuffer(mem *buffer, uint32 size, uint8 *desc);
 uint32	RestoreFromBuffer(mem *buffer, uint32 size);
 uint32	FindBufferSize( void );

Index: sword2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/sword2.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- sword2.cpp	14 Sep 2003 21:10:14 -0000	1.27
+++ sword2.cpp	14 Sep 2003 21:45:42 -0000	1.28
@@ -310,10 +310,15 @@
    	Zdebug("RETURNED from InitialiseGame - ok");
 
 
-
-	if (_saveSlot != -1)
-		RestoreGame(_saveSlot);
-	else
+	if (_saveSlot != -1) {
+		if (SaveExists(_saveSlot))
+			RestoreGame(_saveSlot);
+		else { // show restore menu
+			Set_mouse(NORMAL_MOUSE_ID);
+			if (!Restore_control())
+				Start_game();
+		}
+	} else
 		Start_game();
 
 





More information about the Scummvm-git-logs mailing list