From aba8451744c692dc2108e2dd860731d46ab207e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Boutonn=C3=A9?= Date: Sun, 30 Jan 2011 07:53:44 +0000 Subject: [PATCH] HUGO: Fix a crash in maze and a bug in lineHandler() svn-id: r55651 --- engines/hugo/parser_v1d.cpp | 3 +++ engines/hugo/parser_v1w.cpp | 1 + engines/hugo/parser_v2d.cpp | 3 +-- engines/hugo/parser_v3d.cpp | 10 ++++++++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/engines/hugo/parser_v1d.cpp b/engines/hugo/parser_v1d.cpp index 6cde8af2ff1..4fff3fa4d47 100644 --- a/engines/hugo/parser_v1d.cpp +++ b/engines/hugo/parser_v1d.cpp @@ -286,6 +286,9 @@ void Parser_v1d::dropObject(object_t *obj) { bool Parser_v1d::isCatchallVerb(bool testNounFl, char *noun, char *verb, objectList_t obj) { debugC(1, kDebugParser, "isCatchallVerb(%d, %s, %s, object_list_t obj)", (testNounFl) ? 1 : 0, noun, verb); + if (_maze.enabledFl) + return false; + if (testNounFl && !noun) return false; diff --git a/engines/hugo/parser_v1w.cpp b/engines/hugo/parser_v1w.cpp index 65d1d4c884b..709c08039ac 100644 --- a/engines/hugo/parser_v1w.cpp +++ b/engines/hugo/parser_v1w.cpp @@ -175,6 +175,7 @@ void Parser_v1w::lineHandler() { return; if (isCatchallVerb(_vm->_backgroundObjects[*_vm->_screen_p])) return; + if (isBackgroundWord(_vm->_catchallList)) return; if (isCatchallVerb(_vm->_catchallList)) diff --git a/engines/hugo/parser_v2d.cpp b/engines/hugo/parser_v2d.cpp index 8e38f5d0d89..f73d4be5dcd 100644 --- a/engines/hugo/parser_v2d.cpp +++ b/engines/hugo/parser_v2d.cpp @@ -116,8 +116,7 @@ void Parser_v2d::lineHandler() { if (!strcmp("exit", _vm->_line) || strstr(_vm->_line, "quit")) { if (Utils::Box(kBoxYesNo, "%s", _vm->_text->getTextParser(kTBExit_1d)) != 0) _vm->endGame(); - else - return; + return; } // SAVE/RESTORE diff --git a/engines/hugo/parser_v3d.cpp b/engines/hugo/parser_v3d.cpp index 63508a27422..f44bc01a152 100644 --- a/engines/hugo/parser_v3d.cpp +++ b/engines/hugo/parser_v3d.cpp @@ -118,8 +118,7 @@ void Parser_v3d::lineHandler() { if (!strcmp("exit", _vm->_line) || strstr(_vm->_line, "quit")) { if (Utils::Box(kBoxYesNo, "%s", _vm->_text->getTextParser(kTBExit_1d)) != 0) _vm->endGame(); - else - return; + return; } // SAVE/RESTORE @@ -179,6 +178,7 @@ void Parser_v3d::lineHandler() { return; if (isCatchallVerb(_vm->_backgroundObjects[*_vm->_screen_p])) return; + if (isBackgroundWord(_vm->_catchallList)) return; if (isCatchallVerb(_vm->_catchallList)) @@ -416,6 +416,9 @@ void Parser_v3d::dropObject(object_t *obj) { bool Parser_v3d::isCatchallVerb(objectList_t obj) { debugC(1, kDebugParser, "isCatchallVerb(object_list_t obj)"); + if (_maze.enabledFl) + return false; + for (int i = 0; obj[i].verbIndex != 0; i++) { if (isWordPresent(_vm->_text->getVerbArray(obj[i].verbIndex)) && obj[i].nounIndex == 0 && (!obj[i].matchFl || !findNoun()) && @@ -441,6 +444,9 @@ bool Parser_v3d::isCatchallVerb(objectList_t obj) { bool Parser_v3d::isBackgroundWord(objectList_t obj) { debugC(1, kDebugParser, "isBackgroundWord(object_list_t obj)"); + if (_maze.enabledFl) + return false; + for (int i = 0; obj[i].verbIndex != 0; i++) { if (isWordPresent(_vm->_text->getVerbArray(obj[i].verbIndex)) && isWordPresent(_vm->_text->getNounArray(obj[i].nounIndex)) &&