From 40c6569940e26fb6c020c54947e45614bfa0d7e9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 31 Oct 2013 08:25:19 +0100 Subject: HUGO: Fix CID 1003560, 1002882 --- engines/hugo/parser.cpp | 4 ++-- engines/hugo/route.cpp | 11 +++++++++++ engines/hugo/route.h | 4 +++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp index 2585c64fd8..cb55e1fd68 100644 --- a/engines/hugo/parser.cpp +++ b/engines/hugo/parser.cpp @@ -398,9 +398,9 @@ void Parser::command(const char *format, ...) { * Locate any member of object name list appearing in command line */ bool Parser::isWordPresent(char **wordArr) const { - debugC(1, kDebugParser, "isWordPresent(%s)", wordArr[0]); - if (wordArr != 0) { + debugC(1, kDebugParser, "isWordPresent(%s)", wordArr[0]); + for (int i = 0; strlen(wordArr[i]); i++) { if (strstr(_vm->_line, wordArr[i])) return true; diff --git a/engines/hugo/route.cpp b/engines/hugo/route.cpp index 54dae88c28..8355e1dd10 100644 --- a/engines/hugo/route.cpp +++ b/engines/hugo/route.cpp @@ -45,6 +45,17 @@ Route::Route(HugoEngine *vm) : _vm(vm) { _routeIndex = -1; // Hero not following a route _routeType = kRouteSpace; // Hero walking to space _routeObjId = -1; // Hero not walking to anything + + for (int i = 0; i < kMaxSeg; i++) + _segment[i]._y = _segment[i]._x1 = _segment[i]._x2 = 0; + + _segmentNumb = 0; + _routeListIndex = 0; + _destX = _destY = 0; + _heroWidth = 0; + _routeFoundFl = false; + _fullStackFl = false; + _fullSegmentFl = false; } void Route::resetRoute() { diff --git a/engines/hugo/route.h b/engines/hugo/route.h index 716829a201..71db1e2583 100644 --- a/engines/hugo/route.h +++ b/engines/hugo/route.h @@ -79,9 +79,11 @@ private: int16 _destY; int16 _heroWidth; // Hero width bool _routeFoundFl; // TRUE when path found - bool _fullStackFl; // TRUE if stack exhausted bool _fullSegmentFl; // Segments exhausted + // CHECKME: Never set to true, could be removed + bool _fullStackFl; // TRUE if stack exhausted + void segment(int16 x, int16 y); bool findRoute(const int16 cx, const int16 cy); Common::Point *newNode(); -- cgit v1.2.3