forked from mirror/openmw-tes3mp
Issue #61: remove ingredients on potion creation
This commit is contained in:
parent
3c71378fad
commit
f5caf227b2
1 changed files with 15 additions and 1 deletions
|
@ -221,7 +221,21 @@ const ESM::Potion *MWMechanics::Alchemy::getRecord() const
|
||||||
|
|
||||||
void MWMechanics::Alchemy::removeIngredients()
|
void MWMechanics::Alchemy::removeIngredients()
|
||||||
{
|
{
|
||||||
|
bool needsUpdate = false;
|
||||||
|
|
||||||
|
for (TIngredientsContainer::iterator iter (mIngredients.begin()); iter!=mIngredients.end(); ++iter)
|
||||||
|
if (!iter->isEmpty())
|
||||||
|
{
|
||||||
|
iter->getRefData().setCount (iter->getRefData().getCount()-1);
|
||||||
|
if (iter->getRefData().getCount()<1)
|
||||||
|
{
|
||||||
|
needsUpdate = true;
|
||||||
|
*iter = MWWorld::Ptr();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (needsUpdate)
|
||||||
|
updateEffects();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWMechanics::Alchemy::addPotion (const std::string& name)
|
void MWMechanics::Alchemy::addPotion (const std::string& name)
|
||||||
|
|
Loading…
Reference in a new issue