From 5f209b120b0278a57d4ac12e8925eff6018abfa4 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 12 Nov 2013 01:26:16 +0100 Subject: [PATCH] Use the new ContainerStore::remove method. --- apps/openmw/mwworld/worldimp.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 254c7e1be..e42d590b5 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -2127,20 +2127,18 @@ namespace MWWorld } if (enchantment->mData.mType == ESM::Enchantment::CastOnce) { - item.getRefData().setCount(item.getRefData().getCount()-1); - } - - sourceName = item.getClass().getName(item); - - if (!item.getRefData().getCount()) - { - // Item was used up - MWBase::Environment::get().getWindowManager()->unsetSelectedSpell(); - inv.setSelectedEnchantItem(inv.end()); + if (!item.getContainerStore()->remove(item, 1, actor)) + { + // Item was used up + MWBase::Environment::get().getWindowManager()->unsetSelectedSpell(); + inv.setSelectedEnchantItem(inv.end()); + } } else MWBase::Environment::get().getWindowManager()->setSelectedEnchantItem(item); // Set again to show the modified charge + sourceName = item.getClass().getName(item); + effects = enchantment->mEffects; }