[Scummvm-cvs-logs] scummvm master -> e40ba4c1354fabc0d1bd81a6ab80cd5f349d88fa
fuzzie
fuzzie at fuzzie.org
Tue Mar 13 15:47:11 CET 2012
This automated email contains information about 8 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
e618e6794d JANITORIAL: Remove unnecessary empty default constructors/destructors.
983cd21294 JANITORIAL: Do not convert false to a null pointer.
bc238a5ff3 JANITORIAL: Use appropriate type for loop counter.
d21cef4117 JANITORIAL: Avoid the ugly operator invocation syntax.
337d5da913 JANITORIAL: Make getters const.
75efdd2d84 JANITORIAL: Replace (x ? false : true) by !(x).
612bfe4092 JANITORIAL: Remove dead code.
e40ba4c135 JANITORIAL: Simply use *x instead of *x.get() on smart pointers.
Commit: e618e6794ddcd528d157000c01e4f75dc6de3e2f
https://github.com/scummvm/scummvm/commit/e618e6794ddcd528d157000c01e4f75dc6de3e2f
Author: Christoph Mallon (christoph.mallon at gmx.de)
Date: 2012-03-13T07:42:30-07:00
Commit Message:
JANITORIAL: Remove unnecessary empty default constructors/destructors.
Changed paths:
backends/platform/ps2/icon.h
backends/platform/psp/default_display_client.h
engines/saga/sndres.cpp
engines/saga/sndres.h
graphics/imagedec.h
diff --git a/backends/platform/ps2/icon.h b/backends/platform/ps2/icon.h
index bc614bf..3ad1991 100644
--- a/backends/platform/ps2/icon.h
+++ b/backends/platform/ps2/icon.h
@@ -22,10 +22,6 @@
class PS2Icon {
public:
- PS2Icon() {};
-
- ~PS2Icon() {};
-
uint16 decompressData(uint16 **data);
void setup(mcIcon *icon);
};
diff --git a/backends/platform/psp/default_display_client.h b/backends/platform/psp/default_display_client.h
index e1cd8e7..721a7e6 100644
--- a/backends/platform/psp/default_display_client.h
+++ b/backends/platform/psp/default_display_client.h
@@ -65,9 +65,6 @@ protected:
*/
class Overlay : public DefaultDisplayClient {
public:
- Overlay() {}
- ~Overlay() {}
-
void init();
bool allocate();
void setBytesPerPixel(uint32 size);
@@ -85,7 +82,6 @@ public:
memset(&_pixelFormat, 0, sizeof(_pixelFormat));
memset(&_frameBuffer, 0, sizeof(_frameBuffer));
}
- ~Screen() {}
void init();
bool allocate();
diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp
index 5a97eb6..7104403 100644
--- a/engines/saga/sndres.cpp
+++ b/engines/saga/sndres.cpp
@@ -104,9 +104,6 @@ SndRes::SndRes(SagaEngine *vm) : _vm(vm), _sfxContext(NULL), _voiceContext(NULL)
}
}
-SndRes::~SndRes() {
-}
-
void SndRes::setVoiceBank(int serial) {
Common::File *file;
if (_voiceSerial == serial)
diff --git a/engines/saga/sndres.h b/engines/saga/sndres.h
index 979c028..bc38bed 100644
--- a/engines/saga/sndres.h
+++ b/engines/saga/sndres.h
@@ -39,7 +39,6 @@ class SndRes {
public:
SndRes(SagaEngine *vm);
- ~SndRes();
void playSound(uint32 resourceId, int volume, bool loop);
void playVoice(uint32 resourceId);
diff --git a/graphics/imagedec.h b/graphics/imagedec.h
index e839d09..b03b8bc 100644
--- a/graphics/imagedec.h
+++ b/graphics/imagedec.h
@@ -36,7 +36,6 @@ struct Surface;
class ImageDecoder {
public:
- ImageDecoder() {}
virtual ~ImageDecoder() {}
static Surface *loadFile(const Common::String &name, const PixelFormat &format);
Commit: 983cd2129496305bd68b12adde3117ef247135d1
https://github.com/scummvm/scummvm/commit/983cd2129496305bd68b12adde3117ef247135d1
Author: Christoph Mallon (christoph.mallon at gmx.de)
Date: 2012-03-13T07:42:38-07:00
Commit Message:
JANITORIAL: Do not convert false to a null pointer.
Changed paths:
engines/cge/bitmap.cpp
diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp
index 37f4eb0..309b89b 100644
--- a/engines/cge/bitmap.cpp
+++ b/engines/cge/bitmap.cpp
@@ -158,7 +158,7 @@ BitmapPtr Bitmap::code() {
debugC(1, kCGEDebugBitmap, "Bitmap::code()");
if (!_m)
- return false;
+ return NULL;
uint16 cnt;
Commit: bc238a5ff38c5cb0ed563a3c56ade155b511bbde
https://github.com/scummvm/scummvm/commit/bc238a5ff38c5cb0ed563a3c56ade155b511bbde
Author: Christoph Mallon (christoph.mallon at gmx.de)
Date: 2012-03-13T07:42:53-07:00
Commit Message:
JANITORIAL: Use appropriate type for loop counter.
Changed paths:
engines/saga/actor_path.cpp
diff --git a/engines/saga/actor_path.cpp b/engines/saga/actor_path.cpp
index 3e10aba..0fb072b 100644
--- a/engines/saga/actor_path.cpp
+++ b/engines/saga/actor_path.cpp
@@ -223,7 +223,6 @@ int Actor::fillPathArray(const Point &fromPoint, const Point &toPoint, Point &be
int currentRating;
Point bestPath;
int pointCounter;
- int startDirection;
const PathDirectionData *samplePathDirection;
Point nextPoint;
int directionCount;
@@ -235,7 +234,7 @@ int Actor::fillPathArray(const Point &fromPoint, const Point &toPoint, Point &be
bestRating = quickDistance(fromPoint, toPoint, compressX);
bestPath = fromPoint;
- for (startDirection = 0; startDirection < 4; startDirection++) {
+ for (int8 startDirection = 0; startDirection < 4; startDirection++) {
PathDirectionData tmp = { startDirection, fromPoint.x, fromPoint.y };
pathDirectionQueue.push_back(tmp);
}
Commit: d21cef411721984d4c6cabc7df04cbab9b725978
https://github.com/scummvm/scummvm/commit/d21cef411721984d4c6cabc7df04cbab9b725978
Author: Christoph Mallon (christoph.mallon at gmx.de)
Date: 2012-03-13T07:43:23-07:00
Commit Message:
JANITORIAL: Avoid the ugly operator invocation syntax.
Changed paths:
engines/lure/room.cpp
engines/mohawk/myst_areas.cpp
engines/mohawk/myst_scripts.cpp
engines/parallaction/objects.h
engines/tsage/graphics.cpp
diff --git a/engines/lure/room.cpp b/engines/lure/room.cpp
index 219ed02..4cb0cec 100644
--- a/engines/lure/room.cpp
+++ b/engines/lure/room.cpp
@@ -138,7 +138,7 @@ void Room::leaveRoom() {
HotspotList &list = r.activeHotspots();
HotspotList::iterator i = list.begin();
while (i != list.end()) {
- Hotspot *h = (i.operator*()).get();
+ Hotspot *h = i->get();
if (!h->persistant()) {
i = list.erase(i);
} else {
@@ -437,7 +437,7 @@ void Room::update() {
// Handle first layer (layer 3)
for (i = hotspots.begin(); i != hotspots.end(); ++i) {
- Hotspot &h = *i.operator*();
+ Hotspot &h = **i;
if ((h.roomNumber() == _roomNumber) && h.isActiveAnimation() && (h.layer() == 3)) {
addAnimation(h);
@@ -449,28 +449,28 @@ void Room::update() {
Common::List<Hotspot *> tempList;
Common::List<Hotspot *>::iterator iTemp;
for (i = hotspots.begin(); i != hotspots.end(); ++i) {
- Hotspot *h = (i.operator*()).get();
+ Hotspot *h = i->get();
if ((h->layer() != 1) || (h->roomNumber() != _roomNumber) ||
h->skipFlag() || !h->isActiveAnimation())
continue;
int16 endY = h->y() + h->heightCopy();
for (iTemp = tempList.begin(); iTemp != tempList.end(); ++iTemp) {
- Hotspot *hTemp = iTemp.operator*();
+ Hotspot *hTemp = *iTemp;
int16 tempY = hTemp->y() + hTemp->heightCopy();
if (endY < tempY) break;
}
tempList.insert(iTemp, h);
}
for (iTemp = tempList.begin(); iTemp != tempList.end(); ++iTemp) {
- Hotspot &h = *iTemp.operator*();
+ Hotspot &h = **iTemp;
addAnimation(h);
addLayers(h);
}
// Handle third layer (layer 2)
for (i = hotspots.begin(); i != hotspots.end(); ++i) {
- Hotspot &h = *i.operator*();
+ Hotspot &h = **i;
if ((h.roomNumber() == _roomNumber) && h.isActiveAnimation() && (h.layer() == 2)) {
addAnimation(h);
diff --git a/engines/mohawk/myst_areas.cpp b/engines/mohawk/myst_areas.cpp
index fe33cea..a54b67b 100644
--- a/engines/mohawk/myst_areas.cpp
+++ b/engines/mohawk/myst_areas.cpp
@@ -134,7 +134,7 @@ const Common::String MystResourceType5::describe() {
desc += " ops:";
for (uint i = 0; i < _script->size(); i++)
- desc += " " + _vm->_scriptParser->getOpcodeDesc(_script->operator[](i).opcode);
+ desc += " " + _vm->_scriptParser->getOpcodeDesc((*_script)[i].opcode);
}
return desc;
diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp
index b935331..107a8b0 100644
--- a/engines/mohawk/myst_scripts.cpp
+++ b/engines/mohawk/myst_scripts.cpp
@@ -161,7 +161,7 @@ void MystScriptParser::runScript(MystScript script, MystResource *invokingResour
_vm->_gfx->enableDrawingTimeSimulation(true);
for (uint16 i = 0; i < script->size(); i++) {
- MystScriptEntry &entry = script->operator[](i);
+ MystScriptEntry &entry = (*script)[i];
debugC(kDebugScript, "\tOpcode %d: %d", i, entry.opcode);
if (entry.type == kMystScriptNormal)
@@ -207,7 +207,7 @@ MystScript MystScriptParser::readScript(Common::SeekableReadStream *stream, Myst
script->resize(opcodeCount);
for (uint16 i = 0; i < opcodeCount; i++) {
- MystScriptEntry &entry = script->operator[](i);
+ MystScriptEntry &entry = (*script)[i];
entry.type = type;
// Resource ID only exists in INIT and EXIT scripts
diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h
index 387e7af..81761b2 100644
--- a/engines/parallaction/objects.h
+++ b/engines/parallaction/objects.h
@@ -377,12 +377,12 @@ public:
int16 getValue() const {
assert(_accessor);
- return _accessor->operator()();
+ return (*_accessor)();
}
void setValue(int16 value) {
assert(_mutator);
- _mutator->operator()(value);
+ (*_mutator)(value);
}
};
diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp
index b3dceba..0781ae4 100644
--- a/engines/tsage/graphics.cpp
+++ b/engines/tsage/graphics.cpp
@@ -230,7 +230,7 @@ GfxSurface::GfxSurface(const GfxSurface &s) {
_lockSurfaceCtr = 0;
_customSurface = NULL;
_trackDirtyRects = false;
- this->operator =(s);
+ *this = s;
}
GfxSurface::~GfxSurface() {
Commit: 337d5da913477889e9b2312ecce02e52c5ddf803
https://github.com/scummvm/scummvm/commit/337d5da913477889e9b2312ecce02e52c5ddf803
Author: Christoph Mallon (christoph.mallon at gmx.de)
Date: 2012-03-13T07:43:30-07:00
Commit Message:
JANITORIAL: Make getters const.
Changed paths:
engines/lure/hotspots.cpp
engines/lure/hotspots.h
engines/lure/res_struct.cpp
engines/lure/res_struct.h
diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp
index c7e7e81..698df87 100644
--- a/engines/lure/hotspots.cpp
+++ b/engines/lure/hotspots.cpp
@@ -430,7 +430,7 @@ bool Hotspot::isActiveAnimation() {
return ((_numFrames != 0) && (_layer != 0));
}
-uint16 Hotspot::nameId() {
+uint16 Hotspot::nameId() const {
if (_data == NULL)
return 0;
else
@@ -2286,7 +2286,7 @@ void Hotspot::startTalk(HotspotData *charHotspot, uint16 id) {
charHotspot->hotspotId, id);
}
-void Hotspot::saveToStream(Common::WriteStream *stream) {
+void Hotspot::saveToStream(Common::WriteStream *stream) const {
if (_data)
_data->npcSchedule.saveToStream(stream);
else
@@ -4113,7 +4113,7 @@ void HotspotTickHandlers::npcRoomChange(Hotspot &h) {
// This method performs rounding of the number of steps depending on direciton
-int WalkingActionEntry::numSteps() {
+int WalkingActionEntry::numSteps() const {
switch (_direction) {
case UP:
case DOWN:
@@ -4496,7 +4496,7 @@ void PathFinder::initVars() {
_countdownCtr -= 700;
}
-void PathFinder::saveToStream(Common::WriteStream *stream) {
+void PathFinder::saveToStream(Common::WriteStream *stream) const {
stream->writeByte(_inUse);
if (_inUse) {
@@ -4504,8 +4504,7 @@ void PathFinder::saveToStream(Common::WriteStream *stream) {
stream->write(_layer, sizeof(RoomPathsDecompressedData));
// Save any active step sequence
- WalkingActionList::iterator i;
- for (i = _list.begin(); i != _list.end(); ++i) {
+ for (WalkingActionList::const_iterator i = _list.begin(); i != _list.end(); ++i) {
WalkingActionEntry *entry = (*i).get();
stream->writeByte(entry->direction());
stream->writeSint16LE(entry->rawSteps());
@@ -4683,9 +4682,8 @@ bool Support::isCharacterInList(uint16 *lst, int numEntries, uint16 charId) {
return false;
}
-void HotspotList::saveToStream(Common::WriteStream *stream) {
- HotspotList::iterator i;
- for (i = begin(); i != end(); ++i) {
+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();
diff --git a/engines/lure/hotspots.h b/engines/lure/hotspots.h
index a58a344..85d36dc 100644
--- a/engines/lure/hotspots.h
+++ b/engines/lure/hotspots.h
@@ -111,9 +111,9 @@ private:
int _numSteps;
public:
WalkingActionEntry(Direction dir, int steps): _direction(dir), _numSteps(steps) {}
- Direction direction() { return _direction; }
+ Direction direction() const { return _direction; }
int &rawSteps() { return _numSteps; }
- int numSteps();
+ int numSteps() const;
};
enum PathFinderResult {PF_UNFINISHED, PF_OK, PF_DEST_OCCUPIED, PF_PART_PATH, PF_NO_WALK};
@@ -158,11 +158,11 @@ public:
Common::String getDebugInfo() const;
void pop() { _list.erase(_list.begin()); }
- WalkingActionEntry &top() { return **_list.begin(); }
- bool isEmpty() { return _list.empty(); }
+ WalkingActionEntry &top() const { return **_list.begin(); }
+ bool isEmpty() const { return _list.empty(); }
int &stepCtr() { return _stepCtr; }
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
@@ -279,62 +279,62 @@ public:
void setAnimation(uint16 newAnimId);
void setAnimationIndex(int animIndex);
void setAnimation(HotspotAnimData *newRecord);
- uint16 hotspotId() { return _hotspotId; }
- uint16 originalId() { return _originalId; }
- Surface &frames() { return *_frames; }
- HotspotAnimData &anim() { return *_anim; }
- HotspotData *resource() { return _data; }
- uint16 numFrames() { return _numFrames; }
- uint16 frameNumber() { return _frameNumber; }
+ uint16 hotspotId() const { return _hotspotId; }
+ uint16 originalId() const { return _originalId; }
+ Surface &frames() const { return *_frames; }
+ HotspotAnimData &anim() const { return *_anim; }
+ HotspotData *resource() const { return _data; }
+ uint16 numFrames() const { return _numFrames; }
+ uint16 frameNumber() const { return _frameNumber; }
void setFrameNumber(uint16 frameNum) {
assert(frameNum < _numFrames);
_frameNumber = frameNum;
}
void incFrameNumber();
- Direction direction() { return _direction; }
- uint16 frameWidth() { return _width; }
- int16 x() { return _startX; }
- int16 y() { return _startY; }
- int16 destX() { return _destX; }
- int16 destY() { return _destY; }
- int8 talkX() { return _talkX; }
- int8 talkY() { return _talkY; }
- uint16 destHotspotId() { return _destHotspotId; }
- uint16 blockedOffset() { return _blockedOffset; }
- uint8 exitCtr() { return _exitCtr; }
- bool walkFlag() { return _walkFlag; }
- uint16 startRoomNumber() { return _startRoomNumber; }
- uint16 width() { return _width; }
- uint16 height() { return _height; }
- uint16 widthCopy() { return _widthCopy; }
- uint16 heightCopy() { return _heightCopy; }
- uint16 yCorrection() { return _yCorrection; }
- uint16 charRectY() { return _charRectY; }
- uint16 roomNumber() { return _roomNumber; }
- uint16 talkScript() {
+ Direction direction() const { return _direction; }
+ uint16 frameWidth() const { return _width; }
+ int16 x() const { return _startX; }
+ int16 y() const { return _startY; }
+ int16 destX() const { return _destX; }
+ int16 destY() const { return _destY; }
+ int8 talkX() const { return _talkX; }
+ int8 talkY() const { return _talkY; }
+ uint16 destHotspotId() const { return _destHotspotId; }
+ uint16 blockedOffset() const { return _blockedOffset; }
+ uint8 exitCtr() const { return _exitCtr; }
+ bool walkFlag() const { return _walkFlag; }
+ uint16 startRoomNumber() const { return _startRoomNumber; }
+ uint16 width() const { return _width; }
+ uint16 height() const { return _height; }
+ uint16 widthCopy() const { return _widthCopy; }
+ uint16 heightCopy() const { return _heightCopy; }
+ uint16 yCorrection() const { return _yCorrection; }
+ uint16 charRectY() const { return _charRectY; }
+ uint16 roomNumber() const { return _roomNumber; }
+ uint16 talkScript() const {
assert(_data);
return _data->talkScriptOffset;
}
- uint16 hotspotScript() { return _hotspotScriptOffset; }
- uint8 layer() { return _layer; }
- bool skipFlag() { return _skipFlag; }
+ uint16 hotspotScript() const { return _hotspotScriptOffset; }
+ uint8 layer() const { return _layer; }
+ bool skipFlag() const { return _skipFlag; }
void setTickProc(uint16 newVal);
- bool persistant() { return _persistant; }
+ bool persistant() const { return _persistant; }
void setPersistant(bool value) { _persistant = value; }
- uint8 colorOffset() { return _colorOffset; }
+ uint8 colorOffset() const { return _colorOffset; }
void setColorOffset(uint8 value) { _colorOffset = value; }
void setRoomNumber(uint16 roomNum) {
_roomNumber = roomNum;
if (_data) _data->roomNumber = roomNum;
}
- uint16 nameId();
+ uint16 nameId() const;
const char *getName();
bool isActiveAnimation();
void setPosition(int16 newX, int16 newY);
void setDestPosition(int16 newX, int16 newY) { _destX = newX; _destY = newY; }
void setDestHotspot(uint16 id) { _destHotspotId = id; }
void setExitCtr(uint8 value) { _exitCtr = value; }
- BlockedState blockedState() {
+ BlockedState blockedState() const {
assert(_data);
return _data->blockedState;
}
@@ -342,7 +342,7 @@ public:
assert(_data);
_data->blockedState = newState;
}
- bool blockedFlag() {
+ bool blockedFlag() const {
assert(_data);
return _data->blockedFlag;
}
@@ -376,7 +376,7 @@ public:
}
void setCharRectY(uint16 value) { _charRectY = value; }
void setSkipFlag(bool value) { _skipFlag = value; }
- CharacterMode characterMode() {
+ CharacterMode characterMode() const {
assert(_data != NULL);
return _data->characterMode;
}
@@ -384,7 +384,7 @@ public:
assert(_data != NULL);
_data->characterMode = value;
}
- uint16 delayCtr() {
+ uint16 delayCtr() const {
assert(_data);
return _data->delayCtr;
}
@@ -392,7 +392,7 @@ public:
assert(_data);
_data->delayCtr = value;
}
- uint16 pauseCtr() {
+ uint16 pauseCtr() const {
assert(_data);
return _data->pauseCtr;
}
@@ -400,7 +400,7 @@ public:
assert(_data);
_data->pauseCtr = value;
}
- VariantBool coveredFlag() {
+ VariantBool coveredFlag() const {
assert(_data);
return _data->coveredFlag;
}
@@ -408,7 +408,7 @@ public:
assert(_data);
_data->coveredFlag = value;
}
- uint16 useHotspotId() {
+ uint16 useHotspotId() const {
assert(_data);
return _data->useHotspotId;
}
@@ -416,7 +416,7 @@ public:
assert(_data);
_data->useHotspotId = value;
}
- uint16 talkGate() {
+ uint16 talkGate() const {
assert(_data);
return _data->talkGate;
}
@@ -424,7 +424,7 @@ public:
assert(_data);
_data->talkGate = value;
}
- uint16 supportValue() { return _supportValue; }
+ uint16 supportValue() const { return _supportValue; }
void setSupportValue(uint16 value) { _supportValue = value; }
void copyTo(Surface *dest);
@@ -449,16 +449,16 @@ public:
void doAction();
void doAction(Action action, HotspotData *hotspot);
- CurrentActionStack ¤tActions() {
+ CurrentActionStack ¤tActions() const {
assert(_data);
return _data->npcSchedule;
}
PathFinder &pathFinder() { return _pathFinder; }
DestStructure &tempDest() { return _tempDest; }
- uint16 frameCtr() { return _frameCtr; }
+ uint16 frameCtr() const { return _frameCtr; }
void setFrameCtr(uint16 value) { _frameCtr = value; }
void decrFrameCtr() { if (_frameCtr > 0) --_frameCtr; }
- uint8 actionCtr() {
+ uint8 actionCtr() const {
assert(_data);
return _data->actionCtr;
}
@@ -466,7 +466,7 @@ public:
assert(_data);
_data->actionCtr = v;
}
- uint8 voiceCtr() { return _voiceCtr; }
+ uint8 voiceCtr() const { return _voiceCtr; }
void setVoiceCtr(uint8 v) { _voiceCtr = v; }
// Miscellaneous
@@ -477,13 +477,13 @@ public:
void scheduleConverse(uint16 destHotspot, uint16 messageId);
void handleTalkDialog();
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
class HotspotList: public Common::List<Common::SharedPtr<Hotspot> > {
public:
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp
index 222f55b..ded6b5e 100644
--- a/engines/lure/res_struct.cpp
+++ b/engines/lure/res_struct.cpp
@@ -278,10 +278,8 @@ void RoomPathsData::decompress(RoomPathsDecompressedData &dataOut, int character
// Room data class
-void RoomDataList::saveToStream(Common::WriteStream *stream) {
- RoomDataList::iterator i;
-
- for (i = begin(); i != end(); ++i) {
+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();
@@ -317,8 +315,8 @@ RoomExitJoinData::RoomExitJoinData(RoomExitJoinResource *rec) {
blocked = rec->blocked;
}
-void RoomExitJoinList::saveToStream(Common::WriteStream *stream) {
- for (RoomExitJoinList::iterator i = begin(); i != end(); ++i) {
+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);
@@ -435,7 +433,7 @@ HotspotData::HotspotData(HotspotResource *rec) {
npcScheduleId = READ_LE_UINT16(&rec->npcSchedule);
}
-void HotspotData::saveToStream(Common::WriteStream *stream) {
+void HotspotData::saveToStream(Common::WriteStream *stream) const {
// Write out the basic fields
stream->writeUint16LE(nameId);
stream->writeUint16LE(descId);
@@ -534,9 +532,8 @@ void HotspotData::loadFromStream(Common::ReadStream *stream) {
// Hotspot data list
-void HotspotDataList::saveToStream(Common::WriteStream *stream) {
- iterator i;
- for (i = begin(); i != end(); ++i) {
+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);
@@ -699,13 +696,11 @@ TalkEntryData *TalkData::getResponse(int index) {
// The following class acts as a container for all the NPC conversations
-void TalkDataList::saveToStream(Common::WriteStream *stream) {
- TalkDataList::iterator i;
- for (i = begin(); i != end(); ++i) {
+void TalkDataList::saveToStream(Common::WriteStream *stream) const {
+ for (TalkDataList::const_iterator i = begin(); i != end(); ++i) {
TalkData *rec = (*i).get();
- TalkEntryList::iterator i2;
- for (i2 = rec->entries.begin(); i2 != rec->entries.end(); ++i2) {
+ for (TalkEntryList::const_iterator i2 = rec->entries.begin(); i2 != rec->entries.end(); ++i2) {
TalkEntryData *entry = (*i2).get();
stream->writeUint16LE(entry->descId);
}
@@ -716,9 +711,8 @@ void TalkDataList::loadFromStream(Common::ReadStream *stream) {
TalkDataList::iterator i;
for (i = begin(); i != end(); ++i) {
TalkData *rec = (*i).get();
- TalkEntryList::iterator i2;
- for (i2 = rec->entries.begin(); i2 != rec->entries.end(); ++i2) {
+ for (TalkEntryList::const_iterator i2 = rec->entries.begin(); i2 != rec->entries.end(); ++i2) {
TalkEntryData *entry = (*i2).get();
entry->descId = stream->readUint16LE();
}
@@ -812,10 +806,8 @@ void SequenceDelayList::clear(bool forceClear) {
}
}
-void SequenceDelayList::saveToStream(Common::WriteStream *stream) {
- SequenceDelayList::iterator i;
-
- for (i = begin(); i != end(); ++i) {
+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);
@@ -1016,7 +1008,7 @@ RandomActionSet *RandomActionList::getRoom(uint16 roomNumber) {
return NULL;
}
-void RandomActionSet::saveToStream(Common::WriteStream *stream) {
+void RandomActionSet::saveToStream(Common::WriteStream *stream) const {
stream->writeByte(numActions());
for (int actionIndex = 0; actionIndex < _numActions; ++actionIndex)
stream->writeByte((byte)_types[actionIndex]);
@@ -1030,8 +1022,8 @@ void RandomActionSet::loadFromStream(Common::ReadStream *stream) {
}
-void RandomActionList::saveToStream(Common::WriteStream *stream) {
- for (iterator i = begin(); i != end(); ++i)
+void RandomActionList::saveToStream(Common::WriteStream *stream) const {
+ for (const_iterator i = begin(); i != end(); ++i)
(*i)->saveToStream(stream);
}
@@ -1196,7 +1188,7 @@ BarEntry &BarmanLists::getDetails(uint16 roomNumber) {
error("Invalid room %d specified for barman details retrieval", roomNumber);
}
-void BarmanLists::saveToStream(Common::WriteStream *stream) {
+void BarmanLists::saveToStream(Common::WriteStream *stream) const {
for (int index = 0; index < 3; ++index) {
uint16 value = (_barList[index].currentCustomer == NULL) ? 0 :
(_barList[index].currentCustomer - &_barList[index].customers[0]) / sizeof(BarEntry) + 1;
@@ -1296,7 +1288,7 @@ void ValueTableData::setField(FieldName fieldName, uint16 value) {
setField((uint16) fieldName, value);
}
-void ValueTableData::saveToStream(Common::WriteStream *stream) {
+void ValueTableData::saveToStream(Common::WriteStream *stream) const {
// Write out the special fields
stream->writeUint16LE(_numGroats);
stream->writeSint16LE(_playerNewPos.position.x);
@@ -1371,7 +1363,7 @@ void CurrentActionEntry::setSupportData(uint16 entryId) {
setSupportData(newEntry);
}
-void CurrentActionEntry::saveToStream(Common::WriteStream *stream) {
+void CurrentActionEntry::saveToStream(Common::WriteStream *stream) const {
debugC(ERROR_DETAILED, kLureDebugAnimations, "Saving hotspot action entry dyn=%d id=%d",
hasSupportData(), hasSupportData() ? supportData().id() : 0);
stream->writeByte((uint8) _action);
@@ -1466,14 +1458,12 @@ Common::String CurrentActionStack::getDebugInfo() const {
return buffer;
}
-void CurrentActionStack::saveToStream(Common::WriteStream *stream) {
- ActionsList::iterator i;
-
+void CurrentActionStack::saveToStream(Common::WriteStream *stream) const {
debugC(ERROR_DETAILED, kLureDebugAnimations, "Saving hotspot action stack");
Common::String buffer = getDebugInfo();
debugC(ERROR_DETAILED, kLureDebugAnimations, "%s", buffer.c_str());
- for (i = _actions.begin(); i != _actions.end(); ++i) {
+ for (ActionsList::const_iterator i = _actions.begin(); i != _actions.end(); ++i) {
CurrentActionEntry *rec = (*i).get();
rec->saveToStream(stream);
}
diff --git a/engines/lure/res_struct.h b/engines/lure/res_struct.h
index 8d6c557..a4d2f76 100644
--- a/engines/lure/res_struct.h
+++ b/engines/lure/res_struct.h
@@ -300,7 +300,7 @@ public:
void load(byte *srcData) {
memcpy(_data, srcData, ROOM_PATHS_SIZE);
}
- const byte *data() { return _data; }
+ const byte *data() const { return _data; }
bool isOccupied(int x, int y);
bool isOccupied(int x, int y, int width);
void setOccupied(int x, int y, int width);
@@ -334,7 +334,7 @@ public:
class RoomDataList: public Common::List<Common::SharedPtr<RoomData> > {
public:
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
@@ -357,7 +357,7 @@ public:
class RoomExitJoinList: public Common::List<Common::SharedPtr<RoomExitJoinData> > {
public:
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
@@ -433,13 +433,13 @@ public:
if (_dynamicSupportData) delete _supportData;
}
- CurrentAction action() { return _action; }
- CharacterScheduleEntry &supportData() {
+ CurrentAction action() const { return _action; }
+ CharacterScheduleEntry &supportData() const {
if (!_supportData) error("Access made to non-defined action support record");
return *_supportData;
}
- bool hasSupportData() { return _supportData != NULL; }
- uint16 roomNumber() { return _roomNumber; }
+ bool hasSupportData() const { return _supportData != NULL; }
+ uint16 roomNumber() const { return _roomNumber; }
void setAction(CurrentAction newAction) { _action = newAction; }
void setRoomNumber(uint16 roomNum) { _roomNumber = roomNum; }
void setSupportData(CharacterScheduleEntry *newRec) {
@@ -452,7 +452,7 @@ public:
}
void setSupportData(uint16 entryId);
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
static CurrentActionEntry *loadFromStream(Common::ReadStream *stream);
};
@@ -505,7 +505,7 @@ public:
validateStack();
}
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
void copyFrom(CurrentActionStack &stack);
};
@@ -569,13 +569,13 @@ public:
void enable() { flags |= 0x80; }
void disable() { flags &= 0x7F; }
Direction nonVisualDirection() { return (Direction) scriptLoadFlag; }
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
class HotspotDataList: public Common::List<Common::SharedPtr<HotspotData> > {
public:
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
@@ -663,7 +663,7 @@ public:
class TalkDataList: public Common::List<Common::SharedPtr<TalkData> > {
public:
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
@@ -722,7 +722,7 @@ public:
void tick();
void clear(bool forceClear = false);
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
@@ -760,8 +760,8 @@ public:
RandomActionSet(uint16 *&offset);
~RandomActionSet();
- uint16 roomNumber() { return _roomNumber; }
- int numActions() { return _numActions; }
+ uint16 roomNumber() const { return _roomNumber; }
+ int numActions() const { return _numActions; }
void getEntry(int index, RandomActionType &actionType, uint16 &id) {
assert((index >= 0) && (index < _numActions));
actionType = _types[index];
@@ -772,14 +772,14 @@ public:
assert(_types[index] == REPEAT_ONCE);
_types[index] = REPEAT_ONCE_DONE;
}
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
class RandomActionList: public Common::List<Common::SharedPtr<RandomActionSet> > {
public:
RandomActionSet *getRoom(uint16 roomNumber);
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
@@ -828,7 +828,7 @@ public:
void reset();
BarEntry &getDetails(uint16 roomNumber);
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
@@ -923,7 +923,7 @@ public:
uint8 &hdrFlagMask() { return _hdrFlagMask; }
PlayerNewPosition &playerNewPos() { return _playerNewPos; }
- void saveToStream(Common::WriteStream *stream);
+ void saveToStream(Common::WriteStream *stream) const;
void loadFromStream(Common::ReadStream *stream);
};
Commit: 75efdd2d84e21f5d3d01afcc89d61289ae87e4a2
https://github.com/scummvm/scummvm/commit/75efdd2d84e21f5d3d01afcc89d61289ae87e4a2
Author: Christoph Mallon (christoph.mallon at gmx.de)
Date: 2012-03-13T07:43:36-07:00
Commit Message:
JANITORIAL: Replace (x ? false : true) by !(x).
Changed paths:
audio/softsynth/fmtowns_pc98/towns_pc98_driver.cpp
engines/kyra/eobcommon.cpp
engines/kyra/gui_eob.cpp
engines/kyra/screen_v2.cpp
engines/kyra/sequences_hof.cpp
engines/kyra/sprites_lol.cpp
engines/kyra/timer_eob.cpp
engines/kyra/vqa.cpp
engines/lastexpress/entities/chapters.cpp
engines/sci/engine/kmenu.cpp
engines/sci/graphics/controls16.cpp
engines/sci/graphics/menu.cpp
engines/sci/graphics/paint16.cpp
engines/scumm/gfx_towns.cpp
engines/sword25/kernel/inputpersistenceblock.cpp
engines/sword25/script/luabindhelper.h
gui/options.cpp
diff --git a/audio/softsynth/fmtowns_pc98/towns_pc98_driver.cpp b/audio/softsynth/fmtowns_pc98/towns_pc98_driver.cpp
index f3835c4..75e6bc3 100644
--- a/audio/softsynth/fmtowns_pc98/towns_pc98_driver.cpp
+++ b/audio/softsynth/fmtowns_pc98/towns_pc98_driver.cpp
@@ -1175,7 +1175,7 @@ void TownsPC98_AudioDriver::loadMusicData(uint8 *data, bool loadPaused) {
_patches = src_a + 4;
_finishedChannelsFlag = _finishedSSGFlag = _finishedRhythmFlag = 0;
- _musicPlaying = (loadPaused ? false : true);
+ _musicPlaying = !loadPaused;
}
void TownsPC98_AudioDriver::loadSoundEffectData(uint8 *data, uint8 trackNum) {
diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp
index 1489e4f..a63f123 100644
--- a/engines/kyra/eobcommon.cpp
+++ b/engines/kyra/eobcommon.cpp
@@ -2066,7 +2066,7 @@ bool EoBCoreEngine::characterAttackHitTest(int charIndex, int monsterIndex, int
s = CLIP(s, 1, 20);
- return s < m ? false : true;
+ return s >= m;
}
bool EoBCoreEngine::monsterAttackHitTest(EoBMonsterInPlay *m, int charIndex) {
@@ -2300,7 +2300,7 @@ bool EoBCoreEngine::trySavingThrow(void *target, int hpModifier, int level, int
s -= constMod[c->constitutionCur];
}
- return rollDice(1, 20) < s ? false : true;
+ return rollDice(1, 20) >= s;
}
bool EoBCoreEngine::specialAttackSavingThrow(int charIndex, int type) {
diff --git a/engines/kyra/gui_eob.cpp b/engines/kyra/gui_eob.cpp
index e8e69d5..76e4f0d 100644
--- a/engines/kyra/gui_eob.cpp
+++ b/engines/kyra/gui_eob.cpp
@@ -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)) ? false : true;
+ runLoop = !(*buttonList->buttonCallback.get())(buttonList);
if ((flgs2 & 2) && (flgs & 0x20))
runLoop = false;
@@ -2331,7 +2331,7 @@ bool GUI_EoB::confirmDialogue2(int dim, int id, int deflt) {
_screen->setFont(of);
_screen->setScreenDim(od);
- return newHighlight ? false : true;
+ return newHighlight == 0;
}
void GUI_EoB::messageDialogue(int dim, int id, int buttonTextCol) {
@@ -3548,7 +3548,7 @@ bool GUI_EoB::confirmDialogue(int id) {
_vm->removeInputTop();
if (inputFlag == _vm->_keyMap[Common::KEYCODE_KP5] || inputFlag == _vm->_keyMap[Common::KEYCODE_SPACE] || inputFlag == _vm->_keyMap[Common::KEYCODE_RETURN]) {
- result = lastHighlight ? false : true;
+ result = lastHighlight == 0;
inputFlag = 0x8021 + lastHighlight;
runLoop = false;
} else if (inputFlag == _vm->_keyMap[Common::KEYCODE_KP4] || inputFlag == _vm->_keyMap[Common::KEYCODE_LEFT] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP6] || inputFlag == _vm->_keyMap[Common::KEYCODE_RIGHT]) {
diff --git a/engines/kyra/screen_v2.cpp b/engines/kyra/screen_v2.cpp
index dde2249..7d4b064 100644
--- a/engines/kyra/screen_v2.cpp
+++ b/engines/kyra/screen_v2.cpp
@@ -365,7 +365,7 @@ bool Screen_v2::calcBounds(int w0, int h0, int &x1, int &y1, int &w1, int &h1, i
}
}
- return (w1 == -1) ? false : true;
+ return w1 != -1;
}
void Screen_v2::checkedPageUpdate(int srcPage, int dstPage) {
diff --git a/engines/kyra/sequences_hof.cpp b/engines/kyra/sequences_hof.cpp
index 686c3c9..f2abfb8 100644
--- a/engines/kyra/sequences_hof.cpp
+++ b/engines/kyra/sequences_hof.cpp
@@ -32,7 +32,7 @@ namespace Kyra {
void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) {
seq_init();
- bool allowSkip = (!(_flags.isDemo && !_flags.isTalkie) && (startSeq == kSequenceTitle)) ? false : true;
+ bool allowSkip = (_flags.isDemo && !_flags.isTalkie) || startSeq != kSequenceTitle;
if (endSeq == -1)
endSeq = startSeq;
@@ -74,7 +74,7 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) {
_seqFrameCounter = 0;
_seqStartTime = _system->getMillis();
- allowSkip = (!(_flags.isDemo && !_flags.isTalkie) && (seqNum == kSequenceTitle)) ? false : true;
+ allowSkip = (_flags.isDemo && !_flags.isTalkie) || seqNum != kSequenceTitle;
Sequence cseq = _sequences->seq[seqNum];
SeqProc cb = _callbackS[seqNum];
diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp
index 5a05d81..a07abd4 100644
--- a/engines/kyra/sprites_lol.cpp
+++ b/engines/kyra/sprites_lol.cpp
@@ -248,7 +248,7 @@ bool LoLEngine::updateMonsterAdjustBlocks(LoLMonster *monster) {
int16 fx2 = 0;
setLevelShapesDim(x2 + dims[y2], fx1, fx2, 13);
- return (fx1 >= fx2) ? false : true;
+ return fx1 < fx2;
}
void LoLEngine::placeMonster(LoLMonster *monster, uint16 x, uint16 y) {
@@ -1447,7 +1447,7 @@ void LoLEngine::rearrangeAttackingMonster(LoLMonster *monster) {
uint16 mx = monster->x;
uint16 my = monster->y;
uint16 *c = (t & 1) ? &my : &mx;
- bool centered = (*c & 0x7f) ? false : true;
+ bool centered = (*c & 0x7f) == 0;
bool posFlag = true;
if (monster->properties->maxWidth <= 63) {
diff --git a/engines/kyra/timer_eob.cpp b/engines/kyra/timer_eob.cpp
index de1becf..766fe45 100644
--- a/engines/kyra/timer_eob.cpp
+++ b/engines/kyra/timer_eob.cpp
@@ -186,7 +186,7 @@ void EoBCoreEngine::timerProcessFlyingObjects(int timerNum) {
if (!fo->enable)
continue;
- bool endFlight = fo->distance ? false : true;
+ bool endFlight = fo->distance == 0;
uint8 pos = dirPosIndex[(fo->direction << 2) + (fo->curPos & 3)];
uint16 bl = fo->curBlock;
diff --git a/engines/kyra/vqa.cpp b/engines/kyra/vqa.cpp
index 04455ae..471e83c 100644
--- a/engines/kyra/vqa.cpp
+++ b/engines/kyra/vqa.cpp
@@ -395,7 +395,7 @@ void VQAMovie::displayFrame(uint frameNum) {
if (frameNum >= _header.numFrames || !_opened)
return;
- bool foundSound = _stream ? false : true;
+ bool foundSound = !_stream;
bool foundFrame = false;
uint i;
diff --git a/engines/lastexpress/entities/chapters.cpp b/engines/lastexpress/entities/chapters.cpp
index 96e08ba..4ef2dc5 100644
--- a/engines/lastexpress/entities/chapters.cpp
+++ b/engines/lastexpress/entities/chapters.cpp
@@ -1805,7 +1805,7 @@ void Chapters::enterExitHelper(bool isEnteringStation) {
getObjects()->update(kObjectHandleOutsideLeft, kEntityPlayer, kObjectLocation1, kCursorNormal, isEnteringStation ? kCursorNormal : kCursorHand);
getObjects()->update(kObjectHandleOutsideRight, kEntityPlayer, kObjectLocation1, kCursorNormal, isEnteringStation ? kCursorNormal : kCursorHand);
- getProgress().isTrainRunning = isEnteringStation ? false : true;
+ getProgress().isTrainRunning = !isEnteringStation;
if (isEnteringStation) {
ENTITY_PARAM(0, 2) = 1;
diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp
index 02aa1d3..05ba700 100644
--- a/engines/sci/engine/kmenu.cpp
+++ b/engines/sci/engine/kmenu.cpp
@@ -94,7 +94,7 @@ reg_t kDrawMenuBar(EngineState *s, int argc, reg_t *argv) {
reg_t kMenuSelect(EngineState *s, int argc, reg_t *argv) {
reg_t eventObject = argv[0];
- bool pauseSound = argc > 1 ? (argv[1].isNull() ? false : true) : true;
+ bool pauseSound = argc <= 1 || !argv[1].isNull();
return g_sci->_gfxMenu->kernelSelect(eventObject, pauseSound);
}
diff --git a/engines/sci/graphics/controls16.cpp b/engines/sci/graphics/controls16.cpp
index ab54e46..7c09969 100644
--- a/engines/sci/graphics/controls16.cpp
+++ b/engines/sci/graphics/controls16.cpp
@@ -297,7 +297,7 @@ void GfxControls16::kernelDrawButton(Common::Rect rect, reg_t obj, const char *t
_paint16->eraseRect(rect);
_paint16->frameRect(rect);
rect.grow(-2);
- _ports->textGreyedOutput(style & 1 ? false : true);
+ _ports->textGreyedOutput(!(style & SCI_CONTROLS_STYLE_ENABLED));
_text16->Box(text, false, rect, SCI_TEXT16_ALIGNMENT_CENTER, fontId);
_ports->textGreyedOutput(false);
rect.grow(1);
diff --git a/engines/sci/graphics/menu.cpp b/engines/sci/graphics/menu.cpp
index 6737297..47f34cf 100644
--- a/engines/sci/graphics/menu.cpp
+++ b/engines/sci/graphics/menu.cpp
@@ -286,7 +286,7 @@ void GfxMenu::kernelSetAttribute(uint16 menuId, uint16 itemId, uint16 attributeI
switch (attributeId) {
case SCI_MENU_ATTRIBUTE_ENABLED:
- itemEntry->enabled = value.isNull() ? false : true;
+ itemEntry->enabled = !value.isNull();
break;
case SCI_MENU_ATTRIBUTE_SAID:
itemEntry->saidVmPtr = value;
@@ -606,7 +606,7 @@ void GfxMenu::drawMenu(uint16 oldMenuId, uint16 newMenuId) {
listItemEntry = *listItemIterator;
if (listItemEntry->menuId == newMenuId) {
if (!listItemEntry->separatorLine) {
- _ports->textGreyedOutput(listItemEntry->enabled ? false : true);
+ _ports->textGreyedOutput(!listItemEntry->enabled);
_ports->moveTo(_menuRect.left, topPos);
_text16->DrawString(listItemEntry->textSplit.c_str());
_ports->moveTo(_menuRect.right - listItemEntry->textRightAlignedWidth - 5, topPos);
diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp
index 23177df..c951f33 100644
--- a/engines/sci/graphics/paint16.cpp
+++ b/engines/sci/graphics/paint16.cpp
@@ -513,7 +513,7 @@ reg_t GfxPaint16::kernelDisplay(const char *text, int argc, reg_t *argv) {
argc--; argv++;
break;
case SCI_DISPLAY_SETGREYEDOUTPUT:
- _ports->textGreyedOutput(argv[0].isNull() ? false : true);
+ _ports->textGreyedOutput(!argv[0].isNull());
argc--; argv++;
break;
case SCI_DISPLAY_SETFONT:
diff --git a/engines/scumm/gfx_towns.cpp b/engines/scumm/gfx_towns.cpp
index 8bffcab..f86a4e5 100644
--- a/engines/scumm/gfx_towns.cpp
+++ b/engines/scumm/gfx_towns.cpp
@@ -271,7 +271,7 @@ void TownsScreen::setupLayer(int layer, int width, int height, int numCol, void
l->enabled = true;
_layers[0].onBottom = true;
- _layers[1].onBottom = _layers[0].enabled ? false : true;
+ _layers[1].onBottom = !_layers[0].enabled;
l->ready = true;
}
@@ -424,7 +424,7 @@ void TownsScreen::toggleLayers(int flag) {
_layers[0].enabled = (flag & 1) ? true : false;
_layers[0].onBottom = true;
_layers[1].enabled = (flag & 2) ? true : false;
- _layers[1].onBottom = _layers[0].enabled ? false : true;
+ _layers[1].onBottom = !_layers[0].enabled;
_dirtyRects.clear();
_dirtyRects.push_back(Common::Rect(_width - 1, _height - 1));
diff --git a/engines/sword25/kernel/inputpersistenceblock.cpp b/engines/sword25/kernel/inputpersistenceblock.cpp
index cdce539..0fe5d88 100644
--- a/engines/sword25/kernel/inputpersistenceblock.cpp
+++ b/engines/sword25/kernel/inputpersistenceblock.cpp
@@ -86,7 +86,7 @@ void InputPersistenceBlock::read(bool &value) {
if (checkMarker(BOOL_MARKER)) {
uint uintBool = READ_LE_UINT32(_iter);
_iter += 4;
- value = uintBool == 0 ? false : true;
+ value = uintBool != 0;
} else {
value = false;
}
diff --git a/engines/sword25/script/luabindhelper.h b/engines/sword25/script/luabindhelper.h
index 0cb6d37..5223d44 100644
--- a/engines/sword25/script/luabindhelper.h
+++ b/engines/sword25/script/luabindhelper.h
@@ -40,7 +40,7 @@
namespace Sword25 {
#define lua_pushbooleancpp(L, b) (lua_pushboolean(L, b ? 1 : 0))
-#define lua_tobooleancpp(L, i) (lua_toboolean(L, i) == 0 ? false : true)
+#define lua_tobooleancpp(L, i) (lua_toboolean(L, i) != 0)
struct lua_constant_reg {
const char *Name;
diff --git a/gui/options.cpp b/gui/options.cpp
index 5085f9c..3a16bdd 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -1010,7 +1010,7 @@ bool OptionsDialog::loadMusicDeviceSetting(PopUpWidget *popup, Common::String se
for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) {
if (setting.empty() ? (preferredType == d->getMusicType()) : (drv == d->getCompleteId())) {
popup->setSelectedTag(d->getHandle());
- return popup->getSelected() == -1 ? false : true;
+ return popup->getSelected() != -1;
}
}
}
Commit: 612bfe40924c1d266476385d24a1b889bcf81209
https://github.com/scummvm/scummvm/commit/612bfe40924c1d266476385d24a1b889bcf81209
Author: Christoph Mallon (christoph.mallon at gmx.de)
Date: 2012-03-13T07:43:41-07:00
Commit Message:
JANITORIAL: Remove dead code.
Changed paths:
engines/lure/res.cpp
diff --git a/engines/lure/res.cpp b/engines/lure/res.cpp
index 6328301..001b882 100644
--- a/engines/lure/res.cpp
+++ b/engines/lure/res.cpp
@@ -386,7 +386,6 @@ RoomData *Resources::getRoom(uint16 roomNumber) {
for (i = _roomData.begin(); i != _roomData.end(); ++i) {
RoomData *rec = (*i).get();
if (rec->roomNumber == roomNumber) return rec;
- ++rec;
}
return NULL;
Commit: e40ba4c1354fabc0d1bd81a6ab80cd5f349d88fa
https://github.com/scummvm/scummvm/commit/e40ba4c1354fabc0d1bd81a6ab80cd5f349d88fa
Author: Christoph Mallon (christoph.mallon at gmx.de)
Date: 2012-03-13T07:43:59-07:00
Commit Message:
JANITORIAL: Simply use *x instead of *x.get() on smart pointers.
Changed paths:
common/translation.cpp
engines/kyra/gui_eob.cpp
engines/kyra/gui_lok.cpp
engines/kyra/gui_lol.cpp
engines/kyra/gui_v2.cpp
engines/lure/debugger.cpp
engines/lure/game.cpp
engines/lure/hotspots.cpp
engines/lure/menu.cpp
engines/lure/res.cpp
engines/lure/res_struct.cpp
engines/lure/room.cpp
engines/lure/sound.cpp
engines/lure/surface.cpp
gui/debugger.cpp
diff --git a/common/translation.cpp b/common/translation.cpp
index 219fce8..2bc31c6 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 76e4f0d..e3c0743 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 18470e5..b4e5148 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 b025aef..a79da06 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 580adb0..65f8bd4 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 ef4a22f..3fbbf84 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 9542c35..eaed7eb 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 698df87..ee7a185 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 61de2bf..5a0dd26 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 001b882..9ec6411 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 ded6b5e..aee4f11 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 4cb0cec..9a9313e 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 bf0abde..298483b 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 bfada8f..4d63647 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 26e62dc..972163d 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;
}
More information about the Scummvm-git-logs
mailing list