1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-05 22:19:43 +00:00

Fix exception when casting Bound Gloves spell

This commit is contained in:
scrawl 2014-06-19 16:00:27 +02:00
parent c69a311ad8
commit 11b05c352f
3 changed files with 10 additions and 6 deletions

View file

@ -530,8 +530,12 @@ namespace MWMechanics
itemGmst)->getString(); itemGmst)->getString();
if (it->first == ESM::MagicEffect::BoundGloves) if (it->first == ESM::MagicEffect::BoundGloves)
{ {
adjustBoundItem("sMagicBoundLeftGauntletID", magnitude > 0, ptr); item = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find(
adjustBoundItem("sMagicBoundRightGauntletID", magnitude > 0, ptr); "sMagicBoundLeftGauntletID")->getString();
adjustBoundItem(item, magnitude > 0, ptr);
item = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find(
"sMagicBoundRightGauntletID")->getString();
adjustBoundItem(item, magnitude > 0, ptr);
} }
else else
adjustBoundItem(item, magnitude > 0, ptr); adjustBoundItem(item, magnitude > 0, ptr);

View file

@ -78,7 +78,7 @@ namespace MWWorld
state.mSourceName = sourceName; state.mSourceName = sourceName;
state.mId = model; state.mId = model;
state.mSpellId = spellId; state.mSpellId = spellId;
state.mCaster = caster; state.mCasterHandle = caster.getRefData().getHandle();
if (caster.getClass().isActor()) if (caster.getClass().isActor())
state.mActorId = caster.getClass().getCreatureStats(caster).getActorId(); state.mActorId = caster.getClass().getCreatureStats(caster).getActorId();
else else
@ -162,7 +162,7 @@ namespace MWWorld
{ {
MWWorld::Ptr obstacle = MWBase::Environment::get().getWorld()->searchPtrViaHandle(cIt->second); MWWorld::Ptr obstacle = MWBase::Environment::get().getWorld()->searchPtrViaHandle(cIt->second);
MWWorld::Ptr caster = it->mCaster; MWWorld::Ptr caster = MWBase::Environment::get().getWorld()->searchPtrViaHandle(it->mCasterHandle);
if (caster.isEmpty()) if (caster.isEmpty())
caster = MWBase::Environment::get().getWorld()->searchPtrViaActorId(it->mActorId); caster = MWBase::Environment::get().getWorld()->searchPtrViaActorId(it->mActorId);

View file

@ -67,12 +67,12 @@ namespace MWWorld
int mActorId; int mActorId;
// actorId doesn't work for non-actors, so we also keep track of the Ptr. // actorId doesn't work for non-actors, so we also keep track of the Ogre-handle.
// For non-actors, the caster ptr is mainly needed to prevent the projectile // For non-actors, the caster ptr is mainly needed to prevent the projectile
// from colliding with its caster. // from colliding with its caster.
// TODO: this will break when the game is saved and reloaded, since there is currently // TODO: this will break when the game is saved and reloaded, since there is currently
// no way to write identifiers for non-actors to a savegame. // no way to write identifiers for non-actors to a savegame.
MWWorld::Ptr mCaster; std::string mCasterHandle;
// MW-id of this projectile // MW-id of this projectile
std::string mId; std::string mId;