1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 08:23:53 +00:00

Merge branch 'skeleton_b_gone' into 'master'

Don't use a levelled creature's base pointer when spawning a new instance

See merge request OpenMW/openmw!2578
This commit is contained in:
psi29a 2023-01-06 10:14:32 +00:00
commit 452ea3d353

View file

@ -127,10 +127,10 @@ namespace MWClass
if (!customData.mSpawn)
return;
MWWorld::LiveCellRef<ESM::CreatureLevList>* ref = ptr.get<ESM::CreatureLevList>();
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
auto& prng = MWBase::Environment::get().getWorld()->getPrng();
const ESM::RefId& id = MWMechanics::getLevelledItem(ref->mBase, true, prng);
const ESM::RefId& id = MWMechanics::getLevelledItem(
store.get<ESM::CreatureLevList>().find(ptr.getCellRef().getRefId()), true, prng);
if (!id.empty())
{
@ -144,7 +144,6 @@ namespace MWClass
customData.mSpawnActorId = -1;
}
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
MWWorld::ManualRef manualRef(store, id);
manualRef.getPtr().getCellRef().setPosition(ptr.getCellRef().getPosition());
manualRef.getPtr().getCellRef().setScale(ptr.getCellRef().getScale());