From 6a6644bac8685cb448042bbc12c831bab61fa7de Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Tue, 4 Nov 2003 19:51:31 +0000 Subject: [PATCH] fix demo crash after introduction svn-id: r11131 --- queen/logic.cpp | 7 ++++++- queen/queen.cpp | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/queen/logic.cpp b/queen/logic.cpp index bc92b7c0b3d..a208f0411c2 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -1062,6 +1062,11 @@ uint16 Logic::roomRefreshObject(uint16 obj) { uint16 curImage = _numFrames; + if (obj == 0 || obj > _numObjects) { + warning("Invalid object number %d", obj); + return curImage; + } + ObjectData *pod = &_objectData[obj]; if (pod->image == 0) { return curImage; @@ -1070,7 +1075,7 @@ uint16 Logic::roomRefreshObject(uint16 obj) { // check the object is in the current room if (pod->room != _currentRoom) { warning("Logic::roomRefreshObject() - Trying to display an object (%i=%s) that is not in room (object room=%i, current room=%i)", - obj, _objName[_objectData[obj].name], pod->room, _currentRoom); + obj, _objName[ABS(pod->name)], pod->room, _currentRoom); return curImage; } diff --git a/queen/queen.cpp b/queen/queen.cpp index db4f5c0e7ec..dad766607a0 100644 --- a/queen/queen.cpp +++ b/queen/queen.cpp @@ -105,6 +105,8 @@ QueenEngine::QueenEngine(GameDetector *detector, OSystem *syst) } QueenEngine::~QueenEngine() { + + _timer->removeTimerProc(&timerHandler); delete _resource; delete _display; delete _logic; @@ -158,7 +160,7 @@ void QueenEngine::roomChanged() { _logic->playCutaway("cred.cut"); } - _logic->currentRoom(ROOM_HOTEL_LOBBY); //ROOM_HOTEL_UPSTAIRS); + _logic->currentRoom(ROOM_HOTEL_LOBBY); _logic->entryObj(584); _logic->roomDisplay(_logic->roomName(_logic->currentRoom()), RDM_FADE_JOE, 100, 2, true);