From a08f37cfe84367624f625b68ff339d24c2476111 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Wed, 4 Jan 2023 22:18:56 +0100 Subject: [PATCH] Don't use a levelled creature's base pointer when spawning a new instance --- apps/openmw/mwclass/creaturelevlist.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwclass/creaturelevlist.cpp b/apps/openmw/mwclass/creaturelevlist.cpp index a9b7abdc7d..464a1acfa0 100644 --- a/apps/openmw/mwclass/creaturelevlist.cpp +++ b/apps/openmw/mwclass/creaturelevlist.cpp @@ -127,10 +127,10 @@ namespace MWClass if (!customData.mSpawn) return; - MWWorld::LiveCellRef* ref = ptr.get(); - + 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().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());