mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-04 21:40:03 +00:00
Don't set OnPcEquip for items that failed to equip (Fixes #2776)
This commit is contained in:
parent
c4866bdfc6
commit
992b770315
@ -436,6 +436,20 @@ namespace MWGui
|
|||||||
{
|
{
|
||||||
const std::string& script = ptr.getClass().getScript(ptr);
|
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 the item has a script, set its OnPcEquip to 1
|
||||||
if (!script.empty()
|
if (!script.empty()
|
||||||
// Another morrowind oddity: when an item has skipped equipping and pcskipequip is reset to 0 afterwards,
|
// 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);
|
boost::shared_ptr<MWWorld::Action> action = ptr.getClass().use(ptr);
|
||||||
|
|
||||||
action->execute (MWBase::Environment::get().getWorld()->getPlayerPtr());
|
action->execute (player);
|
||||||
|
|
||||||
mSkippedToEquip = MWWorld::Ptr();
|
mSkippedToEquip = MWWorld::Ptr();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user