aboutsummaryrefslogtreecommitdiff
path: root/engines/agos/contain.cpp
diff options
context:
space:
mode:
authorTravis Howell2006-10-10 11:25:45 +0000
committerTravis Howell2006-10-10 11:25:45 +0000
commitc5044d67c90c2886d88b3bb82df737ac93d945b5 (patch)
treed6c4f368a50f09104a21c329a639d8198547b948 /engines/agos/contain.cpp
parent043fe970c55ec9063b268593f44973f4f45d6d07 (diff)
downloadscummvm-rg350-c5044d67c90c2886d88b3bb82df737ac93d945b5.tar.gz
scummvm-rg350-c5044d67c90c2886d88b3bb82df737ac93d945b5.tar.bz2
scummvm-rg350-c5044d67c90c2886d88b3bb82df737ac93d945b5.zip
Fix movement in Elvira 1
svn-id: r24260
Diffstat (limited to 'engines/agos/contain.cpp')
-rw-r--r--engines/agos/contain.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/engines/agos/contain.cpp b/engines/agos/contain.cpp
index b7950f7034..043e48feb4 100644
--- a/engines/agos/contain.cpp
+++ b/engines/agos/contain.cpp
@@ -98,4 +98,33 @@ int AGOSEngine::sizeOfRec(Item *o, int d) {
return 0;
}
+int AGOSEngine::weighUp(Item *x) {
+ return weightRec(x, 0);
+}
+
+int AGOSEngine::weightRec(Item *x, int d) {
+ int n = weightOf(x);
+ Item *o;
+
+ if (d > 32)
+ return 0;
+ o = derefItem(x->child);
+ while (o) {
+ n += weightRec(o, d + 1);
+ o = derefItem(o->next);
+ }
+
+ return n;
+}
+
+int AGOSEngine::weightOf(Item *x) {
+ SubObject *o = (SubObject *)findChildOfType(x, 2);
+ SubPlayer *p = (SubPlayer *)findChildOfType(x, 3);
+ if (o)
+ return o->objectWeight;
+ if (p)
+ return p->weight;
+ return 0;
+}
+
} // End of namespace AGOS