aboutsummaryrefslogtreecommitdiff
path: root/engines/fullpipe/interaction.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2013-09-10 22:36:14 +0300
committerEugene Sandulenko2013-09-10 22:36:14 +0300
commit7509ffec339ddd09fe9109717a5c35dbfe127671 (patch)
treeac209d77e70a6241f71d3fb7e7f6eafff87c6850 /engines/fullpipe/interaction.cpp
parentf628b7e20d48402be093e1b334a416a0f381f94c (diff)
downloadscummvm-rg350-7509ffec339ddd09fe9109717a5c35dbfe127671.tar.gz
scummvm-rg350-7509ffec339ddd09fe9109717a5c35dbfe127671.tar.bz2
scummvm-rg350-7509ffec339ddd09fe9109717a5c35dbfe127671.zip
FULLPIPE: Move GameObject::canInteractAny() out of the class
Diffstat (limited to 'engines/fullpipe/interaction.cpp')
-rw-r--r--engines/fullpipe/interaction.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/engines/fullpipe/interaction.cpp b/engines/fullpipe/interaction.cpp
index 91dc8961d5..f392a084dd 100644
--- a/engines/fullpipe/interaction.cpp
+++ b/engines/fullpipe/interaction.cpp
@@ -33,6 +33,28 @@ int handleObjectInteraction(StaticANIObject *subject, GameObject *object, int in
return getGameLoaderInteractionController()->handleInteraction(subject, object, invId);
}
+bool canInteractAny(GameObject *obj1, GameObject *obj2, int invId) {
+ int sceneId = 0;
+
+ if (g_fullpipe->_currentScene)
+ sceneId = g_fullpipe->_currentScene->_sceneId;
+
+ CInteractionController *intC = getGameLoaderInteractionController();
+ for (CObList::iterator i = intC->_interactions.begin(); i != intC->_interactions.end(); ++i) {
+ CInteraction *intr = (CInteraction *)*i;
+
+ if (intr->_sceneId > 0 && intr->_sceneId != sceneId)
+ break;
+
+ if (invId == -3) {
+ invId = getGameLoaderInventory()->getSelectedItemId();
+ }
+ if (intr->canInteract(obj1, obj2, invId))
+ return true;
+ }
+ return false;
+}
+
bool CInteractionController::load(MfcArchive &file) {
debug(5, "CInteractionController::load()");
@@ -422,6 +444,7 @@ bool CInteraction::canInteract(GameObject *obj1, GameObject *obj2, int invId) {
if (!obj2)
return false;
+
if (obj2->_id != _objectId1)
return false;