aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/object.cpp
diff options
context:
space:
mode:
authorMax Horn2006-09-16 13:38:43 +0000
committerMax Horn2006-09-16 13:38:43 +0000
commitb860f002b2f1f1a6cc67a9deb8360a8d421e2a4e (patch)
tree144c8c7d881894583afdd66b3a584f38520fd699 /engines/scumm/object.cpp
parent61626263236a4e3b9397bd3dfd9c467a4a9a0d31 (diff)
downloadscummvm-rg350-b860f002b2f1f1a6cc67a9deb8360a8d421e2a4e.tar.gz
scummvm-rg350-b860f002b2f1f1a6cc67a9deb8360a8d421e2a4e.tar.bz2
scummvm-rg350-b860f002b2f1f1a6cc67a9deb8360a8d421e2a4e.zip
Replaced checkRange by assertRange, which has (a) an (IMO) more logical order of parameters, and (b) removes lots of useless duplicate information in error messages
svn-id: r23885
Diffstat (limited to 'engines/scumm/object.cpp')
-rw-r--r--engines/scumm/object.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp
index 85c4d46247..4cb8122a4f 100644
--- a/engines/scumm/object.cpp
+++ b/engines/scumm/object.cpp
@@ -55,9 +55,9 @@ struct BompHeader { /* Bomp header */
bool ScummEngine::getClass(int obj, int cls) const {
- checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getClass");
+ assertRange(0, obj, _numGlobalObjects - 1, "object");
cls &= 0x7F;
- checkRange(32, 1, cls, "Class %d out of range in getClass");
+ assertRange(1, cls, 32, "class");
if (_game.features & GF_SMALL_HEADER) {
// Translate the new (V5) object classes to the old classes
@@ -82,9 +82,9 @@ bool ScummEngine::getClass(int obj, int cls) const {
}
void ScummEngine::putClass(int obj, int cls, bool set) {
- checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in putClass");
+ assertRange(0, obj, _numGlobalObjects - 1, "object");
cls &= 0x7F;
- checkRange(32, 1, cls, "Class %d out of range in putClass");
+ assertRange(1, cls, 32, "class");
if (_game.features & GF_SMALL_HEADER) {
// Translate the new (V5) object classes to the old classes
@@ -116,18 +116,18 @@ void ScummEngine::putClass(int obj, int cls, bool set) {
}
int ScummEngine::getOwner(int obj) const {
- checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getOwner");
+ assertRange(0, obj, _numGlobalObjects - 1, "object");
return _objectOwnerTable[obj];
}
void ScummEngine::putOwner(int obj, int owner) {
- checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in putOwner");
- checkRange(0xFF, 0, owner, "Owner %d out of range in putOwner");
+ assertRange(0, obj, _numGlobalObjects - 1, "object");
+ assertRange(0, owner, 0xFF, "owner");
_objectOwnerTable[obj] = owner;
}
int ScummEngine::getState(int obj) {
- checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getState");
+ assertRange(0, obj, _numGlobalObjects - 1, "object");
if (!_copyProtection) {
// I knew LucasArts sold cracked copies of the original Maniac Mansion,
@@ -147,13 +147,13 @@ int ScummEngine::getState(int obj) {
}
void ScummEngine::putState(int obj, int state) {
- checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in putState");
- checkRange(0xFF, 0, state, "State %d out of range in putState");
+ assertRange(0, obj, _numGlobalObjects - 1, "object");
+ assertRange(0, state, 0xFF, "state");
_objectStateTable[obj] = state;
}
int ScummEngine::getObjectRoom(int obj) const {
- checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getObjectRoom");
+ assertRange(0, obj, _numGlobalObjects - 1, "object");
return _objectRoomTable[obj];
}
@@ -427,7 +427,7 @@ void ScummEngine::drawObject(int obj, int arg) {
if (od.obj_nr == 0)
return;
- checkRange(_numGlobalObjects - 1, 0, od.obj_nr, "Object %d out of range in drawObject");
+ assertRange(0, od.obj_nr, _numGlobalObjects - 1, "object");
const int xpos = od.x_pos / 8;
const int ypos = od.y_pos;
@@ -1619,7 +1619,7 @@ void ScummEngine_v6::drawBlastObject(BlastObject *eo) {
vs = &virtscr[0];
- checkRange(_numGlobalObjects - 1, 30, eo->number, "Illegal Blast object %d");
+ assertRange(30, eo->number, _numGlobalObjects - 1, "blast object");
objnum = getObjectIndex(eo->number);
if (objnum == -1)