ENGINES: Fix listSaves for 3-digit savegame patterns

This commit is contained in:
Orgad Shaneh 2021-12-10 15:36:53 +02:00 committed by Filippos Karapetis
parent c515216cd3
commit e96a72ae87

View file

@ -333,8 +333,12 @@ SaveStateList MetaEngine::listSaves(const char *target) const {
SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 2 digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + file->size() - 2);
// Obtain the last 2/3 digits of the filename, since they correspond to the save slot
const char *slotStr = file->c_str() + file->size() - 2;
const char *prev = slotStr - 1;
if (*prev >= '0' && *prev <= '9')
slotStr = prev;
int slotNum = atoi(slotStr);
if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) {
SaveStateDescriptor desc = querySaveMetaInfos(target, slotNum);