diff options
author | Andrew Kurushin | 2007-09-23 15:53:49 +0000 |
---|---|---|
committer | Andrew Kurushin | 2007-09-23 15:53:49 +0000 |
commit | f50e162c252813dfe020143101427ecb266fbb26 (patch) | |
tree | 5fe26858bf0aedc70cd2e8ac8795bfc64c62c334 /engines | |
parent | c4ad96b91e5e64cf74875d5af6dcb905e07361ea (diff) | |
download | scummvm-rg350-f50e162c252813dfe020143101427ecb266fbb26.tar.gz scummvm-rg350-f50e162c252813dfe020143101427ecb266fbb26.tar.bz2 scummvm-rg350-f50e162c252813dfe020143101427ecb266fbb26.zip |
remove _saveMarks from SAGA load and save implementation
svn-id: r29053
Diffstat (limited to 'engines')
-rw-r--r-- | engines/saga/saga.h | 1 | ||||
-rw-r--r-- | engines/saga/saveload.cpp | 50 |
2 files changed, 18 insertions, 33 deletions
diff --git a/engines/saga/saga.h b/engines/saga/saga.h index 705213d84f..7a8b30b068 100644 --- a/engines/saga/saga.h +++ b/engines/saga/saga.h @@ -616,7 +616,6 @@ public: private: uint _saveFilesCount; SaveFileData _saveFiles[MAX_SAVES]; - bool _saveMarks[MAX_SAVES]; SaveGameHeader _saveHeader; bool _leftMouseButtonPressed; diff --git a/engines/saga/saveload.cpp b/engines/saga/saveload.cpp index e37479e80e..c68846242b 100644 --- a/engines/saga/saveload.cpp +++ b/engines/saga/saveload.cpp @@ -90,54 +90,37 @@ bool SagaEngine::locateSaveFile(char *saveName, uint &titleNumber) { uint SagaEngine::getNewSaveSlotNumber() { uint i, j; bool found; - if (isSaveListFull()) { - error("getNewSaveSlotNumber save list is full"); - } for (i = 0; i < MAX_SAVES; i++) { - if (!_saveMarks[i]) { - found = false; - for (j = 0; j < _saveFilesCount; j++) { - if (_saveFiles[j].slotNumber == i) { - found = true; - break; - } - } - if (!found) { - return i; + found = false; + for (j = 0; j < _saveFilesCount; j++) { + if (_saveFiles[j].slotNumber == i) { + found = true; + break; } } + if (!found) { + return i; + } } error("getNewSaveSlotNumber save list is full"); } void SagaEngine::fillSaveList() { - assert(_saveMarks); int i; Common::InSaveFile *in; Common::StringList filenames; char slot[2]; - int slotNum; + int slotNumber; char *name; name = calcSaveFileName(MAX_SAVES); name[strlen(name) - 2] = '*'; name[strlen(name) - 1] = 0; - memset(_saveMarks, false, MAX_SAVES * sizeof(bool)); //assume no savegames for this title filenames = _saveFileMan->listSavefiles(name); - for (Common::StringList::iterator file = filenames.begin(); file != filenames.end(); file++){ - //Obtain the last 2 digits of the filename, since they correspond to the save slot - slot[0] = file->c_str()[file->size()-2]; - slot[1] = file->c_str()[file->size()-1]; - - slotNum = atoi(slot); - if (slotNum >= 0 && slotNum < MAX_SAVES) - _saveMarks[slotNum] = true; //mark this slot as valid - } - for (i = 0; i < MAX_SAVES; i++) { _saveFiles[i].name[0] = 0; _saveFiles[i].slotNumber = (uint)-1; @@ -145,10 +128,14 @@ void SagaEngine::fillSaveList() { _saveFilesCount = 0; - i = 0; - while (i < MAX_SAVES) { - if (_saveMarks[i]) { - name = calcSaveFileName(i); + for (Common::StringList::iterator file = filenames.begin(); file != filenames.end(); file++){ + //Obtain the last 2 digits of the filename, since they correspond to the save slot + slot[0] = file->c_str()[file->size()-2]; + slot[1] = file->c_str()[file->size()-1]; + + slotNumber = atoi(slot); + if (slotNumber >= 0 && slotNumber < MAX_SAVES) { + name = calcSaveFileName(slotNumber); if ((in = _saveFileMan->openForLoading(name)) != NULL) { _saveHeader.type = in->readUint32BE(); _saveHeader.size = in->readUint32LE(); @@ -161,12 +148,11 @@ void SagaEngine::fillSaveList() { continue; } strcpy(_saveFiles[_saveFilesCount].name, _saveHeader.name); - _saveFiles[_saveFilesCount].slotNumber = i; + _saveFiles[_saveFilesCount].slotNumber = slotNumber; delete in; _saveFilesCount++; } } - i++; } } |