forked from mirror/openmw-tes3mp
Don't set OnPcEquip for items that failed to equip (Fixes #2776)
This commit is contained in:
parent
c4866bdfc6
commit
992b770315
1 changed files with 15 additions and 1 deletions
|
@ -436,6 +436,20 @@ namespace MWGui
|
|||
{
|
||||
const std::string& script = ptr.getClass().getScript(ptr);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
// early-out for items that need to be equipped, but can't be equipped: we don't want to set OnPcEquip in that case
|
||||
if (!ptr.getClass().getEquipmentSlots(ptr).first.empty())
|
||||
{
|
||||
std::pair<int, std::string> canEquip = ptr.getClass().canBeEquipped(ptr, player);
|
||||
if (canEquip.first == 0)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox(canEquip.second);
|
||||
updateItemView();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If the item has a script, set its OnPcEquip to 1
|
||||
if (!script.empty()
|
||||
// Another morrowind oddity: when an item has skipped equipping and pcskipequip is reset to 0 afterwards,
|
||||
|
@ -455,7 +469,7 @@ namespace MWGui
|
|||
{
|
||||
boost::shared_ptr<MWWorld::Action> action = ptr.getClass().use(ptr);
|
||||
|
||||
action->execute (MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
action->execute (player);
|
||||
|
||||
mSkippedToEquip = MWWorld::Ptr();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue