if saveslot specified with -x doesn't exist, show restore menu

svn-id: r10256
This commit is contained in:
Oliver Kiehl 2003-09-14 21:45:42 +00:00
parent fe349d2d99
commit ffd39dc95a
3 changed files with 23 additions and 4 deletions

View File

@ -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

View File

@ -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 );

View File

@ -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();