diff options
author | Joseph-Eugene Winzer | 2017-08-31 20:53:18 +0200 |
---|---|---|
committer | Thierry Crozat | 2018-01-23 02:14:56 +0000 |
commit | 749fa6336e97ade41bfb846d35115ed2db7c4141 (patch) | |
tree | cbadb5a75a70fbd33fa6827db3430cee1b27ab2e /engines | |
parent | 23f57ca83fac453afd9f04b619717cc9ddd03a75 (diff) | |
download | scummvm-rg350-749fa6336e97ade41bfb846d35115ed2db7c4141.tar.gz scummvm-rg350-749fa6336e97ade41bfb846d35115ed2db7c4141.tar.bz2 scummvm-rg350-749fa6336e97ade41bfb846d35115ed2db7c4141.zip |
SUPERNOVA: Fixes save/load dialog
Diffstat (limited to 'engines')
-rw-r--r-- | engines/supernova/supernova.cpp | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index 19cec43920..6371f6c84a 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -806,23 +806,18 @@ Common::Error SupernovaEngine::saveGameState(int slot, const Common::String &des } bool SupernovaEngine::loadGame(int slot) { - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Load game:", "Load:", false); - int loadGameSlot = dialog->runModalWithCurrentTarget(); - delete dialog; - - if (loadGameSlot < 0) + if (slot < 0) return false; - Common::String filename = Common::String::format("msn_save.%03d", loadGameSlot); -// Common::InSaveFile *savefile = _saveFileMan->openForLoading(filename); - Common::InSaveFile *savefile = _saveFileMan->openRawFile(filename); + Common::String filename = Common::String::format("msn_save.%03d", slot); + Common::InSaveFile *savefile = _saveFileMan->openForLoading(filename); if (!savefile) return false; int descriptionSize = savefile->readSint16LE(); savefile->skip(descriptionSize); savefile->skip(6); -// Graphics::skipThumbnail(*savefile); + Graphics::skipThumbnail(*savefile); _gm->deserialize(savefile); delete savefile; @@ -831,16 +826,11 @@ bool SupernovaEngine::loadGame(int slot) { } bool SupernovaEngine::saveGame(int slot, const Common::String &description) { - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save", true); - int saveGameSlot = dialog->runModalWithCurrentTarget(); - Common::String saveGameDescription = dialog->getResultString(); - delete dialog; - - if (saveGameSlot < 0) + if (slot < 0) return false; - Common::String filename = Common::String::format("msn_save.%03d", saveGameSlot); - Common::OutSaveFile *savefile = _saveFileMan->openForSaving(filename, false); + Common::String filename = Common::String::format("msn_save.%03d", slot); + Common::OutSaveFile *savefile = _saveFileMan->openForSaving(filename); if (!savefile) return false; @@ -849,11 +839,11 @@ bool SupernovaEngine::saveGame(int slot, const Common::String &description) { uint32 saveDate = (currentDate.tm_mday & 0xFF) << 24 | ((currentDate.tm_mon + 1) & 0xFF) << 16 | ((currentDate.tm_year + 1900) & 0xFFFF); uint16 saveTime = (currentDate.tm_hour & 0xFF) << 8 | ((currentDate.tm_min) & 0xFF); - savefile->writeSint16LE(saveGameDescription.size() + 1); - savefile->write(saveGameDescription.c_str(), saveGameDescription.size() + 1); + savefile->writeSint16LE(description.size() + 1); + savefile->write(description.c_str(), description.size() + 1); savefile->writeUint32LE(saveDate); savefile->writeUint16LE(saveTime); -// Graphics::saveThumbnail(*savefile); + Graphics::saveThumbnail(*savefile); _gm->serialize(savefile); savefile->finalize(); |