aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/dm/dm.h2
-rw-r--r--engines/dm/loadsave.cpp14
2 files changed, 11 insertions, 5 deletions
diff --git a/engines/dm/dm.h b/engines/dm/dm.h
index d90943b764..edc54c17b3 100644
--- a/engines/dm/dm.h
+++ b/engines/dm/dm.h
@@ -209,7 +209,7 @@ class DMEngine : public Engine {
void initArrays();
Common::String getSavefileName(uint16 slot);
void writeSaveGameHeader(Common::OutSaveFile *out, const Common::String &saveName);
- void writeCompleteSaveFile(int16 slot, Common::String &desc, int16 saveAndPlayChoice);
+ bool writeCompleteSaveFile(int16 slot, Common::String &desc, int16 saveAndPlayChoice);
void f439_drawEntrance(); // @ F0439_STARTEND_DrawEntrance
public:
explicit DMEngine(OSystem *syst, const ADGameDescription *gameDesc);
diff --git a/engines/dm/loadsave.cpp b/engines/dm/loadsave.cpp
index 02f1a8088e..a84a0b6624 100644
--- a/engines/dm/loadsave.cpp
+++ b/engines/dm/loadsave.cpp
@@ -240,7 +240,10 @@ void DMEngine::f433_processCommand140_saveGame() {
_championMan->_gK71_champions[_championMan->_g411_leaderIndex]._load -= champHandObjWeight;
}
- writeCompleteSaveFile(saveSlot, saveDescription, saveAndPlayChoice);
+ if (!writeCompleteSaveFile(saveSlot, saveDescription, saveAndPlayChoice)) {
+ _dialog->f427_dialogDraw(nullptr, "Unable to open file for saving", "OK", nullptr, nullptr, nullptr, false, false, false);
+ _dialog->f424_dialogGetChoice(1, k0_DIALOG_SET_VIEWPORT, 0, k0_DIALOG_CHOICE_NONE);
+ }
if (!_championMan->_g415_leaderEmptyHanded) {
_championMan->_gK71_champions[_championMan->_g411_leaderIndex]._load += champHandObjWeight;
@@ -296,13 +299,14 @@ void DMEngine::writeSaveGameHeader(Common::OutSaveFile* out, const Common::Strin
out->writeUint32BE(playTime);
}
-void DMEngine::writeCompleteSaveFile(int16 saveSlot, Common::String& saveDescription, int16 saveAndPlayChoice) {
+bool DMEngine::writeCompleteSaveFile(int16 saveSlot, Common::String& saveDescription, int16 saveAndPlayChoice) {
Common::String savefileName = getSavefileName(saveSlot);
Common::SaveFileManager *saveFileManager = _system->getSavefileManager();
Common::OutSaveFile *file = saveFileManager->openForSaving(savefileName);
- if (!file)
- return; // TODO: silent fail
+ if (!file) {
+ return false;
+ }
writeSaveGameHeader(file, saveDescription);
@@ -409,6 +413,8 @@ void DMEngine::writeCompleteSaveFile(int16 saveSlot, Common::String& saveDescrip
file->flush();
file->finalize();
delete file;
+
+ return true;
}
bool readSaveGameHeader(Common::InSaveFile* in, SaveGameHeader* header) {