From d11a5e19f79b9ed3cf0e49cde5b1b063a9155fb9 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 16 Jun 2014 17:14:35 +0200 Subject: [PATCH] Fix positionCell not properly teleporting actors from inactive to active cells (Fixes #1516) --- apps/openmw/mwworld/worldimp.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 625942da7..4386f5b0d 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -989,9 +989,18 @@ namespace MWWorld } else { - if (!mWorldScene->isCellActive(*currCell)) - ptr.getClass().copyToCell(ptr, *newCell, pos); - else if (!mWorldScene->isCellActive(*newCell)) + if (!mWorldScene->isCellActive(*currCell) && mWorldScene->isCellActive(*newCell)) + { + MWWorld::Ptr newPtr = ptr.getClass().copyToCell(ptr, *newCell, pos); + mWorldScene->addObjectToScene(newPtr); + + std::string script = newPtr.getClass().getScript(newPtr); + if (!script.empty()) { + mLocalScripts.add(script, newPtr); + } + addContainerScripts(newPtr, newCell); + } + else if (!mWorldScene->isCellActive(*newCell) && mWorldScene->isCellActive(*currCell)) { mWorldScene->removeObjectFromScene(ptr); mLocalScripts.remove(ptr);