From d4d072fe0484918b6caf4571b933a9b374177e5b Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 28 Dec 2007 07:37:04 +0000 Subject: Patch #1857121: Refactoring of the getSavePath method svn-id: r30032 --- engines/sky/control.cpp | 8 ++++---- engines/sword1/control.cpp | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'engines') diff --git a/engines/sky/control.cpp b/engines/sky/control.cpp index ee8fee9ee8..eaea67e918 100644 --- a/engines/sky/control.cpp +++ b/engines/sky/control.cpp @@ -944,7 +944,7 @@ uint16 Control::saveRestorePanel(bool allowSave) { refreshNames = true; } if (clickRes == NO_DISK_SPACE) { - displayMessage(0, "Could not save game in directory '%s'", _saveFileMan->getSavePath()); + displayMessage(0, "Could not save the game. (%s)", _saveFileMan->popErrorDesc().c_str()); quitPanel = true; } if ((clickRes == CANCEL_PRESSED) || (clickRes == GAME_RESTORED)) @@ -1153,7 +1153,7 @@ void Control::saveDescriptions(uint8 *srcBuf) { delete outf; } if (ioFailed) - displayMessage(NULL, "Unable to store Savegame names to file SKY-VM.SAV in directory %s", _saveFileMan->getSavePath()); + displayMessage(NULL, "Unable to store Savegame names to file SKY-VM.SAV. (%s)", _saveFileMan->popErrorDesc().c_str()); free(tmpBuf); } @@ -1167,7 +1167,7 @@ void Control::doAutoSave(void) { outf = _saveFileMan->openForSaving(fName); if (outf == NULL) { - displayMessage(0, "Unable to create autosave file '%s' in directory '%s'", fName, _saveFileMan->getSavePath()); + displayMessage(0, "Unable to create autosave file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str()); return; } uint8 *saveData = (uint8 *)malloc(0x20000); @@ -1177,7 +1177,7 @@ void Control::doAutoSave(void) { outf->finalize(); if (outf->ioFailed()) - displayMessage(0, "Unable to write autosave file '%s' in directory '%s'. Disk full?", fName, _saveFileMan->getSavePath()); + displayMessage(0, "Unable to write autosave file '%s'. Disk full?", fName, _saveFileMan->popErrorDesc().c_str()); delete outf; free(saveData); diff --git a/engines/sword1/control.cpp b/engines/sword1/control.cpp index 10097c0a1f..0ac32162b0 100644 --- a/engines/sword1/control.cpp +++ b/engines/sword1/control.cpp @@ -738,7 +738,7 @@ void Control::writeSavegameDescriptions(void) { if (!outf) { // Display an error message, and do nothing - displayMessage(0, "Can't create SAVEGAME.INF in directory '%s'", _saveFileMan->getSavePath()); + displayMessage(0, "Can't create SAVEGAME.INF. (%s)", _saveFileMan->popErrorDesc().c_str()); return; } @@ -757,7 +757,7 @@ void Control::writeSavegameDescriptions(void) { } outf->finalize(); if (outf->ioFailed()) - displayMessage(0, "Can't write to SAVEGAME.INF in directory '%s'. Device full?", _saveFileMan->getSavePath()); + displayMessage(0, "Can't write to SAVEGAME.INF. Device full? (%s)", _saveFileMan->popErrorDesc().c_str()); delete outf; } @@ -928,7 +928,7 @@ void Control::saveGameToFile(uint8 slot) { outf = _saveFileMan->openForSaving(fName); if (!outf) { // Display an error message and do nothing - displayMessage(0, "Unable to create file '%s' in directory '%s'", fName, _saveFileMan->getSavePath()); + displayMessage(0, "Unable to create file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str()); return; } @@ -952,7 +952,7 @@ void Control::saveGameToFile(uint8 slot) { outf->writeUint32LE(playerRaw[cnt2]); outf->finalize(); if (outf->ioFailed()) - displayMessage(0, "Couldn't write to file '%s' in directory '%s'. Device full?", fName, _saveFileMan->getSavePath()); + displayMessage(0, "Couldn't write to file '%s'. Device full? (%s)", fName, _saveFileMan->popErrorDesc().c_str()); delete outf; } @@ -964,7 +964,7 @@ bool Control::restoreGameFromFile(uint8 slot) { inf = _saveFileMan->openForLoading(fName); if (!inf) { // Display an error message, and do nothing - displayMessage(0, "Can't open file '%s' in directory '%s'", fName, _saveFileMan->getSavePath()); + displayMessage(0, "Can't open file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str()); return false; } @@ -988,7 +988,7 @@ bool Control::restoreGameFromFile(uint8 slot) { playerBuf[cnt2] = inf->readUint32LE(); if (inf->ioFailed()) { - displayMessage(0, "Can't read from file '%s' in directory '%s'", fName, _saveFileMan->getSavePath()); + displayMessage(0, "Can't read from file '%s'. (%s)", fName, _saveFileMan->popErrorDesc().c_str()); delete inf; free(_restoreBuf); _restoreBuf = NULL; -- cgit v1.2.3