[Scummvm-cvs-logs] scummvm master -> 191a9a0c641b4d565ecc295f4b8353c15d163248

criezy criezy at scummvm.org
Wed Aug 3 23:52:03 CEST 2016


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:
191a9a0c64 MOHAWK: Load games from outside the options dialog loop


Commit: 191a9a0c641b4d565ecc295f4b8353c15d163248
    https://github.com/scummvm/scummvm/commit/191a9a0c641b4d565ecc295f4b8353c15d163248
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2016-08-03T22:50:06+01:00

Commit Message:
MOHAWK: Load games from outside the options dialog loop

Loading games from inside the dialog loop may cause cursor
glitches. This commits applies the same fix to the
MohawkOptionsDialog as the one that already existed for
the global main menu. This finished to fix bug #7164.

Changed paths:
    engines/mohawk/dialogs.cpp
    engines/mohawk/dialogs.h
    engines/mohawk/myst.cpp
    engines/mohawk/riven.cpp



diff --git a/engines/mohawk/dialogs.cpp b/engines/mohawk/dialogs.cpp
index 8c11e3a..38be98d 100644
--- a/engines/mohawk/dialogs.cpp
+++ b/engines/mohawk/dialogs.cpp
@@ -92,7 +92,7 @@ enum {
 
 MohawkOptionsDialog::MohawkOptionsDialog(MohawkEngine *vm) :
 		GUI::Dialog(0, 0, 360, 200),
-		_vm(vm) {
+		_vm(vm), _loadSlot(-1) {
 	_loadButton = new GUI::ButtonWidget(this, 245, 25, 100, 25, _("~L~oad"), 0, kLoadCmd);
 	_saveButton = new GUI::ButtonWidget(this, 245, 60, 100, 25, _("~S~ave"), 0, kSaveCmd);
 	new GUI::ButtonWidget(this, 245, 95, 100, 25, _("~Q~uit"), 0, kQuitCmd);
@@ -112,6 +112,7 @@ MohawkOptionsDialog::~MohawkOptionsDialog() {
 void MohawkOptionsDialog::open() {
 	GUI::Dialog::open();
 
+	_loadSlot = -1;
 	_loadButton->setEnabled(_vm->canLoadGameStateCurrently());
 	_saveButton->setEnabled(_vm->canSaveGameStateCurrently());
 }
@@ -133,12 +134,14 @@ void MohawkOptionsDialog::save() {
 }
 
 void MohawkOptionsDialog::load() {
-	int slot = _loadDialog->runModalWithCurrentTarget();
+	// Do not load the game state from insite the dialog loop to
+	// avoid mouse cursor glitches (see bug #7164). Instead store
+	// the slot to load and let the code exectuting the dialog do
+	// the load after the dialog finished running.
+	_loadSlot = _loadDialog->runModalWithCurrentTarget();
 
-	if (slot >= 0) {
-		_vm->loadGameState(slot);
+	if (_loadSlot >= 0)
 		close();
-	}
 }
 
 void MohawkOptionsDialog::reflowLayout() {
diff --git a/engines/mohawk/dialogs.h b/engines/mohawk/dialogs.h
index 3cfb628..99db641 100644
--- a/engines/mohawk/dialogs.h
+++ b/engines/mohawk/dialogs.h
@@ -81,6 +81,8 @@ public:
 	virtual void open() override;
 	virtual void reflowLayout() override;
 	virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
+	
+	int getLoadSlot() const {return _loadSlot;}
 
 private:
 	MohawkEngine *_vm;
@@ -90,6 +92,8 @@ private:
 
 	GUI::SaveLoadChooser *_loadDialog;
 	GUI::SaveLoadChooser *_saveDialog;
+	
+	int _loadSlot;
 
 	void save();
 	void load();
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index 633b67f..a1c6d0e 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -309,6 +309,8 @@ Common::Error MohawkEngine_Myst::run() {
 
 					_canSafelySaveLoad = true;
 					runDialog(*_optionsDialog);
+					if (_optionsDialog->getLoadSlot() >= 0)
+						loadGameState(_optionsDialog->getLoadSlot());
 					_canSafelySaveLoad = false;
 
 					if (_needsPageDrop) {
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index aa168a3..b05b76d 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -258,6 +258,8 @@ void MohawkEngine_Riven::handleEvents() {
 				break;
 			case Common::KEYCODE_F5:
 				runDialog(*_optionsDialog);
+				if (_optionsDialog->getLoadSlot() >= 0)
+					loadGameState(_optionsDialog->getLoadSlot());
 				updateZipMode();
 				break;
 			case Common::KEYCODE_r:






More information about the Scummvm-git-logs mailing list