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
This commit is contained in:
Filippos Karapetis 2007-09-22 22:37:20 +00:00
parent b93e906285
commit 4333fafe76
2 changed files with 3 additions and 8 deletions

View file

@ -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];

View file

@ -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;
}