[Scummvm-cvs-logs] CVS: scummvm/scumm object.cpp,1.134,1.135

Max Horn fingolfin at users.sourceforge.net
Sun Jul 27 17:05:13 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv20330

Modified Files:
	object.cpp 
Log Message:
fix return values in getObjectOrActorXY; turned unsafe derefActorSafe call into derefActor (return value of derefActorSafe was used w/o checking it for 0)

Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.cpp,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -d -r1.134 -r1.135
--- object.cpp	24 Jul 2003 17:44:00 -0000	1.134
+++ object.cpp	28 Jul 2003 00:04:20 -0000	1.135
@@ -199,10 +199,10 @@
 int Scumm::getObjectOrActorXY(int object, int &x, int &y) {
 	if (object < _numActors) {
 		Actor *act = derefActorSafe(object, "getObjectOrActorXY");
-		if (!act) 
-			return 0; 
-		else
+		if (act)
 			return act->getActorXYPos(x, y);
+		else
+			return -1;
 	}
 
 	switch (whereIsObject(object)) {
@@ -210,9 +210,9 @@
 		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;
+			return -1;
 	}
 	getObjectXYPos(object, x, y);
 	return 0;
@@ -461,7 +461,7 @@
 					nukeResource(rtFlObject, _objs[i].fl_object_index);
 					_objs[i].obj_nr = 0;
 					_objs[i].fl_object_index = 0;
-				} 
+				}
 			}
 		}
 	}





More information about the Scummvm-git-logs mailing list