From e40ba4c1354fabc0d1bd81a6ab80cd5f349d88fa Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Tue, 13 Mar 2012 14:53:40 +0100 Subject: JANITORIAL: Simply use *x instead of *x.get() on smart pointers. --- common/translation.cpp | 5 +- engines/kyra/gui_eob.cpp | 12 ++-- engines/kyra/gui_lok.cpp | 6 +- engines/kyra/gui_lol.cpp | 2 +- engines/kyra/gui_v2.cpp | 2 +- engines/lure/debugger.cpp | 42 ++++++------ engines/lure/game.cpp | 8 +-- engines/lure/hotspots.cpp | 56 ++++++++-------- engines/lure/menu.cpp | 46 ++++++------- engines/lure/res.cpp | 19 +++--- engines/lure/res_struct.cpp | 154 +++++++++++++++++++++----------------------- engines/lure/room.cpp | 30 ++++----- engines/lure/sound.cpp | 55 +++++++--------- engines/lure/surface.cpp | 32 ++++----- gui/debugger.cpp | 5 +- 15 files changed, 232 insertions(+), 242 deletions(-) diff --git a/common/translation.cpp b/common/translation.cpp index 219fce8794..2bc31c617b 100644 --- a/common/translation.cpp +++ b/common/translation.cpp @@ -232,8 +232,9 @@ bool TranslationManager::openTranslationsFile(File &inFile) { ArchiveMemberList fileList; SearchMan.listMatchingMembers(fileList, "translations.dat"); for (ArchiveMemberList::iterator it = fileList.begin(); it != fileList.end(); ++it) { - SeekableReadStream *stream = it->get()->createReadStream(); - if (stream && inFile.open(stream, it->get()->getName())) { + ArchiveMember const &m = **it; + SeekableReadStream *const stream = m.createReadStream(); + if (stream && inFile.open(stream, m.getName())) { if (checkHeader(inFile)) return true; inFile.close(); diff --git a/engines/kyra/gui_eob.cpp b/engines/kyra/gui_eob.cpp index 76e4f0dba9..e3c0743e5c 100644 --- a/engines/kyra/gui_eob.cpp +++ b/engines/kyra/gui_eob.cpp @@ -1460,7 +1460,7 @@ void GUI_EoB::processButton(Button *button) { // nullsub (at least EOBII) } else if (button->data0Val1 == 4) { if (button->data1Callback) - (*button->data1Callback.get())(button); + (*button->data1Callback)(button); } } else if (button->data1Val1 == 2) { if (!(button->flags2 & 4)) @@ -1469,7 +1469,7 @@ void GUI_EoB::processButton(Button *button) { // nullsub (at least EOBII) } else if (button->data1Val1 == 4) { if (button->data1Callback) - (*button->data1Callback.get())(button); + (*button->data1Callback)(button); } } @@ -1486,7 +1486,7 @@ void GUI_EoB::processButton(Button *button) { // nullsub (at least EOBII) } else if (button->data0Val1 == 4) { if (button->data2Callback) - (*button->data2Callback.get())(button); + (*button->data2Callback)(button); } } else if (button->data2Val1 == 2) { _screen->drawBox(sx, sy, fx2, fy2, (button->flags2 & 1) ? button->data3Val2 : button->data2Val2); @@ -1494,7 +1494,7 @@ void GUI_EoB::processButton(Button *button) { // nullsub (at least EOBII) } else if (button->data2Val1 == 4) { if (button->data2Callback) - (*button->data2Callback.get())(button); + (*button->data2Callback)(button); } } @@ -1507,7 +1507,7 @@ void GUI_EoB::processButton(Button *button) { // nullsub (at least EOBII) } else if (button->data0Val1 == 4) { if (button->data0Callback) - (*button->data0Callback.get())(button); + (*button->data0Callback)(button); } else if (button->data0Val1 == 5) { _screen->drawBox(sx, sy, fx2, fy2, button->data0Val2); } else { @@ -1876,7 +1876,7 @@ int GUI_EoB::processButtonList(Kyra::Button *buttonList, uint16 inputFlags, int8 processButton(buttonList); if (v6 && buttonList->buttonCallback) - runLoop = !(*buttonList->buttonCallback.get())(buttonList); + runLoop = !(*buttonList->buttonCallback)(buttonList); if ((flgs2 & 2) && (flgs & 0x20)) runLoop = false; diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp index 18470e5d76..b4e5148b64 100644 --- a/engines/kyra/gui_lok.cpp +++ b/engines/kyra/gui_lok.cpp @@ -243,7 +243,7 @@ int GUI_LoK::processButtonList(Button *list, uint16 inputFlag, int8 mouseWheel) } if (mouseWheel && list->mouseWheel == mouseWheel && list->buttonCallback) { - if ((*list->buttonCallback.get())(list)) + if ((*list->buttonCallback)(list)) break; } @@ -282,7 +282,7 @@ int GUI_LoK::processButtonList(Button *list, uint16 inputFlag, int8 mouseWheel) if (processMouseClick) { if (list->buttonCallback) { - if ((*list->buttonCallback.get())(list)) + if ((*list->buttonCallback)(list)) break; } } @@ -349,7 +349,7 @@ void GUI_LoK::processButton(Button *button) { if (processType == 1 && shape) _screen->drawShape(_screen->_curPage, shape, x, y, button->dimTableIndex, 0x10); else if (processType == 4 && callback) - (*callback.get())(button); + (*callback)(button); } void GUI_LoK::setGUILabels() { diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp index b025aefbd0..a79da0681e 100644 --- a/engines/kyra/gui_lol.cpp +++ b/engines/kyra/gui_lol.cpp @@ -2165,7 +2165,7 @@ int GUI_LoL::processButtonList(Button *buttonList, uint16 inputFlag, int8 mouseW if (buttonList->buttonCallback) { //_vm->removeInputTop(); - if ((*buttonList->buttonCallback.get())(buttonList)) + if ((*buttonList->buttonCallback)(buttonList)) break; } diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp index 580adb0e5d..65f8bd45e5 100644 --- a/engines/kyra/gui_v2.cpp +++ b/engines/kyra/gui_v2.cpp @@ -360,7 +360,7 @@ int GUI_v2::processButtonList(Button *buttonList, uint16 inputFlag, int8 mouseWh if (buttonList->buttonCallback) { _vm->removeInputTop(); - if ((*buttonList->buttonCallback.get())(buttonList)) + if ((*buttonList->buttonCallback)(buttonList)) break; } diff --git a/engines/lure/debugger.cpp b/engines/lure/debugger.cpp index ef4a22f73a..3fbbf84469 100644 --- a/engines/lure/debugger.cpp +++ b/engines/lure/debugger.cpp @@ -119,21 +119,21 @@ bool Debugger::cmd_listRooms(int argc, const char **argv) { DebugPrintf("Available rooms are:\n"); for (RoomDataList::iterator i = rooms.begin(); i != rooms.end(); ++i) { - RoomData *room = (*i).get(); + RoomData const &room = **i; // Explictly note the second drawbridge room as "Alt" - if (room->roomNumber == 49) { + if (room.roomNumber == 49) { strings.getString(47, buffer); strcat(buffer, " (alt)"); } else { - strings.getString(room->roomNumber, buffer); + strings.getString(room.roomNumber, buffer); } - DebugPrintf("#%d - %s", room->roomNumber, buffer); + DebugPrintf("#%d - %s", room.roomNumber, buffer); if (++ctr % 3 == 0) DebugPrintf("\n"); else { // Write out spaces between columns - int numSpaces = 25 - strlen(buffer) - ((room->roomNumber >= 10) ? 2 : 1); + int numSpaces = 25 - strlen(buffer) - (room.roomNumber >= 10 ? 2 : 1); char *s = buffer; while (numSpaces-- > 0) *s++ = ' '; *s = '\0'; @@ -243,13 +243,13 @@ bool Debugger::cmd_hotspots(int argc, const char **argv) { // Loop for displaying active hotspots HotspotList::iterator i; for (i = res.activeHotspots().begin(); i != res.activeHotspots().end(); ++i) { - Hotspot *hotspot = (*i).get(); + Hotspot const &hotspot = **i; - if (hotspot->nameId() == 0) strcpy(buffer, "none"); - else strings.getString(hotspot->nameId(), buffer); + if (hotspot.nameId() == 0) strcpy(buffer, "none"); + else strings.getString(hotspot.nameId(), buffer); - DebugPrintf("%4xh - %s pos=(%d,%d,%d)\n", hotspot->hotspotId(), buffer, - hotspot->x(), hotspot->y(), hotspot->roomNumber()); + DebugPrintf("%4xh - %s pos=(%d,%d,%d)\n", hotspot.hotspotId(), buffer, + hotspot.x(), hotspot.y(), hotspot.roomNumber()); } } else { // Presume it's a room's hotspots @@ -257,14 +257,14 @@ bool Debugger::cmd_hotspots(int argc, const char **argv) { HotspotDataList::iterator i; for (i = res.hotspotData().begin(); i != res.hotspotData().end(); ++i) { - HotspotData *hotspot = (*i).get(); + HotspotData const &hotspot = **i; - if (hotspot->roomNumber == roomNumber) { - if (hotspot->nameId == 0) strcpy(buffer, "none"); - else strings.getString(hotspot->nameId, buffer); + if (hotspot.roomNumber == roomNumber) { + if (hotspot.nameId == 0) strcpy(buffer, "none"); + else strings.getString(hotspot.nameId, buffer); - DebugPrintf("%4xh - %s pos=(%d,%d,%d)\n", hotspot->hotspotId, buffer, - hotspot->startX, hotspot->startY, hotspot->roomNumber); + DebugPrintf("%4xh - %s pos=(%d,%d,%d)\n", hotspot.hotspotId, buffer, + hotspot.startX, hotspot.startY, hotspot.roomNumber); } } } @@ -415,10 +415,10 @@ bool Debugger::cmd_room(int argc, const char **argv) { else { RoomExitHotspotList::iterator i; for (i = exits.begin(); i != exits.end(); ++i) { - RoomExitHotspotData *rec = (*i).get(); + RoomExitHotspotData const &rec = **i; DebugPrintf("\nArea - (%d,%d)-(%d,%d) Room=%d Cursor=%d Hotspot=%xh", - rec->xs, rec->ys, rec->xe, rec->ye, rec->destRoomNumber, rec->cursorNum, rec->hotspotId); + rec.xs, rec.ys, rec.xe, rec.ye, rec.destRoomNumber, rec.cursorNum, rec.hotspotId); } DebugPrintf("\n"); @@ -430,11 +430,11 @@ bool Debugger::cmd_room(int argc, const char **argv) { else { RoomExitList::iterator i2; for (i2 = room->exits.begin(); i2 != room->exits.end(); ++i2) { - RoomExitData *rec2 = (*i2).get(); + RoomExitData const &rec2 = **i2; DebugPrintf("\nExit - (%d,%d)-(%d,%d) Dest=%d,(%d,%d) Dir=%s Sequence=%xh", - rec2->xs, rec2->ys, rec2->xe, rec2->ye, rec2->roomNumber, - rec2->x, rec2->y, directionList[rec2->direction], rec2->sequenceOffset); + rec2.xs, rec2.ys, rec2.xe, rec2.ye, rec2.roomNumber, + rec2.x, rec2.y, directionList[rec2.direction], rec2.sequenceOffset); } DebugPrintf("\n"); diff --git a/engines/lure/game.cpp b/engines/lure/game.cpp index 9542c35785..eaed7ebbe7 100644 --- a/engines/lure/game.cpp +++ b/engines/lure/game.cpp @@ -71,12 +71,12 @@ void Game::tick() { uint16 *idList = new uint16[res.activeHotspots().size()]; int idSize = 0; for (i = res.activeHotspots().begin(); i != res.activeHotspots().end(); ++i) { - Hotspot *hotspot = (*i).get(); + Hotspot const &hotspot = **i; - if (!_preloadFlag || ((hotspot->layer() != 0xff) && - (hotspot->hotspotId() < FIRST_NONCHARACTER_ID))) + if (!_preloadFlag || ((hotspot.layer() != 0xff) && + (hotspot.hotspotId() < FIRST_NONCHARACTER_ID))) // Add hotspot to list to execute - idList[idSize++] = hotspot->hotspotId(); + idList[idSize++] = hotspot.hotspotId(); } debugC(ERROR_DETAILED, kLureDebugAnimations, "Hotspot ticks begin"); diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp index 698df8715e..ee7a185ea1 100644 --- a/engines/lure/hotspots.cpp +++ b/engines/lure/hotspots.cpp @@ -1169,30 +1169,30 @@ bool Hotspot::doorCloseCheck(uint16 doorId) { HotspotList::iterator i; HotspotList &lst = res.activeHotspots(); for (i = lst.begin(); i != lst.end(); ++i) { - Hotspot *hsCurrent = (*i).get(); + Hotspot const &hsCurrent = **i; // Skip entry if it's the door or the character - if ((hsCurrent->hotspotId() == hotspotId()) || - (hsCurrent->hotspotId() == doorHotspot->hotspotId())) + if ((hsCurrent.hotspotId() == hotspotId()) || + (hsCurrent.hotspotId() == doorHotspot->hotspotId())) continue; // Skip entry if it doesn't meet certain criteria - if ((hsCurrent->layer() == 0) || - (hsCurrent->roomNumber() != doorHotspot->roomNumber()) || - (hsCurrent->hotspotId() < PLAYER_ID) || - ((hsCurrent->hotspotId() >= 0x408) && (hsCurrent->hotspotId() < 0x2710))) + if ((hsCurrent.layer() == 0) || + (hsCurrent.roomNumber() != doorHotspot->roomNumber()) || + (hsCurrent.hotspotId() < PLAYER_ID) || + ((hsCurrent.hotspotId() >= 0x408) && (hsCurrent.hotspotId() < 0x2710))) continue; // Also skip entry if special Id - if ((hsCurrent->hotspotId() == 0xfffe) || (hsCurrent->hotspotId() == 0xffff)) + if ((hsCurrent.hotspotId() == 0xfffe) || (hsCurrent.hotspotId() == 0xffff)) continue; // Check to see if the character is intersecting the door area - int tempY = hsCurrent->y() + hsCurrent->heightCopy(); - if ((hsCurrent->x() >= bounds.right) || - (hsCurrent->x() + hsCurrent->widthCopy() <= bounds.left) || - (tempY + hsCurrent->charRectY() < bounds.top) || - (tempY - hsCurrent->yCorrection() - hsCurrent->charRectY() > bounds.bottom)) + int tempY = hsCurrent.y() + hsCurrent.heightCopy(); + if ((hsCurrent.x() >= bounds.right) || + (hsCurrent.x() + hsCurrent.widthCopy() <= bounds.left) || + (tempY + hsCurrent.charRectY() < bounds.top) || + (tempY - hsCurrent.yCorrection() - hsCurrent.charRectY() > bounds.bottom)) continue; // At this point we know a character is blocking door, so return false @@ -1883,12 +1883,12 @@ void Hotspot::doStatus(HotspotData *hotspot) { HotspotDataList &list = res.hotspotData(); HotspotDataList::iterator i; for (i = list.begin(); i != list.end(); ++i) { - HotspotData *rec = (*i).get(); + HotspotData const &rec = **i; - if (rec->roomNumber == PLAYER_ID) { + if (rec.roomNumber == PLAYER_ID) { if (numItems++ == 0) strcat(buffer, ": "); else strcat(buffer, ", "); - strings.getString(rec->nameId, buffer + strlen(buffer)); + strings.getString(rec.nameId, buffer + strlen(buffer)); } } @@ -4385,8 +4385,8 @@ Common::String PathFinder::getDebugInfo() const { WalkingActionList::const_iterator i; for (i = _list.begin(); i != _list.end(); ++i) { - WalkingActionEntry *e = (*i).get(); - buffer += Common::String::format("Direction=%d, numSteps=%d\n", e->direction(), e->numSteps()); + WalkingActionEntry const &e = **i; + buffer += Common::String::format("Direction=%d, numSteps=%d\n", e.direction(), e.numSteps()); } return buffer; @@ -4505,9 +4505,9 @@ void PathFinder::saveToStream(Common::WriteStream *stream) const { // Save any active step sequence for (WalkingActionList::const_iterator i = _list.begin(); i != _list.end(); ++i) { - WalkingActionEntry *entry = (*i).get(); - stream->writeByte(entry->direction()); - stream->writeSint16LE(entry->rawSteps()); + WalkingActionEntry &entry = **i; + stream->writeByte(entry.direction()); + stream->writeSint16LE(entry.rawSteps()); } stream->writeByte(0xff); stream->writeSint16LE(_stepCtr); @@ -4684,15 +4684,15 @@ bool Support::isCharacterInList(uint16 *lst, int numEntries, uint16 charId) { void HotspotList::saveToStream(Common::WriteStream *stream) const { for (HotspotList::const_iterator i = begin(); i != end(); ++i) { - Hotspot *hotspot = (*i).get(); - debugC(ERROR_INTERMEDIATE, kLureDebugAnimations, "Saving hotspot %xh", hotspot->hotspotId()); - bool dynamicObject = hotspot->hotspotId() != hotspot->originalId(); - stream->writeUint16LE(hotspot->originalId()); + Hotspot const &hotspot = **i; + debugC(ERROR_INTERMEDIATE, kLureDebugAnimations, "Saving hotspot %xh", hotspot.hotspotId()); + bool dynamicObject = hotspot.hotspotId() != hotspot.originalId(); + stream->writeUint16LE(hotspot.originalId()); stream->writeByte(dynamicObject); - stream->writeUint16LE(hotspot->destHotspotId()); - hotspot->saveToStream(stream); + stream->writeUint16LE(hotspot.destHotspotId()); + hotspot.saveToStream(stream); - debugC(ERROR_DETAILED, kLureDebugAnimations, "Saved hotspot %xh", hotspot->hotspotId()); + debugC(ERROR_DETAILED, kLureDebugAnimations, "Saved hotspot %xh", hotspot.hotspotId()); } stream->writeUint16LE(0); } diff --git a/engines/lure/menu.cpp b/engines/lure/menu.cpp index 61de2bf165..5a0dd26cba 100644 --- a/engines/lure/menu.cpp +++ b/engines/lure/menu.cpp @@ -276,11 +276,11 @@ uint16 PopupMenu::ShowInventory() { HotspotDataList::iterator i; for (i = rsc.hotspotData().begin(); i != rsc.hotspotData().end(); ++i) { - HotspotData *hotspot = (*i).get(); - if (hotspot->roomNumber == PLAYER_ID) { - idList[itemCtr] = hotspot->hotspotId; + HotspotData const &hotspot = **i; + if (hotspot.roomNumber == PLAYER_ID) { + idList[itemCtr] = hotspot.hotspotId; char *hotspotName = itemNames[itemCtr++] = (char *) malloc(MAX_HOTSPOT_NAME_SIZE); - strings.getString(hotspot->nameId, hotspotName); + strings.getString(hotspot.nameId, hotspotName); } } @@ -317,52 +317,52 @@ uint16 PopupMenu::ShowItems(Action contextAction, uint16 roomNumber) { // Loop for rooms for (ir = rooms.begin(); ir != rooms.end(); ++ir) { - RoomData *roomData = (*ir).get(); + RoomData const &roomData = **ir; // Pre-condition checks for whether to skip room - if ((roomData->hdrFlags != 15) && ((roomData->hdrFlags & fields.hdrFlagMask()) == 0)) + if ((roomData.hdrFlags != 15) && ((roomData.hdrFlags & fields.hdrFlagMask()) == 0)) continue; - if (((roomData->flags & HOTSPOTFLAG_MENU_EXCLUSION) != 0) || ((roomData->flags & HOTSPOTFLAG_FOUND) == 0)) + if (((roomData.flags & HOTSPOTFLAG_MENU_EXCLUSION) != 0) || ((roomData.flags & HOTSPOTFLAG_FOUND) == 0)) continue; - if ((roomData->actions & contextBitflag) == 0) + if ((roomData.actions & contextBitflag) == 0) continue; // Add room to list of entries to display if (numItems == MAX_NUM_DISPLAY_ITEMS) error("Out of space in ask list"); - entryIds[numItems] = roomData->roomNumber; - nameIds[numItems] = roomData->roomNumber; + entryIds[numItems] = roomData.roomNumber; + nameIds[numItems] = roomData.roomNumber; entryNames[numItems] = (char *) Memory::alloc(MAX_HOTSPOT_NAME_SIZE); - strings.getString(roomData->roomNumber, entryNames[numItems]); + strings.getString(roomData.roomNumber, entryNames[numItems]); ++numItems; } // Loop for hotspots for (ih = hotspots.begin(); ih != hotspots.end(); ++ih) { - HotspotData *hotspot = (*ih).get(); + HotspotData const &hotspot = **ih; - if ((hotspot->headerFlags != 15) && - ((hotspot->headerFlags & fields.hdrFlagMask()) == 0)) + if ((hotspot.headerFlags != 15) && + ((hotspot.headerFlags & fields.hdrFlagMask()) == 0)) continue; - if (((hotspot->flags & HOTSPOTFLAG_MENU_EXCLUSION) != 0) || ((hotspot->flags & HOTSPOTFLAG_FOUND) == 0)) + if (((hotspot.flags & HOTSPOTFLAG_MENU_EXCLUSION) != 0) || ((hotspot.flags & HOTSPOTFLAG_FOUND) == 0)) // Skip the current hotspot continue; // If the hotspot is room specific, skip if the character will not be in the specified room - if (((hotspot->flags & HOTSPOTFLAG_ROOM_SPECIFIC) != 0) && - (hotspot->roomNumber != roomNumber)) + if (((hotspot.flags & HOTSPOTFLAG_ROOM_SPECIFIC) != 0) && + (hotspot.roomNumber != roomNumber)) continue; // If hotspot does not allow action, then skip it - if ((hotspot->actions & contextBitflag) == 0) + if ((hotspot.actions & contextBitflag) == 0) continue; // If a special hotspot Id, then skip displaying - if ((hotspot->nameId == 0x17A) || (hotspot->nameId == 0x147)) + if ((hotspot.nameId == 0x17A) || (hotspot.nameId == 0x147)) continue; // Check if the hotspot's name is already used in an already set item itemCtr = 0; - while ((itemCtr < numItems) && (nameIds[itemCtr] != hotspot->nameId)) + while ((itemCtr < numItems) && (nameIds[itemCtr] != hotspot.nameId)) ++itemCtr; if (itemCtr != numItems) // Item's name is already present - skip hotspot @@ -370,10 +370,10 @@ uint16 PopupMenu::ShowItems(Action contextAction, uint16 roomNumber) { // Add hotspot to list of entries to display if (numItems == MAX_NUM_DISPLAY_ITEMS) error("Out of space in ask list"); - entryIds[numItems] = hotspot->hotspotId; - nameIds[numItems] = hotspot->nameId; + entryIds[numItems] = hotspot.hotspotId; + nameIds[numItems] = hotspot.nameId; entryNames[numItems] = (char *) Memory::alloc(MAX_HOTSPOT_NAME_SIZE); - strings.getString(hotspot->nameId, entryNames[numItems]); + strings.getString(hotspot.nameId, entryNames[numItems]); ++numItems; } diff --git a/engines/lure/res.cpp b/engines/lure/res.cpp index 001b882e0b..9ec641140b 100644 --- a/engines/lure/res.cpp +++ b/engines/lure/res.cpp @@ -677,9 +677,9 @@ void Resources::deactivateHotspot(uint16 hotspotId, bool isDestId) { HotspotList::iterator i = _activeHotspots.begin(); while (i != _activeHotspots.end()) { - Hotspot *h = (*i).get(); - if ((!isDestId && (h->hotspotId() == hotspotId)) || - (isDestId && (h->destHotspotId() == hotspotId) && (h->hotspotId() == 0xffff))) { + Hotspot const &h = **i; + if ((!isDestId && (h.hotspotId() == hotspotId)) || + (isDestId && (h.destHotspotId() == hotspotId) && (h.hotspotId() == 0xffff))) { _activeHotspots.erase(i); break; } @@ -707,8 +707,7 @@ uint16 Resources::numInventoryItems() { HotspotDataList &list = _hotspotData; HotspotDataList::iterator i; for (i = list.begin(); i != list.end(); ++i) { - HotspotData *rec = (*i).get(); - if (rec->roomNumber == PLAYER_ID) ++numItems; + if ((*i)->roomNumber == PLAYER_ID) ++numItems; } return numItems; @@ -753,12 +752,12 @@ void Resources::saveToStream(Common::WriteStream *stream) { // Save out the schedule for any non-active NPCs HotspotDataList::iterator i; for (i = _hotspotData.begin(); i != _hotspotData.end(); ++i) { - HotspotData *rec = (*i).get(); - if (!rec->npcSchedule.isEmpty()) { - Hotspot *h = getActiveHotspot(rec->hotspotId); + HotspotData const &rec = **i; + if (!rec.npcSchedule.isEmpty()) { + Hotspot *h = getActiveHotspot(rec.hotspotId); if (h == NULL) { - stream->writeUint16LE(rec->hotspotId); - rec->npcSchedule.saveToStream(stream); + stream->writeUint16LE(rec.hotspotId); + rec.npcSchedule.saveToStream(stream); } } } diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp index ded6b5e6fc..aee4f11215 100644 --- a/engines/lure/res_struct.cpp +++ b/engines/lure/res_struct.cpp @@ -280,9 +280,9 @@ void RoomPathsData::decompress(RoomPathsDecompressedData &dataOut, int character void RoomDataList::saveToStream(Common::WriteStream *stream) const { for (RoomDataList::const_iterator i = begin(); i != end(); ++i) { - RoomData *rec = (*i).get(); - stream->writeByte(rec->flags); - const byte *pathData = rec->paths.data(); + RoomData const &rec = **i; + stream->writeByte(rec.flags); + const byte *pathData = rec.paths.data(); stream->write(pathData, ROOM_PATHS_HEIGHT * ROOM_PATHS_WIDTH); } } @@ -292,10 +292,10 @@ void RoomDataList::loadFromStream(Common::ReadStream *stream) { byte data[ROOM_PATHS_HEIGHT * ROOM_PATHS_WIDTH]; for (i = begin(); i != end(); ++i) { - RoomData *rec = (*i).get(); - rec->flags = stream->readByte(); + RoomData &rec = **i; + rec.flags = stream->readByte(); stream->read(data, ROOM_PATHS_HEIGHT * ROOM_PATHS_WIDTH); - rec->paths.load(data); + rec.paths.load(data); } } @@ -317,15 +317,15 @@ RoomExitJoinData::RoomExitJoinData(RoomExitJoinResource *rec) { void RoomExitJoinList::saveToStream(Common::WriteStream *stream) const { for (RoomExitJoinList::const_iterator i = begin(); i != end(); ++i) { - RoomExitJoinData *rec = (*i).get(); - - stream->writeUint16LE(rec->hotspots[0].hotspotId); - stream->writeUint16LE(rec->hotspots[1].hotspotId); - stream->writeByte(rec->hotspots[0].currentFrame); - stream->writeByte(rec->hotspots[0].destFrame); - stream->writeByte(rec->hotspots[1].currentFrame); - stream->writeByte(rec->hotspots[1].destFrame); - stream->writeByte(rec->blocked); + RoomExitJoinData const &rec = **i; + + stream->writeUint16LE(rec.hotspots[0].hotspotId); + stream->writeUint16LE(rec.hotspots[1].hotspotId); + stream->writeByte(rec.hotspots[0].currentFrame); + stream->writeByte(rec.hotspots[0].destFrame); + stream->writeByte(rec.hotspots[1].currentFrame); + stream->writeByte(rec.hotspots[1].destFrame); + stream->writeByte(rec.blocked); } // Write end of list marker @@ -334,21 +334,21 @@ void RoomExitJoinList::saveToStream(Common::WriteStream *stream) const { void RoomExitJoinList::loadFromStream(Common::ReadStream *stream) { for (RoomExitJoinList::iterator i = begin(); i != end(); ++i) { - RoomExitJoinData *rec = (*i).get(); + RoomExitJoinData &rec = **i; uint16 hotspot1Id = stream->readUint16LE(); if (hotspot1Id == 0xffff) error("Invalid room exit join list"); uint16 hotspot2Id = stream->readUint16LE(); - if ((rec->hotspots[0].hotspotId != hotspot1Id) || - (rec->hotspots[1].hotspotId != hotspot2Id)) + if ((rec.hotspots[0].hotspotId != hotspot1Id) || + (rec.hotspots[1].hotspotId != hotspot2Id)) break; - rec->hotspots[0].currentFrame = stream->readByte(); - rec->hotspots[0].destFrame = stream->readByte(); - rec->hotspots[1].currentFrame = stream->readByte(); - rec->hotspots[1].destFrame = stream->readByte(); - rec->blocked = stream->readByte(); + rec.hotspots[0].currentFrame = stream->readByte(); + rec.hotspots[0].destFrame = stream->readByte(); + rec.hotspots[1].currentFrame = stream->readByte(); + rec.hotspots[1].destFrame = stream->readByte(); + rec.blocked = stream->readByte(); } // Read final end of list marker @@ -366,8 +366,8 @@ HotspotActionData::HotspotActionData(HotspotActionResource *rec) { uint16 HotspotActionList::getActionOffset(Action action) { iterator i; for (i = begin(); i != end(); ++i) { - HotspotActionData *rec = (*i).get(); - if (rec->action == action) return rec->sequenceOffset; + HotspotActionData const &rec = **i; + if (rec.action == action) return rec.sequenceOffset; } return 0; @@ -534,9 +534,9 @@ void HotspotData::loadFromStream(Common::ReadStream *stream) { void HotspotDataList::saveToStream(Common::WriteStream *stream) const { for (const_iterator i = begin(); i != end(); ++i) { - HotspotData *hotspot = (*i).get(); - stream->writeUint16LE(hotspot->hotspotId); - hotspot->saveToStream(stream); + HotspotData const &hotspot = **i; + stream->writeUint16LE(hotspot.hotspotId); + hotspot.saveToStream(stream); } stream->writeUint16LE(0); } @@ -579,14 +579,14 @@ bool MovementDataList::getFrame(uint16 currentFrame, int16 &xChange, iterator i; for (i = begin(); i != end(); ++i) { - MovementData *rec = (*i).get(); + MovementData const &rec = **i; if (foundFlag || (i == begin())) { - xChange = rec->xChange; - yChange = rec->yChange; - nextFrame = rec->frameNumber; + xChange = rec.xChange; + yChange = rec.yChange; + nextFrame = rec.frameNumber; if (foundFlag) return true; } - if (rec->frameNumber == currentFrame) foundFlag = true; + if (rec.frameNumber == currentFrame) foundFlag = true; } return true; @@ -698,11 +698,10 @@ TalkEntryData *TalkData::getResponse(int index) { void TalkDataList::saveToStream(Common::WriteStream *stream) const { for (TalkDataList::const_iterator i = begin(); i != end(); ++i) { - TalkData *rec = (*i).get(); + TalkData const &rec = **i; - for (TalkEntryList::const_iterator i2 = rec->entries.begin(); i2 != rec->entries.end(); ++i2) { - TalkEntryData *entry = (*i2).get(); - stream->writeUint16LE(entry->descId); + for (TalkEntryList::const_iterator i2 = rec.entries.begin(); i2 != rec.entries.end(); ++i2) { + stream->writeUint16LE((*i2)->descId); } } } @@ -710,11 +709,10 @@ void TalkDataList::saveToStream(Common::WriteStream *stream) const { void TalkDataList::loadFromStream(Common::ReadStream *stream) { TalkDataList::iterator i; for (i = begin(); i != end(); ++i) { - TalkData *rec = (*i).get(); + TalkData const &rec = **i; - for (TalkEntryList::const_iterator i2 = rec->entries.begin(); i2 != rec->entries.end(); ++i2) { - TalkEntryData *entry = (*i2).get(); - entry->descId = stream->readUint16LE(); + for (TalkEntryList::const_iterator i2 = rec.entries.begin(); i2 != rec.entries.end(); ++i2) { + (*i2)->descId = stream->readUint16LE(); } } } @@ -779,17 +777,17 @@ void SequenceDelayList::tick() { g_system->getMillis()); for (i = begin(); i != end(); ++i) { - SequenceDelayData *entry = (*i).get(); - debugC(ERROR_DETAILED, kLureDebugScripts, "Delay List check %xh at time %d", entry->sequenceOffset, entry->timeoutCtr); + SequenceDelayData &entry = **i; + debugC(ERROR_DETAILED, kLureDebugScripts, "Delay List check %xh at time %d", entry.sequenceOffset, entry.timeoutCtr); - if (entry->timeoutCtr <= GAME_FRAME_DELAY) { + if (entry.timeoutCtr <= GAME_FRAME_DELAY) { // Timeout reached - delete entry from list and execute the sequence - uint16 seqOffset = entry->sequenceOffset; + uint16 seqOffset = entry.sequenceOffset; erase(i); Script::execute(seqOffset); return; } else { - entry->timeoutCtr -= GAME_FRAME_DELAY; + entry.timeoutCtr -= GAME_FRAME_DELAY; } } } @@ -798,8 +796,7 @@ void SequenceDelayList::clear(bool forceClear) { SequenceDelayList::iterator i = begin(); while (i != end()) { - SequenceDelayData *entry = (*i).get(); - if (entry->canClear || forceClear) + if ((*i)->canClear || forceClear) i = erase(i); else ++i; @@ -808,10 +805,10 @@ void SequenceDelayList::clear(bool forceClear) { void SequenceDelayList::saveToStream(Common::WriteStream *stream) const { for (SequenceDelayList::const_iterator i = begin(); i != end(); ++i) { - SequenceDelayData *entry = (*i).get(); - stream->writeUint16LE(entry->sequenceOffset); - stream->writeUint32LE(entry->timeoutCtr); - stream->writeByte(entry->canClear); + SequenceDelayData const &entry = **i; + stream->writeUint16LE(entry.sequenceOffset); + stream->writeUint32LE(entry.timeoutCtr); + stream->writeByte(entry.canClear); } stream->writeUint16LE(0); @@ -1044,9 +1041,9 @@ RoomExitIndexedHotspotData::RoomExitIndexedHotspotData(RoomExitIndexedHotspotRes uint16 RoomExitIndexedHotspotList::getHotspot(uint16 roomNumber, uint8 hotspotIndexId) { iterator i; for (i = begin(); i != end(); ++i) { - RoomExitIndexedHotspotData *entry = (*i).get(); - if ((entry->roomNumber == roomNumber) && (entry->hotspotIndex == hotspotIndexId)) - return entry->hotspotId; + RoomExitIndexedHotspotData const &entry = **i; + if ((entry.roomNumber == roomNumber) && (entry.hotspotIndex == hotspotIndexId)) + return entry.hotspotId; } // No hotspot @@ -1066,12 +1063,12 @@ PausedCharacter::PausedCharacter(uint16 SrcCharId, uint16 DestCharId) { void PausedCharacterList::reset(uint16 hotspotId) { iterator i; for (i = begin(); i != end(); ++i) { - PausedCharacter *rec = (*i).get(); + PausedCharacter &rec = **i; - if (rec->srcCharId == hotspotId) { - rec->counter = 1; - if (rec->destCharId < START_EXIT_ID) - rec->charHotspot->pauseCtr = 1; + if (rec.srcCharId == hotspotId) { + rec.counter = 1; + if (rec.destCharId < START_EXIT_ID) + rec.charHotspot->pauseCtr = 1; } } } @@ -1080,15 +1077,15 @@ void PausedCharacterList::countdown() { iterator i = begin(); while (i != end()) { - PausedCharacter *rec = (*i).get(); - --rec->counter; + PausedCharacter &rec = **i; + --rec.counter; // Handle reflecting counter to hotspot - if (rec->destCharId < START_EXIT_ID) - rec->charHotspot->pauseCtr = rec->counter + 1; + if (rec.destCharId < START_EXIT_ID) + rec.charHotspot->pauseCtr = rec.counter + 1; // If counter has reached zero, remove entry from list - if (rec->counter == 0) + if (rec.counter == 0) i = erase(i); else ++i; @@ -1101,13 +1098,13 @@ void PausedCharacterList::scan(Hotspot &h) { if (h.blockedState() != BS_NONE) { for (i = begin(); i != end(); ++i) { - PausedCharacter *rec = (*i).get(); + PausedCharacter &rec = **i; - if (rec->srcCharId == h.hotspotId()) { - rec->counter = IDLE_COUNTDOWN_SIZE; + if (rec.srcCharId == h.hotspotId()) { + rec.counter = IDLE_COUNTDOWN_SIZE; - if (rec->destCharId < START_EXIT_ID) - rec->charHotspot->pauseCtr = IDLE_COUNTDOWN_SIZE; + if (rec.destCharId < START_EXIT_ID) + rec.charHotspot->pauseCtr = IDLE_COUNTDOWN_SIZE; } } } @@ -1131,9 +1128,9 @@ int PausedCharacterList::check(uint16 charId, int numImpinging, uint16 *impingin // calling character and the impinging list entry bool foundEntry = false; for (i = res.pausedList().begin(); !foundEntry && (i != res.pausedList().end()); ++i) { - PausedCharacter *rec = (*i).get(); - foundEntry = (rec->srcCharId == charId) && - (rec->destCharId == hotspot->hotspotId()); + PausedCharacter const &rec = **i; + foundEntry = (rec.srcCharId == charId) && + (rec.destCharId == hotspot->hotspotId()); } if (foundEntry) @@ -1435,11 +1432,11 @@ Common::String CurrentActionStack::getDebugInfo() const { buffer += Common::String::format("CurrentActionStack::list num_actions=%d\n", size()); for (i = _actions.begin(); i != _actions.end(); ++i) { - CurrentActionEntry *entry = (*i).get(); - buffer += Common::String::format("style=%d room#=%d", entry->action(), entry->roomNumber()); + CurrentActionEntry const &entry = **i; + buffer += Common::String::format("style=%d room#=%d", entry.action(), entry.roomNumber()); - if (entry->hasSupportData()) { - CharacterScheduleEntry &rec = entry->supportData(); + if (entry.hasSupportData()) { + CharacterScheduleEntry &rec = entry.supportData(); buffer += Common::String::format(", action=%d params=", rec.action()); @@ -1464,8 +1461,7 @@ void CurrentActionStack::saveToStream(Common::WriteStream *stream) const { debugC(ERROR_DETAILED, kLureDebugAnimations, "%s", buffer.c_str()); for (ActionsList::const_iterator i = _actions.begin(); i != _actions.end(); ++i) { - CurrentActionEntry *rec = (*i).get(); - rec->saveToStream(stream); + (*i)->saveToStream(stream); } stream->writeByte(0xff); // End of list marker debugC(ERROR_DETAILED, kLureDebugAnimations, "Finished saving hotspot action stack"); diff --git a/engines/lure/room.cpp b/engines/lure/room.cpp index 4cb0cecd45..9a9313ece9 100644 --- a/engines/lure/room.cpp +++ b/engines/lure/room.cpp @@ -138,8 +138,8 @@ void Room::leaveRoom() { HotspotList &list = r.activeHotspots(); HotspotList::iterator i = list.begin(); while (i != list.end()) { - Hotspot *h = i->get(); - if (!h->persistant()) { + Hotspot const &h = **i; + if (!h.persistant()) { i = list.erase(i); } else { ++i; @@ -153,11 +153,11 @@ void Room::loadRoomHotspots() { HotspotDataList::iterator i; for (i = list.begin(); i != list.end(); ++i) { - HotspotData *rec = (*i).get(); + HotspotData const &rec = **i; - if ((rec->hotspotId < 0x7530) && (rec->roomNumber == _roomNumber) && - (rec->layer != 0)) - r.activateHotspot(rec->hotspotId); + if ((rec.hotspotId < 0x7530) && (rec.roomNumber == _roomNumber) && + (rec.layer != 0)) + r.activateHotspot(rec.hotspotId); } } @@ -252,24 +252,24 @@ CursorType Room::checkRoomExits() { RoomExitHotspotList::iterator i; for (i = exits.begin(); i != exits.end(); ++i) { - RoomExitHotspotData *rec = (*i).get(); + RoomExitHotspotData const &rec = **i; skipFlag = false; - if (rec->hotspotId != 0) { - join = res.getExitJoin(rec->hotspotId); + if (rec.hotspotId != 0) { + join = res.getExitJoin(rec.hotspotId); if ((join) && (join->blocked != 0)) skipFlag = true; } - if (!skipFlag && (m.x() >= rec->xs) && (m.x() <= rec->xe) && - (m.y() >= rec->ys) && (m.y() <= rec->ye)) { + if (!skipFlag && (m.x() >= rec.xs) && (m.x() <= rec.xe) && + (m.y() >= rec.ys) && (m.y() <= rec.ye)) { // Cursor is within exit area - CursorType cursorNum = (CursorType)rec->cursorNum; - _destRoomNumber = rec->destRoomNumber; + CursorType cursorNum = (CursorType)rec.cursorNum; + _destRoomNumber = rec.destRoomNumber; // If it's a hotspotted exit, change arrow to the + arrow - if (rec->hotspotId != 0) { - _hotspotId = rec->hotspotId; + if (rec.hotspotId != 0) { + _hotspotId = rec.hotspotId; _hotspot = res.getHotspot(_hotspotId); _hotspotNameId = _hotspot->nameId; _isExit = true; diff --git a/engines/lure/sound.cpp b/engines/lure/sound.cpp index bf0abdea07..298483bed8 100644 --- a/engines/lure/sound.cpp +++ b/engines/lure/sound.cpp @@ -107,8 +107,7 @@ void SoundManager::saveToStream(Common::WriteStream *stream) { SoundListIterator i; for (i = _activeSounds.begin(); i != _activeSounds.end(); ++i) { - SoundDescResource *rec = (*i).get(); - stream->writeByte(rec->soundNumber); + stream->writeByte((*i)->soundNumber); } stream->writeByte(0xff); } @@ -335,14 +334,14 @@ void SoundManager::tidySounds() { SoundListIterator i = _activeSounds.begin(); while (i != _activeSounds.end()) { - SoundDescResource *rec = (*i).get(); + SoundDescResource const &rec = **i; - if (musicInterface_CheckPlaying(rec->soundNumber)) + if (musicInterface_CheckPlaying(rec.soundNumber)) // Still playing, so move to next entry ++i; else { // Mark the channels that it used as now being free - Common::fill(_channelsInUse+rec->channel, _channelsInUse+rec->channel+rec->numChannels, false); + Common::fill(_channelsInUse + rec.channel, _channelsInUse + rec.channel + rec.numChannels, false); i = _activeSounds.erase(i); } @@ -356,10 +355,10 @@ void SoundManager::removeSounds() { SoundListIterator i = _activeSounds.begin(); while (i != _activeSounds.end()) { - SoundDescResource *rec = (*i).get(); + SoundDescResource const &rec = **i; - if ((rec->flags & SF_IN_USE) != 0) - musicInterface_Stop(rec->soundNumber); + if ((rec.flags & SF_IN_USE) != 0) + musicInterface_Stop(rec.soundNumber); ++i; } @@ -370,13 +369,13 @@ void SoundManager::restoreSounds() { SoundListIterator i = _activeSounds.begin(); while (i != _activeSounds.end()) { - SoundDescResource *rec = (*i).get(); + SoundDescResource const &rec = **i; - if ((rec->numChannels != 0) && ((rec->flags & SF_RESTORE) != 0)) { - Common::fill(_channelsInUse+rec->channel, _channelsInUse+rec->channel+rec->numChannels, true); + if ((rec.numChannels != 0) && ((rec.flags & SF_RESTORE) != 0)) { + Common::fill(_channelsInUse + rec.channel, _channelsInUse + rec.channel + rec.numChannels, true); - musicInterface_Play(rec->soundNumber, rec->channel, rec->numChannels); - musicInterface_SetVolume(rec->channel, rec->volume); + musicInterface_Play(rec.soundNumber, rec.channel, rec.numChannels); + musicInterface_SetVolume(rec.channel, rec.volume); } ++i; @@ -397,10 +396,10 @@ void SoundManager::fadeOut() { g_system->lockMutex(_soundMutex); MusicListIterator i; for (i = _playingSounds.begin(); i != _playingSounds.end(); ++i) { - MidiMusic *music = (*i).get(); - if (music->getVolume() > 0) { + MidiMusic &music = **i; + if (music.getVolume() > 0) { inProgress = true; - music->setVolume(music->getVolume() >= 10 ? (music->getVolume() - 10) : 0); + music.setVolume(music.getVolume() >= 10 ? music.getVolume() - 10 : 0); } } @@ -468,8 +467,7 @@ void SoundManager::musicInterface_Stop(uint8 soundNumber) { g_system->lockMutex(_soundMutex); MusicListIterator i; for (i = _playingSounds.begin(); i != _playingSounds.end(); ++i) { - MidiMusic *music = (*i).get(); - if (music->soundNumber() == soundNum) { + if ((*i)->soundNumber() == soundNum) { _playingSounds.erase(i); break; } @@ -489,8 +487,7 @@ bool SoundManager::musicInterface_CheckPlaying(uint8 soundNumber) { g_system->lockMutex(_soundMutex); MusicListIterator i; for (i = _playingSounds.begin(); i != _playingSounds.end(); ++i) { - MidiMusic *music = (*i).get(); - if (music->soundNumber() == soundNum) { + if ((*i)->soundNumber() == soundNum) { result = true; break; } @@ -511,9 +508,9 @@ void SoundManager::musicInterface_SetVolume(uint8 channelNum, uint8 volume) { g_system->lockMutex(_soundMutex); MusicListIterator i; for (i = _playingSounds.begin(); i != _playingSounds.end(); ++i) { - MidiMusic *music = (*i).get(); - if (music->channelNumber() == channelNum) - music->setVolume(volume); + MidiMusic &music = **i; + if (music.channelNumber() == channelNum) + music.setVolume(volume); } g_system->unlockMutex(_soundMutex); } @@ -528,8 +525,7 @@ void SoundManager::musicInterface_KillAll() { g_system->lockMutex(_soundMutex); MusicListIterator i; for (i = _playingSounds.begin(); i != _playingSounds.end(); ++i) { - MidiMusic *music = (*i).get(); - music->stopMusic(); + (*i)->stopMusic(); } _playingSounds.clear(); @@ -561,8 +557,7 @@ void SoundManager::musicInterface_TidySounds() { g_system->lockMutex(_soundMutex); MusicListIterator i = _playingSounds.begin(); while (i != _playingSounds.end()) { - MidiMusic *music = (*i).get(); - if (!music->isPlaying()) + if (!(*i)->isPlaying()) i = _playingSounds.erase(i); else ++i; @@ -583,9 +578,9 @@ void SoundManager::doTimer() { MusicListIterator i; for (i = _playingSounds.begin(); i != _playingSounds.end(); ++i) { - MidiMusic *music = (*i).get(); - if (music->isPlaying()) - music->onTimer(); + MidiMusic &music = **i; + if (music.isPlaying()) + music.onTimer(); } g_system->unlockMutex(_soundMutex); diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp index bfada8fde6..4d63647af5 100644 --- a/engines/lure/surface.cpp +++ b/engines/lure/surface.cpp @@ -1329,8 +1329,8 @@ bool CopyProtectionDialog::show() { ++hotspot6; // Add wording header and display screen - (hotspot2->get())->setFrameNumber(1); - (hotspot2->get())->copyTo(&screen.screen()); + (*hotspot2)->setFrameNumber(1); + (*hotspot2)->copyTo(&screen.screen()); screen.update(); screen.setPalette(&p); @@ -1340,8 +1340,8 @@ bool CopyProtectionDialog::show() { } while (!events.interruptableDelay(100)); // Change title text to selection - (hotspot2->get())->setFrameNumber(0); - (hotspot2->get())->copyTo(&screen.screen()); + (*hotspot2)->setFrameNumber(0); + (*hotspot2)->copyTo(&screen.screen()); screen.update(); // Clear any prior try @@ -1356,8 +1356,8 @@ bool CopyProtectionDialog::show() { HotspotsList::iterator tmpHotspot = _hotspots.begin(); for (int i = 0; i < _charIndex + 3; i++) ++tmpHotspot; - (tmpHotspot->get())->setFrameNumber(10); // Blank space - (tmpHotspot->get())->copyTo(&screen.screen()); + (*tmpHotspot)->setFrameNumber(10); // Blank space + (*tmpHotspot)->copyTo(&screen.screen()); screen.update(); } else if ((events.event().kbd.keycode >= Common::KEYCODE_0) && @@ -1366,8 +1366,8 @@ bool CopyProtectionDialog::show() { for (int i = 0; i < _charIndex + 3; i++) ++tmpHotspot; // Number pressed - (tmpHotspot->get())->setFrameNumber(events.event().kbd.ascii - '0'); - (tmpHotspot->get())->copyTo(&screen.screen()); + (*tmpHotspot)->setFrameNumber(events.event().kbd.ascii - '0'); + (*tmpHotspot)->copyTo(&screen.screen()); ++_charIndex; } @@ -1385,11 +1385,11 @@ bool CopyProtectionDialog::show() { return false; // At this point, two page numbers have been entered - validate them - int page1 = ((hotspot3->get())->frameNumber() * 10) + (hotspot4->get())->frameNumber(); - int page2 = ((hotspot5->get())->frameNumber() * 10) + (hotspot6->get())->frameNumber(); + int page1 = ((*hotspot3)->frameNumber() * 10) + (*hotspot4)->frameNumber(); + int page2 = ((*hotspot5)->frameNumber() * 10) + (*hotspot6)->frameNumber(); - if ((page1 == pageNumbers[(hotspot0->get())->frameNumber()]) && - (page2 == pageNumbers[(hotspot1->get())->frameNumber()])) + if ((page1 == pageNumbers[(*hotspot0)->frameNumber()]) && + (page2 == pageNumbers[(*hotspot1)->frameNumber()])) return true; } @@ -1404,11 +1404,11 @@ void CopyProtectionDialog::chooseCharacters() { int char2 = rnd.getRandomNumber(19); HotspotsList::iterator curHotspot = _hotspots.begin(); - (curHotspot->get())->setFrameNumber(char1); - (curHotspot->get())->copyTo(&screen.screen()); + (*curHotspot)->setFrameNumber(char1); + (*curHotspot)->copyTo(&screen.screen()); ++curHotspot; - (curHotspot->get())->setFrameNumber(char2); - (curHotspot->get())->copyTo(&screen.screen()); + (*curHotspot)->setFrameNumber(char2); + (*curHotspot)->copyTo(&screen.screen()); screen.update(); } diff --git a/gui/debugger.cpp b/gui/debugger.cpp index 26e62dc1d9..972163df6f 100644 --- a/gui/debugger.cpp +++ b/gui/debugger.cpp @@ -200,9 +200,8 @@ void Debugger::enter() { bool Debugger::handleCommand(int argc, const char **argv, bool &result) { if (_cmds.contains(argv[0])) { - Debuglet *debuglet = _cmds[argv[0]].get(); - assert(debuglet); - result = (*debuglet)(argc, argv); + assert(_cmds[argv[0]]); + result = (*_cmds[argv[0]])(argc, argv); return true; } -- cgit v1.2.3