mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 18:35:20 +00:00
Generate new refnum for the new stack created when unstacking.
This commit is contained in:
parent
63e9a63c67
commit
0f608f388e
@ -218,6 +218,12 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::unstack(const Ptr& ptr,
|
|||||||
if (ptr.getRefData().getCount() <= count)
|
if (ptr.getRefData().getCount() <= count)
|
||||||
return end();
|
return end();
|
||||||
MWWorld::ContainerStoreIterator it = addNewStack(ptr, subtractItems(ptr.getRefData().getCount(false), count));
|
MWWorld::ContainerStoreIterator it = addNewStack(ptr, subtractItems(ptr.getRefData().getCount(false), count));
|
||||||
|
|
||||||
|
MWWorld::Ptr newPtr = *it;
|
||||||
|
newPtr.getCellRef().unsetRefNum();
|
||||||
|
newPtr.getRefData().setLuaScripts(nullptr);
|
||||||
|
MWBase::Environment::get().getWorldModel()->registerPtr(newPtr);
|
||||||
|
|
||||||
const ESM::RefId& script = it->getClass().getScript(*it);
|
const ESM::RefId& script = it->getClass().getScript(*it);
|
||||||
if (!script.empty())
|
if (!script.empty())
|
||||||
MWBase::Environment::get().getWorld()->getLocalScripts().add(script, *it);
|
MWBase::Environment::get().getWorld()->getLocalScripts().add(script, *it);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user