1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 18:19:55 +00:00

Remove container scripts before deleting container

This commit is contained in:
scrawl 2015-12-14 02:57:55 +01:00
parent 69ccca490e
commit 271fcb80c6
7 changed files with 9 additions and 2 deletions

View file

@ -549,6 +549,8 @@ namespace MWBase
/// Return the distance between actor's weapon and target's collision box.
virtual float getHitDistance(const MWWorld::Ptr& actor, const MWWorld::Ptr& target) = 0;
virtual void removeContainerScripts(const MWWorld::Ptr& reference) = 0;
};
}

View file

@ -77,6 +77,7 @@ namespace MWClass
ptr.get<ESM::Container>();
if (ref->mBase->mFlags & ESM::Container::Respawn)
{
MWBase::Environment::get().getWorld()->removeContainerScripts(ptr);
ptr.getRefData().setCustomData(NULL);
}
}

View file

@ -762,6 +762,7 @@ namespace MWClass
// Reset to original position
ptr.getRefData().setPosition(ptr.getCellRef().getPosition());
MWBase::Environment::get().getWorld()->removeContainerScripts(ptr);
ptr.getRefData().setCustomData(NULL);
}
}

View file

@ -1224,6 +1224,7 @@ namespace MWClass
// Reset to original position
ptr.getRefData().setPosition(ptr.getCellRef().getPosition());
MWBase::Environment::get().getWorld()->removeContainerScripts(ptr);
ptr.getRefData().setCustomData(NULL);
}
}

View file

@ -1127,6 +1127,7 @@ namespace MWScript
{
MWBase::Environment::get().getWorld()->undeleteObject(ptr);
// resets runtime state such as inventory, stats and AI. does not reset position in the world
MWBase::Environment::get().getWorld()->removeContainerScripts(ptr);
ptr.getRefData().setCustomData(NULL);
}
}

View file

@ -52,7 +52,7 @@ namespace MWWorld
void remove (RefData *ref);
void remove (const Ptr& ptr);
///< Remove script for given reference (ignored if reference does not have a scirpt listed).
///< Remove script for given reference (ignored if reference does not have a script listed).
};
}

View file

@ -129,8 +129,9 @@ namespace MWWorld
void updateWindowManager ();
void updatePlayer(bool paused);
MWWorld::Ptr getFacedObject(float maxDistance, bool ignorePlayer=true);
public: // FIXME
void removeContainerScripts(const Ptr& reference);
private:
void addContainerScripts(const Ptr& reference, CellStore* cell);
void PCDropped (const Ptr& item);