aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBastien Bouclet2018-06-21 21:28:22 +0200
committerBastien Bouclet2018-06-29 13:31:54 +0200
commit6759346bb6a81d9dd71f75c2f96aaefd673981d0 (patch)
tree24ac0ef94325b2f987baa138071e68fa9e028a7d /engines
parente7cb40dde57f5331db014eb61ff115baa7917148 (diff)
downloadscummvm-rg350-6759346bb6a81d9dd71f75c2f96aaefd673981d0.tar.gz
scummvm-rg350-6759346bb6a81d9dd71f75c2f96aaefd673981d0.tar.bz2
scummvm-rg350-6759346bb6a81d9dd71f75c2f96aaefd673981d0.zip
MOHAWK: RIVEN: Show confirmation dialogs on the main menu
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/riven_stacks/aspit.cpp25
-rw-r--r--engines/mohawk/riven_stacks/aspit.h1
2 files changed, 26 insertions, 0 deletions
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index eb03ac82f0..7ae1c47b24 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -379,6 +379,11 @@ void ASpit::xatrapbookopen(const ArgumentArray &args) {
}
void ASpit::xarestoregame(const ArgumentArray &args) {
+ if (!showConfirmationDialog(_("Are you sure you want to load a saved game? All unsaved progress will be lost."),
+ _("Load game"), _("Cancel"))) {
+ return;
+ }
+
// Launch the load game dialog
_vm->runLoadDialog();
}
@@ -396,6 +401,11 @@ void ASpit::xaOptions(const ArgumentArray &args) {
}
void ASpit::xaNewGame(const ArgumentArray &args) {
+ if (!showConfirmationDialog(_("Are you sure you want to start a new game? All unsaved progress will be lost."),
+ _("New game"), _("Cancel"))) {
+ return;
+ }
+
_vm->startNewGame();
RivenScriptPtr script = _vm->_scriptMan->createScriptFromData(2,
@@ -410,6 +420,16 @@ void ASpit::xaNewGame(const ArgumentArray &args) {
_vm->_scriptMan->runScript(script, false);
}
+bool ASpit::showConfirmationDialog(const char *message, const char *confirmButton, const char *cancelButton) {
+ if (!_vm->isGameStarted()) {
+ return true;
+ }
+
+ GUI::MessageDialog dialog(message, confirmButton, cancelButton);
+
+ return dialog.runModal() !=0;
+}
+
void ASpit::xadisablemenureturn(const ArgumentArray &args) {
// This function would normally enable the Windows menu item for
// returning to the main menu. Ctrl+r will do this instead.
@@ -465,6 +485,11 @@ void ASpit::xaenablemenuintro(const ArgumentArray &args) {
}
void ASpit::xademoquit(const ArgumentArray &args) {
+ if (!showConfirmationDialog(_("Are you sure you want to quit? All unsaved progress will be lost."), _("Quit"),
+ _("Cancel"))) {
+ return;
+ }
+
// Exactly as it says on the tin. In the demo, this function quits.
_vm->setGameEnded();
}
diff --git a/engines/mohawk/riven_stacks/aspit.h b/engines/mohawk/riven_stacks/aspit.h
index 2a6d88f936..aa3c20f437 100644
--- a/engines/mohawk/riven_stacks/aspit.h
+++ b/engines/mohawk/riven_stacks/aspit.h
@@ -89,6 +89,7 @@ private:
void cathBookDrawPage(uint32 page);
+ bool showConfirmationDialog(const char *message, const char *confirmButton, const char *cancelButton);
};
} // End of namespace RivenStacks