Use the save file manager's listSavefiles() function to find out if any savegames

exist at all. (The old method was to potentially try and open a hundred files,
though it would stop after finding the first one.)

svn-id: r34790
This commit is contained in:
Torbjörn Andersson 2008-10-13 04:24:18 +00:00
parent 4a56e0d9c1
commit dc75da4348

View file

@ -388,15 +388,14 @@ uint32 Sword2Engine::getSaveDescription(uint16 slotNo, byte *description) {
}
bool Sword2Engine::saveExists() {
for (int i = 0; i <= 99; i++)
if (saveExists(i))
return true;
return false;
Common::String pattern = _targetName + ".???";
Common::StringList filenames = _saveFileMan->listSavefiles(pattern.c_str());
return !filenames.empty();
}
bool Sword2Engine::saveExists(uint16 slotNo) {
char *saveFileName = getSaveFileName(slotNo);
Common::InSaveFile *in;
if (!(in = _saveFileMan->openForLoading(saveFileName))) {