From 8ff747fbefe67381d2b9ec77f06e22052ad476a5 Mon Sep 17 00:00:00 2001 From: Emanuel Guevel Date: Wed, 16 Oct 2013 18:39:29 +0200 Subject: [PATCH] Move some deleteObject logic from OpDelete to MWWorld::deleteObject --- apps/openmw/mwscript/miscextensions.cpp | 13 +------------ apps/openmw/mwworld/worldimp.cpp | 9 +++++---- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index 1a2de650fc..66354513ea 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -512,18 +512,7 @@ namespace MWScript runtime.pop(); if (parameter == 1) - { - if (ptr.isInCell()) - MWBase::Environment::get().getWorld()->deleteObject (ptr); - else - { - MWWorld::ContainerStore* store = ptr.getContainerStore(); - if (store != NULL) - store->remove(ptr, ptr.getRefData().getCount(), ptr); - else - ptr.getRefData().setCount(0); - } - } + MWBase::Environment::get().getWorld()->deleteObject(ptr); } }; diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 144901fc57..affcf03878 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -837,12 +837,13 @@ namespace MWWorld void World::deleteObject (const Ptr& ptr) { - if (ptr.getRefData().getCount()>0) + if (ptr.getRefData().getCount() > 0) { - ptr.getRefData().setCount (0); + ptr.getRefData().setCount(0); - if (mWorldScene->getActiveCells().find (ptr.getCell())!=mWorldScene->getActiveCells().end() && - ptr.getRefData().isEnabled()) + if (ptr.isInCell() + && mWorldScene->getActiveCells().find(ptr.getCell()) != mWorldScene->getActiveCells().end() + && ptr.getRefData().isEnabled()) { mWorldScene->removeObjectFromScene (ptr); mLocalScripts.remove (ptr);