[Scummvm-git-logs] scummvm master -> 8ad496fe523121c871b6694d0ebed745fa6a8ed3
bgK
bastien.bouclet at gmail.com
Thu Apr 16 05:19:16 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8ad496fe52 MOHAWK: MYST: Use the shared save/load dialog code
Commit: 8ad496fe523121c871b6694d0ebed745fa6a8ed3
https://github.com/scummvm/scummvm/commit/8ad496fe523121c871b6694d0ebed745fa6a8ed3
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2020-04-16T07:18:34+02:00
Commit Message:
MOHAWK: MYST: Use the shared save/load dialog code
Changed paths:
engines/mohawk/myst.cpp
engines/mohawk/myst.h
engines/mohawk/myst_stacks/menu.cpp
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index 151b5c3627..cdde287c8d 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -752,12 +752,12 @@ void MohawkEngine_Myst::doAction(MystEventAction action) {
break;
case kMystActionLoadGameState:
if (canLoadGameStateCurrently()) {
- runLoadDialog();
+ loadGameDialog();
}
break;
case kMystActionSaveGameState:
if (canSaveGameStateCurrently()) {
- runSaveDialog();
+ saveGameDialog();
}
break;
case kMystActionDropPage:
@@ -1065,7 +1065,7 @@ bool MohawkEngine_Myst::isInteractive() const {
}
bool MohawkEngine_Myst::canLoadGameStateCurrently() {
- bool isInMenu = (_stack->getStackId() == kMenuStack) && _prevStack;
+ bool isInMenu = _stack->getStackId() == kMenuStack;
if (!isInMenu) {
if (!isInteractive()) {
@@ -1106,36 +1106,6 @@ bool MohawkEngine_Myst::canSaveGameStateCurrently() {
}
}
-void MohawkEngine_Myst::runLoadDialog() {
- GUI::SaveLoadChooser slc(_("Load game:"), _("Load"), false);
-
- pauseEngine(true);
- int slot = slc.runModalWithCurrentTarget();
- pauseEngine(false);
-
- if (slot >= 0) {
- loadGameState(slot);
- }
-}
-
-void MohawkEngine_Myst::runSaveDialog() {
- GUI::SaveLoadChooser slc(_("Save game:"), _("Save"), true);
-
- pauseEngine(true);
- int slot = slc.runModalWithCurrentTarget();
- pauseEngine(false);
-
- if (slot >= 0) {
- Common::String result(slc.getResultString());
- if (result.empty()) {
- // If the user was lazy and entered no save name, come up with a default name.
- result = slc.createDefaultSaveDescription(slot);
- }
-
- saveGameState(slot, result);
- }
-}
-
void MohawkEngine_Myst::dropPage() {
HeldPage page = _gameState->_globals.heldPage;
bool whitePage = page == kWhitePage;
diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h
index eb19587d9d..150ea6221a 100644
--- a/engines/mohawk/myst.h
+++ b/engines/mohawk/myst.h
@@ -203,8 +203,6 @@ public:
void resumeFromMainMenu();
- void runLoadDialog();
- void runSaveDialog();
void runOptionsDialog();
void runCredits();
diff --git a/engines/mohawk/myst_stacks/menu.cpp b/engines/mohawk/myst_stacks/menu.cpp
index e83a05e0cd..45c5fdf1c7 100644
--- a/engines/mohawk/myst_stacks/menu.cpp
+++ b/engines/mohawk/myst_stacks/menu.cpp
@@ -285,7 +285,7 @@ void Menu::o_menuLoad(uint16 var, const ArgumentsArray &args) {
return;
}
- _vm->runLoadDialog();
+ _vm->loadGameDialog();
}
void Menu::o_menuSave(uint16 var, const ArgumentsArray &args) {
@@ -293,7 +293,7 @@ void Menu::o_menuSave(uint16 var, const ArgumentsArray &args) {
return;
}
- _vm->runSaveDialog();
+ _vm->saveGameDialog();
}
void Menu::o_menuNew(uint16 var, const ArgumentsArray &args) {
More information about the Scummvm-git-logs
mailing list