mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
Move some deleteObject logic from OpDelete to MWWorld::deleteObject
This commit is contained in:
parent
2786530430
commit
8ff747fbef
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user