[Scummvm-cvs-logs] scummvm branch-1-8 -> 243214627bf8a14b6770c8c400acad1618ed5847

eriktorbjorn eriktorbjorn at telia.com
Fri Apr 15 07:37:42 CEST 2016


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
85965a4f24 NEVERHOOD: Fix bug #7116 ("Crash upon clicking ...")
243214627b NEVERHOOD: Avoid crash in original load/delete game dialogs


Commit: 85965a4f24a77d21aac8dafbe22487b521db2135
    https://github.com/scummvm/scummvm/commit/85965a4f24a77d21aac8dafbe22487b521db2135
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2016-04-15T07:36:40+02:00

Commit Message:
NEVERHOOD: Fix bug #7116 ("Crash upon clicking ...")

Don't crash when clicking a read-only text widget. In the original,
the load game dialog's text widget isn't read-only, but since we
allow multiple games to have the same name it's probably for the
best that we don't quite match the original behavior here.

Changed paths:
    engines/neverhood/menumodule.cpp



diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp
index 826f175..9fec0d5 100644
--- a/engines/neverhood/menumodule.cpp
+++ b/engines/neverhood/menumodule.cpp
@@ -609,7 +609,8 @@ void TextEditWidget::onClick() {
 				++newCursorPos;
 			_cursorPos = MIN((int)_entryString.size(), newCursorPos);
 		}
-		_cursorSurface->setVisible(true);
+		if (!_readOnly)
+			_cursorSurface->setVisible(true);
 		refresh();
 	}
 	Widget::onClick();
@@ -1089,12 +1090,21 @@ static const NRect kLoadGameMenuButtonCollisionBounds[] = {
 
 static const NRect kLoadGameMenuListBoxRect = { 0, 0, 320, 272 };
 static const NRect kLoadGameMenuTextEditRect = { 0, 0, 320, 17 };
+
+#if 0
+// Unlike the original game, the text widget in our load dialog is read-only so
+// don't change the mouse cursor to indicate that you can type the name of the
+// game to load.
+//
+// Since we allow multiple saved games to have the same name, it's probably
+// better this way.
 static const NRect kLoadGameMenuMouseRect = { 263, 48, 583, 65 };
+#endif
 
 LoadGameMenu::LoadGameMenu(NeverhoodEngine *vm, Module *parentModule, SavegameList *savegameList)
 	: GameStateMenu(vm, parentModule, savegameList, kLoadGameMenuButtonFileHashes, kLoadGameMenuButtonCollisionBounds,
 		0x98620234, 0x201C2474,
-		0x2023098E, &kLoadGameMenuMouseRect,
+		0x2023098E, NULL /* &kLoadGameMenuMouseRect */,
 		0x04040409, 263, 142, kLoadGameMenuListBoxRect,
 		0x10924C03, 0, 263, 48, kLoadGameMenuTextEditRect,
 		0x0BC600A3, 0x0F960021) {


Commit: 243214627bf8a14b6770c8c400acad1618ed5847
    https://github.com/scummvm/scummvm/commit/243214627bf8a14b6770c8c400acad1618ed5847
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2016-04-15T07:36:50+02:00

Commit Message:
NEVERHOOD: Avoid crash in original load/delete game dialogs

The original game would display a message if you tried to load or
delete a game without actually selecting one. At least for now,
let's just avoid crashing.

Changed paths:
    engines/neverhood/menumodule.cpp



diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp
index 9fec0d5..0412565 100644
--- a/engines/neverhood/menumodule.cpp
+++ b/engines/neverhood/menumodule.cpp
@@ -1069,9 +1069,11 @@ SaveGameMenu::SaveGameMenu(NeverhoodEngine *vm, Module *parentModule, SavegameLi
 }
 
 void SaveGameMenu::performAction() {
-	((MenuModule*)_parentModule)->setSavegameInfo(_textEditWidget->getString(),
-		_listBox->getCurrIndex(), _textEditWidget->isModified());
-	leaveScene(0);
+	if (!_textEditWidget->getString().empty()) {
+		((MenuModule*)_parentModule)->setSavegameInfo(_textEditWidget->getString(),
+			_listBox->getCurrIndex(), _textEditWidget->isModified());
+		leaveScene(0);
+	}
 }
 
 static const uint32 kLoadGameMenuButtonFileHashes[] = {
@@ -1112,8 +1114,11 @@ LoadGameMenu::LoadGameMenu(NeverhoodEngine *vm, Module *parentModule, SavegameLi
 }
 
 void LoadGameMenu::performAction() {
-	((MenuModule*)_parentModule)->setLoadgameInfo(_listBox->getCurrIndex());
-	leaveScene(0);
+	// TODO: The original would display a message here if nothing was selected.
+	if (!_textEditWidget->getString().empty()) {
+		((MenuModule*)_parentModule)->setLoadgameInfo(_listBox->getCurrIndex());
+		leaveScene(0);
+	}
 }
 
 static const uint32 kDeleteGameMenuButtonFileHashes[] = {
@@ -1144,8 +1149,11 @@ DeleteGameMenu::DeleteGameMenu(NeverhoodEngine *vm, Module *parentModule, Savega
 }
 
 void DeleteGameMenu::performAction() {
-	((MenuModule*)_parentModule)->setDeletegameInfo(_listBox->getCurrIndex());
-	leaveScene(0);
+	// TODO: The original would display a message here if no game was selected.
+	if (!_textEditWidget->getString().empty()) {
+		((MenuModule*)_parentModule)->setDeletegameInfo(_listBox->getCurrIndex());
+		leaveScene(0);
+	}
 }
 
 QueryOverwriteMenu::QueryOverwriteMenu(NeverhoodEngine *vm, Module *parentModule, const Common::String &description)






More information about the Scummvm-git-logs mailing list