1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-28 19:21:04 +00:00

Merge branch 'unstack-refnum' into 'master'

Generate new refnum for the new stack created when unstacking.

See merge request OpenMW/openmw!3206
This commit is contained in:
psi29a 2023-07-08 14:58:28 +00:00
commit fbe6a398f8

View File

@ -218,6 +218,12 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::unstack(const Ptr& ptr,
if (ptr.getRefData().getCount() <= count)
return end();
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);
if (!script.empty())
MWBase::Environment::get().getWorld()->getLocalScripts().add(script, *it);