From 7509ffec339ddd09fe9109717a5c35dbfe127671 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 10 Sep 2013 22:36:14 +0300 Subject: FULLPIPE: Move GameObject::canInteractAny() out of the class --- engines/fullpipe/interaction.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'engines/fullpipe/interaction.cpp') 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; -- cgit v1.2.3