aboutsummaryrefslogtreecommitdiff
path: root/scumm/object.cpp
diff options
context:
space:
mode:
authorMax Horn2003-05-22 15:27:44 +0000
committerMax Horn2003-05-22 15:27:44 +0000
commit871df7fb57d18ec72e787cf3cbb9c719a386eaee (patch)
tree264a5c57005ca8d454917e71dcaa15317b107ee9 /scumm/object.cpp
parenta6c8b58045e4f2de019fcadc951a344b5b2c5a99 (diff)
downloadscummvm-rg350-871df7fb57d18ec72e787cf3cbb9c719a386eaee.tar.gz
scummvm-rg350-871df7fb57d18ec72e787cf3cbb9c719a386eaee.tar.bz2
scummvm-rg350-871df7fb57d18ec72e787cf3cbb9c719a386eaee.zip
restricted getObjectIndex to only search thru _objs, not _inventory(to avoid future confusion), this might cause regressions, though; fixed o2_getObjPreposition; adapted some code to the changed getObjectIndex
svn-id: r7829
Diffstat (limited to 'scumm/object.cpp')
-rw-r--r--scumm/object.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp
index 15cbcfb346..5c2db5cb96 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -129,7 +129,21 @@ int Scumm::getObjectIndex(int object) {
if (object < 1)
return -1;
- /* OF_OWNER_ROOM should be 0xFF for full throttle, else 0xF */
+#if 1
+ for (i = (_numLocalObjects-1); i > 0; i--) {
+ if (_objs[i].obj_nr == object)
+ return i;
+ }
+ return -1;
+#else
+ // FIXME: this function searches thru the _inventory. Yet almost all
+ // functions calling it assumg the index will always be into _objs.
+ // For script_v2.cpp this already caused some hard to track buglets.
+ // Maybe it also causes problems in other places. The question is,
+ // under which cirumstances would the _inventory result ever be
+ // useful for us?
+
+ // OF_OWNER_ROOM should be 0xFF for full throttle, else 0xF
if (_objectOwnerTable[object] != OF_OWNER_ROOM) {
for (i = 0; i < _maxInventoryItems; i++)
if (_inventory[i] == object)
@@ -142,6 +156,7 @@ int Scumm::getObjectIndex(int object) {
}
return -1;
}
+#endif
}
int Scumm::whereIsObject(int object) {