diff options
Diffstat (limited to 'gui/saveload-dialog.cpp')
-rw-r--r-- | gui/saveload-dialog.cpp | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp index c7dd62b6c6..a333c5fe57 100644 --- a/gui/saveload-dialog.cpp +++ b/gui/saveload-dialog.cpp @@ -17,6 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * */ #include "gui/saveload-dialog.h" @@ -91,7 +92,7 @@ void SaveLoadChooserDialog::open() { Dialog::open(); // So that quitting ScummVM will not cause the dialog result to say a - // savegame was selected. + // saved game was selected. setResult(-1); } @@ -271,7 +272,7 @@ void SaveLoadChooserSimple::handleCommand(CommandSender *sender, uint32 cmd, uin break; case kDelCmd: if (selItem >= 0 && _delSupport) { - MessageDialog alert(_("Do you really want to delete this savegame?"), + MessageDialog alert(_("Do you really want to delete this saved game?"), _("Delete"), _("Cancel")); if (alert.runModal() == kMessageOK) { _metaEngine->removeSaveState(_target.c_str(), _saveList[selItem].getSaveSlot()); @@ -286,6 +287,7 @@ void SaveLoadChooserSimple::handleCommand(CommandSender *sender, uint32 cmd, uin break; case kCloseCmd: setResult(-1); + // Fall through default: SaveLoadChooserDialog::handleCommand(sender, cmd, data); } @@ -486,7 +488,7 @@ void SaveLoadChooserSimple::updateSaveList() { } } - // Show "Untitled savestate" for empty/whitespace savegame descriptions + // Show "Untitled savestate" for empty/whitespace saved game descriptions Common::String description = x->getDescription(); Common::String trimmedDescription = description; trimmedDescription.trim(); @@ -595,6 +597,7 @@ void SaveLoadChooserGrid::handleCommand(CommandSender *sender, uint32 cmd, uint3 case kCloseCmd: setResult(-1); + // Fall through default: SaveLoadChooserDialog::handleCommand(sender, cmd, data); } @@ -651,16 +654,25 @@ void SaveLoadChooserGrid::open() { // In case there was a gap found use the slot. if (lastSlot + 1 < curSlot) { - _nextFreeSaveSlot = lastSlot + 1; - break; + // Check that the save slot can be used for user saves. + SaveStateDescriptor desc = _metaEngine->querySaveMetaInfos(_target.c_str(), lastSlot + 1); + if (!desc.getWriteProtectedFlag()) { + _nextFreeSaveSlot = lastSlot + 1; + break; + } } lastSlot = curSlot; } // Use the next available slot otherwise. - if (_nextFreeSaveSlot == -1 && lastSlot + 1 < _metaEngine->getMaximumSaveSlot()) { - _nextFreeSaveSlot = lastSlot + 1; + const int maxSlot = _metaEngine->getMaximumSaveSlot(); + for (int i = lastSlot; _nextFreeSaveSlot == -1 && i < maxSlot; ++i) { + // Check that the save slot can be used for user saves. + SaveStateDescriptor desc = _metaEngine->querySaveMetaInfos(_target.c_str(), i + 1); + if (!desc.getWriteProtectedFlag()) { + _nextFreeSaveSlot = i + 1; + } } } |