From 4333fafe76ecbb1a53bcfeba108b6d9e3d626b9f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 22 Sep 2007 22:37:20 +0000 Subject: Fix for bug #1800276 - "IHNM: Problem in saving". A bug in the logic of the save slot allocation algorithm became apparent with the FS node merge. It should be working correctly now svn-id: r29031 --- engines/saga/saga.h | 3 +-- engines/saga/saveload.cpp | 8 ++------ 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'engines') diff --git a/engines/saga/saga.h b/engines/saga/saga.h index 8016fb9e65..eece1ee039 100644 --- a/engines/saga/saga.h +++ b/engines/saga/saga.h @@ -517,7 +517,7 @@ public: uint getNewSaveSlotNumber(); bool locateSaveFile(char *saveName, uint &titleNumber); bool isSaveListFull() const { - return _saveFilesMaxCount == _saveFilesCount; + return _saveFilesCount == MAX_SAVES; } uint getSaveFilesCount() const { return isSaveListFull() ? _saveFilesCount : _saveFilesCount + 1; @@ -611,7 +611,6 @@ public: } private: - uint _saveFilesMaxCount; uint _saveFilesCount; SaveFileData _saveFiles[MAX_SAVES]; bool _saveMarks[MAX_SAVES]; diff --git a/engines/saga/saveload.cpp b/engines/saga/saveload.cpp index b73a6fae28..e37479e80e 100644 --- a/engines/saga/saveload.cpp +++ b/engines/saga/saveload.cpp @@ -59,7 +59,7 @@ char* SagaEngine::calcSaveFileName(uint slotNumber) { } SaveFileData *SagaEngine::getSaveFile(uint idx) { - if (idx >= _saveFilesMaxCount) { + if (idx >= MAX_SAVES) { error("getSaveFileName wrong idx"); } if (isSaveListFull()) { @@ -94,7 +94,7 @@ uint SagaEngine::getNewSaveSlotNumber() { error("getNewSaveSlotNumber save list is full"); } for (i = 0; i < MAX_SAVES; i++) { - if (_saveMarks[i]) { + if (!_saveMarks[i]) { found = false; for (j = 0; j < _saveFilesCount; j++) { if (_saveFiles[j].slotNumber == i) { @@ -138,11 +138,7 @@ void SagaEngine::fillSaveList() { _saveMarks[slotNum] = true; //mark this slot as valid } - _saveFilesMaxCount = 0; for (i = 0; i < MAX_SAVES; i++) { - if (_saveMarks[i]) { - _saveFilesMaxCount++; - } _saveFiles[i].name[0] = 0; _saveFiles[i].slotNumber = (uint)-1; } -- cgit v1.2.3