diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sherlock/saveload.cpp | 6 | ||||
-rw-r--r-- | engines/sherlock/saveload.h | 5 | ||||
-rw-r--r-- | engines/sherlock/user_interface.cpp | 2 |
3 files changed, 11 insertions, 2 deletions
diff --git a/engines/sherlock/saveload.cpp b/engines/sherlock/saveload.cpp index c13d6dd9ee..077df7494f 100644 --- a/engines/sherlock/saveload.cpp +++ b/engines/sherlock/saveload.cpp @@ -401,7 +401,7 @@ bool SaveManager::promptForDescription(int slot) { screen.buttonPrint(Common::Point(ENV_POINTS[5][2], CONTROLS_Y), COMMAND_NULL, true, "Quit"); Common::String saveName = _savegames[slot]; - if (saveName.equalsIgnoreCase(EMPTY_SAVEGAME_SLOT)) { + if (isSlotEmpty(slot)) { // It's an empty slot, so start off with an empty save name saveName = ""; @@ -477,4 +477,8 @@ bool SaveManager::promptForDescription(int slot) { return done == 1; } +bool SaveManager::isSlotEmpty(int slot) const { + return _savegames[slot].equalsIgnoreCase(EMPTY_SAVEGAME_SLOT); +} + } // End of namespace Sherlock diff --git a/engines/sherlock/saveload.h b/engines/sherlock/saveload.h index 066d983b26..a7ed852a5f 100644 --- a/engines/sherlock/saveload.h +++ b/engines/sherlock/saveload.h @@ -135,6 +135,11 @@ public: * Prompts the user to enter a description in a given slot */ bool promptForDescription(int slot); + + /** + * Returns true if the given save slot is empty + */ + bool isSlotEmpty(int slot) const; }; } // End of namespace Sherlock diff --git a/engines/sherlock/user_interface.cpp b/engines/sherlock/user_interface.cpp index 4781f4811b..524ecf3d2f 100644 --- a/engines/sherlock/user_interface.cpp +++ b/engines/sherlock/user_interface.cpp @@ -946,7 +946,7 @@ void UserInterface::doEnvControl() { // Are we already in Load mode? if (saves._envMode == SAVEMODE_LOAD) { saves.loadGame(_selector + 1); - } else if (saves._envMode == SAVEMODE_SAVE || _selector == MAX_SAVEGAME_SLOTS) { + } else if (saves._envMode == SAVEMODE_SAVE || saves.isSlotEmpty(_selector)) { // We're already in save mode, or pointing to an empty save slot if (saves.checkGameOnScreen(_selector)) _oldSelector = _selector; |