aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Kiehl2003-09-14 21:45:42 +0000
committerOliver Kiehl2003-09-14 21:45:42 +0000
commitffd39dc95aacfa34d669b469fae9e8ff9946d4ee (patch)
treec65750587bb82c8098b96cc37e902115165224ed
parentfe349d2d998a939c7f258d3a28cf00a148bb6225 (diff)
downloadscummvm-rg350-ffd39dc95aacfa34d669b469fae9e8ff9946d4ee.tar.gz
scummvm-rg350-ffd39dc95aacfa34d669b469fae9e8ff9946d4ee.tar.bz2
scummvm-rg350-ffd39dc95aacfa34d669b469fae9e8ff9946d4ee.zip
if saveslot specified with -x doesn't exist, show restore menu
svn-id: r10256
-rw-r--r--sword2/save_rest.cpp13
-rw-r--r--sword2/save_rest.h1
-rw-r--r--sword2/sword2.cpp13
3 files changed, 23 insertions, 4 deletions
diff --git a/sword2/save_rest.cpp b/sword2/save_rest.cpp
index 09196003b3..ace08bb79e 100644
--- a/sword2/save_rest.cpp
+++ b/sword2/save_rest.cpp
@@ -468,6 +468,19 @@ uint32 GetSaveDescription(uint16 slotNo, uint8 *description) // (James05feb97)
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
diff --git a/sword2/save_rest.h b/sword2/save_rest.h
index b59c52fe45..1d06b998cd 100644
--- a/sword2/save_rest.h
+++ b/sword2/save_rest.h
@@ -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 );
diff --git a/sword2/sword2.cpp b/sword2/sword2.cpp
index 1f5a1d8af3..be35ccb59a 100644
--- a/sword2/sword2.cpp
+++ b/sword2/sword2.cpp
@@ -310,10 +310,15 @@ void Sword2State::go()
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();