From fc55a8fb1a7eeb8788aed60e16db197b8d678ce4 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Fri, 15 Apr 2016 07:10:13 +0200 Subject: 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. --- engines/neverhood/menumodule.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'engines/neverhood') diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp index 7b50bbfcda..457c7ff481 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) { -- cgit v1.2.3