forked from mirror/openmw-tes3mp
Fix crash when onPcEquip script removes the equipped item (Fixes #3016)
This commit is contained in:
parent
1b77428c59
commit
edfcb45ad7
2 changed files with 15 additions and 8 deletions
|
@ -471,16 +471,18 @@ namespace MWGui
|
||||||
MWBase::Environment::get().getScriptManager()->run (script, interpreterContext);
|
MWBase::Environment::get().getScriptManager()->run (script, interpreterContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mSkippedToEquip = MWWorld::Ptr();
|
||||||
|
if (ptr.getRefData().getCount()) // make sure the item is still there, the script might have removed it
|
||||||
|
{
|
||||||
if (script.empty() || ptr.getRefData().getLocals().getIntVar(script, "pcskipequip") == 0)
|
if (script.empty() || ptr.getRefData().getLocals().getIntVar(script, "pcskipequip") == 0)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<MWWorld::Action> action = ptr.getClass().use(ptr);
|
boost::shared_ptr<MWWorld::Action> action = ptr.getClass().use(ptr);
|
||||||
|
|
||||||
action->execute (player);
|
action->execute (player);
|
||||||
|
|
||||||
mSkippedToEquip = MWWorld::Ptr();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mSkippedToEquip = ptr;
|
mSkippedToEquip = ptr;
|
||||||
|
}
|
||||||
|
|
||||||
if (isVisible())
|
if (isVisible())
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,7 +52,12 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(it != invStore.end());
|
if (it == invStore.end())
|
||||||
|
{
|
||||||
|
std::stringstream error;
|
||||||
|
error << "ActionEquip can't find item " << object.getCellRef().getRefId();
|
||||||
|
throw std::runtime_error(error.str());
|
||||||
|
}
|
||||||
|
|
||||||
// equip the item in the first free slot
|
// equip the item in the first free slot
|
||||||
std::vector<int>::const_iterator slot=slots_.first.begin();
|
std::vector<int>::const_iterator slot=slots_.first.begin();
|
||||||
|
|
Loading…
Reference in a new issue