forked from teamnwah/openmw-tes3coop
Fix crash when a target in a different cell is (un)locked
This commit is contained in:
parent
0731d79c09
commit
6c23caadd7
1 changed files with 7 additions and 5 deletions
|
@ -644,8 +644,9 @@ namespace MWMechanics
|
|||
{
|
||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::MagicEffect *magiceffect = store.get<ESM::MagicEffect>().find(effectId);
|
||||
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(target);
|
||||
animation->addSpellCastGlow(magiceffect);
|
||||
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(target);
|
||||
if (animation)
|
||||
animation->addSpellCastGlow(magiceffect);
|
||||
if (target.getCellRef().getLockLevel() < magnitude) //If the door is not already locked to a higher value, lock it to spell magnitude
|
||||
{
|
||||
if (caster == getPlayer())
|
||||
|
@ -658,15 +659,16 @@ namespace MWMechanics
|
|||
{
|
||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::MagicEffect *magiceffect = store.get<ESM::MagicEffect>().find(effectId);
|
||||
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(target);
|
||||
animation->addSpellCastGlow(magiceffect);
|
||||
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(target);
|
||||
if (animation)
|
||||
animation->addSpellCastGlow(magiceffect);
|
||||
if (target.getCellRef().getLockLevel() <= magnitude)
|
||||
{
|
||||
if (target.getCellRef().getLockLevel() > 0)
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D(target, "Open Lock", 1.f, 1.f);
|
||||
if (!caster.isEmpty())
|
||||
MWBase::Environment::get().getMechanicsManager()->objectOpened(getPlayer(), target);
|
||||
MWBase::Environment::get().getMechanicsManager()->objectOpened(getPlayer(), target);
|
||||
// Use the player instead of the caster for vanilla crime compatibility
|
||||
|
||||
if (caster == getPlayer())
|
||||
|
|
Loading…
Reference in a new issue