KYRA: Cleanup listing of actual save slots in GUI::updateSaveFileList.

This commit is contained in:
Johannes Schickel 2016-01-26 16:54:57 +01:00
parent b2ab29587b
commit a74341508f

View File

@ -47,23 +47,16 @@ GUI::~GUI() {
}
void GUI::updateSaveFileList(Common::String targetName, bool excludeQuickSaves) {
Common::String pattern = targetName + ".???";
Common::String pattern = targetName + ".###";
Common::StringArray saveFileList = _vm->_saveFileMan->listSavefiles(pattern);
_saveSlots.clear();
for (Common::StringArray::const_iterator i = saveFileList.begin(); i != saveFileList.end(); ++i) {
char s1 = 0, s2 = 0, s3 = 0;
s1 = (*i)[i->size() - 3];
s2 = (*i)[i->size() - 2];
s3 = (*i)[i->size() - 1];
if (!Common::isDigit(s1) || !Common::isDigit(s2) || !Common::isDigit(s3))
// The last 3 digits of the filename correspond to the save slot.
const int slotNum = atoi(i->c_str() + i->size() - 3);
if (excludeQuickSaves && slotNum >= 990)
continue;
s1 -= '0';
s2 -= '0';
s3 -= '0';
if (excludeQuickSaves && s1 == 9 && s2 == 9)
continue;
_saveSlots.push_back(s1 * 100 + s2 * 10 + s3);
_saveSlots.push_back(slotNum);
}
if (_saveSlots.begin() == _saveSlots.end())