[Scummvm-cvs-logs] scummvm master -> c10cda236b10d817ba1bb098d2c43dda91b1775c
Kirben
kirben at optusnet.com.au
Tue Mar 4 10:02:10 CET 2014
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c10cda236b AGOS: Remove duplicate file opens, when counting saved games.
Commit: c10cda236b10d817ba1bb098d2c43dda91b1775c
https://github.com/scummvm/scummvm/commit/c10cda236b10d817ba1bb098d2c43dda91b1775c
Author: Kirben (kirben at optusnet.com.au)
Date: 2014-03-04T01:01:36-08:00
Commit Message:
AGOS: Remove duplicate file opens, when counting saved games.
Changed paths:
engines/agos/saveload.cpp
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp
index 2bb459d..5d5e2d7 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/saveload.cpp
@@ -37,9 +37,8 @@ namespace AGOS {
// FIXME: This code counts savegames, but callers in many cases assume
// that the return value + 1 indicates an empty slot.
int AGOSEngine::countSaveGames() {
- Common::InSaveFile *f = NULL;
Common::StringArray filenames;
- uint i = 1;
+ uint s, numSaveGames = 1;
int slotNum;
bool marks[256];
@@ -60,18 +59,13 @@ int AGOSEngine::countSaveGames() {
marks[slotNum] = true; //mark this slot as valid
}
- // FIXME: Why does this already try to actually open the savegames?
- // Historical accident?
- while (i < 256) {
- if (marks[i] &&
- (f = _saveFileMan->openForLoading(genSaveName(i)))) {
- i++;
- delete f;
- } else
- break;
+ // locate first empty slot
+ for (s = 1; s < 256; s++) {
+ if (marks[s])
+ numSaveGames++;
}
- return i;
+ return numSaveGames;
}
#ifdef ENABLE_AGOS2
More information about the Scummvm-git-logs
mailing list