[Scummvm-cvs-logs] CVS: scummvm/scumm object.cpp,1.133,1.133.2.1
Max Horn
fingolfin at users.sourceforge.net
Mon Jul 28 06:00:05 CEST 2003
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv1601
Modified Files:
Tag: branch-0-5-0
object.cpp
Log Message:
added asserts from trunk
Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.cpp,v
retrieving revision 1.133
retrieving revision 1.133.2.1
diff -u -d -r1.133 -r1.133.2.1
--- object.cpp 30 Jun 2003 22:22:04 -0000 1.133
+++ object.cpp 28 Jul 2003 12:49:03 -0000 1.133.2.1
@@ -199,8 +199,8 @@
int Scumm::getObjectOrActorXY(int object, int &x, int &y) {
if (object < _numActors) {
Actor *act = derefActorSafe(object, "getObjectOrActorXY");
- if (!act)
- return 0;
+ if (!act)
+ return 0;
else
return act->getActorXYPos(x, y);
}
@@ -210,7 +210,7 @@
return -1;
case WIO_INVENTORY:
if (_objectOwnerTable[object] < _numActors)
- return derefActorSafe(_objectOwnerTable[object], "getObjectOrActorXY(2)")->getActorXYPos(x, y);
+ return derefActor(_objectOwnerTable[object], "getObjectOrActorXY(2)")->getActorXYPos(x, y);
else
return 0xFF;
}
@@ -223,7 +223,9 @@
* Returns X, Y and direction in angles
*/
void Scumm::getObjectXYPos(int object, int &x, int &y, int &dir) {
- ObjectData &od = _objs[getObjectIndex(object)];
+ int idx = getObjectIndex(object);
+ assert(idx >= 0);
+ ObjectData &od = _objs[idx];
int state;
const byte *ptr;
const ImageHeader *imhd;
@@ -242,6 +244,7 @@
return;
}
imhd = (const ImageHeader *)findResourceData(MKID('IMHD'), ptr);
+ assert(imhd);
if (_version == 8) {
x = od.x_pos + (int32)READ_LE_UINT32(&imhd->v8.hotspot[state].x);
y = od.y_pos + (int32)READ_LE_UINT32(&imhd->v8.hotspot[state].y);
@@ -461,7 +464,7 @@
nukeResource(rtFlObject, _objs[i].fl_object_index);
_objs[i].obj_nr = 0;
_objs[i].fl_object_index = 0;
- }
+ }
}
}
}
@@ -992,7 +995,7 @@
}
void Scumm::addObjectToInventory(uint obj, uint room) {
- int i, slot;
+ int idx, slot;
uint32 size;
const byte *ptr;
byte *dst;
@@ -1002,8 +1005,9 @@
CHECK_HEAP
if (whereIsObject(obj) == WIO_FLOBJECT) {
- i = getObjectIndex(obj);
- ptr = getResourceAddress(rtFlObject, _objs[i].fl_object_index) + 8;
+ idx = getObjectIndex(obj);
+ assert(idx >= 0);
+ ptr = getResourceAddress(rtFlObject, _objs[idx].fl_object_index) + 8;
size = READ_BE_UINT32(ptr + 4);
} else {
findObjectInRoom(&foir, foCodeHeader, obj, room);
@@ -1398,6 +1402,7 @@
}
int idx = getObjectIndex(objectNumber);
+ assert(idx >= 0);
eo = &_blastObjectQueue[_blastObjectQueuePos++];
eo->number = objectNumber;
More information about the Scummvm-git-logs
mailing list