[Scummvm-cvs-logs] CVS: scummvm/scumm object.cpp,1.44,1.45 resource.cpp,1.49,1.50 script.cpp,1.40,1.41
James Brown
ender at users.sourceforge.net
Sun Jan 12 00:33:04 CET 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm object.cpp,1.43,1.44 script.cpp,1.39,1.40 script_v5.cpp,1.12,1.13 scumm.h,1.127,1.128 verbs.cpp,1.17,1.18
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm object.cpp,1.45,1.46 verbs.cpp,1.18,1.19
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv22387/scumm
Modified Files:
object.cpp resource.cpp script.cpp
Log Message:
Small fix - _numLocalObjects is a 1-based array, so don't go reading bad memory :P
Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- object.cpp 12 Jan 2003 07:30:16 -0000 1.44
+++ object.cpp 12 Jan 2003 08:32:44 -0000 1.45
@@ -120,7 +120,7 @@
return i;
return -1;
} else {
- for (i = _numLocalObjects; i > 0; i--) {
+ for (i = (_numLocalObjects-1); i > 0; i--) {
if (_objs[i].obj_nr == object)
return i;
}
@@ -154,7 +154,7 @@
return WIO_NOT_FOUND;
}
- for (i = _numLocalObjects; i > 0; i--)
+ for (i = (_numLocalObjects-1); i > 0; i--)
if (_objs[i].obj_nr == object) {
if (_objs[i].fl_object_index)
return WIO_FLOBJECT;
@@ -274,7 +274,7 @@
int i, b;
byte a;
- for (i = 1; i <= _numLocalObjects; i++) {
+ for (i = 1; i < _numLocalObjects; i++) {
if ((_objs[i].obj_nr < 1) || getClass(_objs[i].obj_nr, 32))
continue;
b = i;
@@ -316,11 +316,11 @@
int i;
if (_features & GF_DRAWOBJ_OTHER_ORDER) {
- for (i = 1; i <= _numLocalObjects; i++)
+ for (i = 1; i < _numLocalObjects; i++)
if (_objs[i].obj_nr > 0)
drawRoomObject(i, arg);
} else {
- for (i = _numLocalObjects; i != 0; i--)
+ for (i = (_numLocalObjects-1); i != 0; i--)
if (_objs[i].obj_nr > 0)
drawRoomObject(i, arg);
}
@@ -457,7 +457,7 @@
assert(searchptr);
// Clear out old room objects (FIXME: Locking/FlObjects stuff?)
- for (i = 0; i <= _numLocalObjects; i++) {
+ for (i = 0; i < _numLocalObjects; i++) {
_objs[i].obj_nr = 0;
_objs[i].fl_object_index = 0;
}
@@ -508,7 +508,7 @@
else
obim_id = READ_LE_UINT16(&imhd->old.obj_id);
- for (j = 1; j <= _numLocalObjects; j++) {
+ for (j = 1; j < _numLocalObjects; j++) {
if (_objs[j].obj_nr == obim_id)
_objs[j].OBIMoffset = ptr - room;
}
@@ -516,7 +516,7 @@
}
// ENDERFIXME: Switch this one over to numLocals also
- for (i = 1; i <= _numLocalObjects; i++) {
+ for (i = 1; i < _numLocalObjects; i++) {
if (_objs[i].obj_nr)
setupRoomObject(&_objs[i], room);
}
@@ -573,7 +573,7 @@
obim_id = READ_LE_UINT16(ptr + 6);
- for (j = 1; j <= _numLocalObjects; j++) {
+ for (j = 1; j < _numLocalObjects; j++) {
if (_objs[j].obj_nr == obim_id)
_objs[j].OBIMoffset = ptr - room;
}
@@ -581,7 +581,7 @@
}
// ENDERFIXME: Switch to numLocals
- for (i = 1; i <= _numLocalObjects; i++) {
+ for (i = 1; i < _numLocalObjects; i++) {
if (_objs[i].obj_nr)
setupRoomObject(&_objs[i], room);
}
@@ -700,7 +700,7 @@
{
int i;
ObjectData *od = &_objs[1];
- for (i = 1; i <= _numLocalObjects; i++, od++) {
+ for (i = 1; i < _numLocalObjects; i++, od++) {
if (od->obj_nr > 0)
od->state = _objectStateTable[od->obj_nr];
}
@@ -734,7 +734,7 @@
_objs[i].obj_nr = 0;
_objs[i].fl_object_index = 0;
}
- } while (++i <= _numLocalObjects);
+ } while (++i < _numLocalObjects);
return;
}
@@ -764,7 +764,7 @@
int i, cnt;
uint32 *ptr;
- for (i = 1; i <= _numLocalObjects; i++) {
+ for (i = 1; i < _numLocalObjects; i++) {
if (_objs[i].obj_nr == (uint16)obj) {
if (_objs[i].width != 0) {
ptr = &gfxUsageBits[_objs[i].x_pos >> 3];
@@ -831,7 +831,7 @@
if (_objectOwnerTable[object] != OF_OWNER_ROOM)
return 0;
- for (i = _numLocalObjects; i > 0; i--) {
+ for (i = (_numLocalObjects-1); i > 0; i--) {
if (_objs[i].obj_nr == object) {
if (_objs[i].fl_object_index != 0)
return 8;
@@ -851,7 +851,7 @@
return getResourceAddress(rtInventory, i);
}
} else {
- for (i = _numLocalObjects; i > 0; --i) {
+ for (i = (_numLocalObjects-1); i > 0; --i) {
if (_objs[i].obj_nr == obj) {
if (_objs[i].fl_object_index)
return getResourceAddress(rtFlObject, _objs[i].fl_object_index) + 8;
@@ -1259,7 +1259,7 @@
warning("nukeFlObjects(%d,%d)", min, max);
- for (i = _numLocalObjects, od = _objs; --i >= 0; od++)
+ for (i = (_numLocalObjects-1), od = _objs; --i >= 0; od++)
if (od->fl_object_index && od->obj_nr >= min && od->obj_nr <= max) {
nukeResource(rtFlObject, od->fl_object_index);
od->obj_nr = 0;
@@ -1625,7 +1625,7 @@
{
int i;
- for (i = 1; i <= _numLocalObjects; i++) {
+ for (i = 1; i < _numLocalObjects; i++) {
if (!_objs[i].obj_nr) {
printf("Returning slot %d\n", i);
return i;
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- resource.cpp 8 Jan 2003 23:41:27 -0000 1.49
+++ resource.cpp 12 Jan 2003 08:32:44 -0000 1.50
@@ -1655,6 +1655,7 @@
_inventory = (uint16 *)calloc(_numInventory, sizeof(uint16));
_verbs = (VerbSlot *)calloc(_numVerbs, sizeof(VerbSlot));
_objs = (ObjectData *)calloc(_numLocalObjects, sizeof(ObjectData));
+ printf("Allocated %d space in numObjects\n", _numLocalObjects);
_vars = (int32 *)calloc(_numVariables, sizeof(int32));
_bitVars = (byte *)calloc(_numBitVariables >> 3, 1);
Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- script.cpp 12 Jan 2003 07:30:17 -0000 1.40
+++ script.cpp 12 Jan 2003 08:32:44 -0000 1.41
@@ -732,14 +732,12 @@
}
/* Nuke FL objects */
- // ENDERFIXME
- /*
i = 0;
do {
if (_objs[i].fl_object_index)
nukeResource(rtFlObject, _objs[i].fl_object_index);
} while (++i <= _numObjectsInRoom);
- */
+
/* Nuke local object names */
if (_newNames) {
for (i = 0; i < _numNewNames; i++) {
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm object.cpp,1.43,1.44 script.cpp,1.39,1.40 script_v5.cpp,1.12,1.13 scumm.h,1.127,1.128 verbs.cpp,1.17,1.18
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm object.cpp,1.45,1.46 verbs.cpp,1.18,1.19
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list