From 3e4566e196c07572379b814f1a145d13c68bfed1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 23 May 2006 12:36:57 +0000 Subject: Added some extra safety checks. Also contains some started work on redesigning the display of the current action svn-id: r22577 --- engines/lure/room.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/engines/lure/room.cpp b/engines/lure/room.cpp index 4452acad71..a543db4207 100644 --- a/engines/lure/room.cpp +++ b/engines/lure/room.cpp @@ -83,6 +83,8 @@ Room::Room(): _screen(Screen::getReference()) { _showInfo = false; _isExit = false; _destRoomNumber = 0; + _cursorState = CS_NONE; + //****DEBUG**** memset(tempLayer, 0, DECODED_PATHS_WIDTH * DECODED_PATHS_HEIGHT * 2); } @@ -356,6 +358,7 @@ void Room::update() { // Handle first layer (layer 3) for (i = hotspots.begin(); i != hotspots.end(); ++i) { Hotspot &h = *i.operator*(); + if ((h.roomNumber() == _roomNumber) && h.isActiveAnimation() && (h.layer() == 3)) { flagCoveredCells(h); addAnimation(h); @@ -382,6 +385,7 @@ void Room::update() { } for (iTemp = tempList.begin(); iTemp != tempList.end(); ++iTemp) { Hotspot &h = *iTemp.operator*(); + flagCoveredCells(h); addAnimation(h); addLayers(h); @@ -390,6 +394,7 @@ void Room::update() { // Handle third layer (layer 2) for (i = hotspots.begin(); i != hotspots.end(); ++i) { Hotspot &h = *i.operator*(); + if ((h.roomNumber() == _roomNumber) && h.isActiveAnimation() && (h.layer() == 2)) { flagCoveredCells(h); addAnimation(h); @@ -424,14 +429,20 @@ void Room::update() { s.writeString(0, 0, _hotspotName, false, DIALOG_TEXT_COLOUR); } else { char buffer[MAX_DESC_SIZE]; - strcpy(buffer, res.getCurrentActionStr()); + const char *actionStr = res.getCurrentActionStr(); + strcpy(buffer, actionStr); if (action != STATUS) { strcat(buffer, " "); - if (usedId != 0xffff) { - uint16 nameId = res.getHotspot(usedId)->nameId; - strings.getString(nameId, buffer + strlen(buffer), NULL, NULL); + if ((usedId != 0xffff) && (usedId != 0)) { + HotspotData *usedHotspot = res.getHotspot(usedId); + + if (usedHotspot != NULL) + strings.getString(usedHotspot->nameId, buffer + strlen(buffer), NULL, NULL); + else + strcat(buffer, "???"); + if (action == GIVE) strcat(buffer, " to "); else strcat(buffer, " on "); } -- cgit v1.2.3