Skip to content

Commit

Permalink
LAB: Simplify tab handling
Browse files Browse the repository at this point in the history
  • Loading branch information
wjp committed Dec 25, 2015
1 parent 3740560 commit 23ace32
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
13 changes: 1 addition & 12 deletions engines/lab/engine.cpp
Expand Up @@ -616,18 +616,7 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo
// get next close-up in list after the one pointed to by curPos
setCurrentClose(curPos, &tmpClosePtr, true, true);

if (tmpClosePtr == _closeDataPtr) {
tmpClosePtr = nullptr;
if (!_closeDataPtr) {
ViewData *vptr = getViewData(_roomNum, _direction);
if (!vptr->_closeUps.empty())
tmpClosePtr = &(*vptr->_closeUps.begin());
} else {
if (!_closeDataPtr->_subCloseUps.empty())
tmpClosePtr = &(*_closeDataPtr->_subCloseUps.begin());
}
}
if (tmpClosePtr)
if (tmpClosePtr != _closeDataPtr)
_event->setMousePos(Common::Point(_utils->scaleX((tmpClosePtr->_x1 + tmpClosePtr->_x2) / 2), _utils->scaleY((tmpClosePtr->_y1 + tmpClosePtr->_y2) / 2)));
}

Expand Down
7 changes: 7 additions & 0 deletions engines/lab/processroom.cpp
Expand Up @@ -202,6 +202,13 @@ void LabEngine::setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, b
return;
}
}

// If we got here, no match was found. If we want the "next" close-up,
// return the first one in the list, if any.
if (next) {
if (!list->empty())
*closePtrList = &(*list->begin());
}
}

bool LabEngine::takeItem(Common::Point pos, CloseDataPtr *closePtrList) {
Expand Down

0 comments on commit 23ace32

Please sign in to comment.