mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Merge remote-tracking branch 'scrawl/master'
This commit is contained in:
commit
69eb5aa99a
@ -94,9 +94,6 @@ namespace MWGui
|
|||||||
mPtr = actor;
|
mPtr = actor;
|
||||||
clearSpells();
|
clearSpells();
|
||||||
|
|
||||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
|
||||||
|
|
||||||
MWMechanics::Spells& playerSpells = MWWorld::Class::get (player).getCreatureStats (player).getSpells();
|
|
||||||
MWMechanics::Spells& merchantSpells = MWWorld::Class::get (actor).getCreatureStats (actor).getSpells();
|
MWMechanics::Spells& merchantSpells = MWWorld::Class::get (actor).getCreatureStats (actor).getSpells();
|
||||||
|
|
||||||
for (MWMechanics::Spells::TIterator iter = merchantSpells.begin(); iter!=merchantSpells.end(); ++iter)
|
for (MWMechanics::Spells::TIterator iter = merchantSpells.begin(); iter!=merchantSpells.end(); ++iter)
|
||||||
@ -107,8 +104,8 @@ namespace MWGui
|
|||||||
if (spell->mData.mType!=ESM::Spell::ST_Spell)
|
if (spell->mData.mType!=ESM::Spell::ST_Spell)
|
||||||
continue; // don't try to sell diseases, curses or powers
|
continue; // don't try to sell diseases, curses or powers
|
||||||
|
|
||||||
if (std::find (playerSpells.begin(), playerSpells.end(), *iter)!=playerSpells.end())
|
if (playerHasSpell(iter->first))
|
||||||
continue; // we have that spell already
|
continue;
|
||||||
|
|
||||||
addSpell (iter->first);
|
addSpell (iter->first);
|
||||||
}
|
}
|
||||||
@ -118,6 +115,18 @@ namespace MWGui
|
|||||||
mSpellsView->setCanvasSize (MyGUI::IntSize(mSpellsView->getWidth(), std::max(mSpellsView->getHeight(), mCurrentY)));
|
mSpellsView->setCanvasSize (MyGUI::IntSize(mSpellsView->getWidth(), std::max(mSpellsView->getHeight(), mCurrentY)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SpellBuyingWindow::playerHasSpell(const std::string &id)
|
||||||
|
{
|
||||||
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||||
|
MWMechanics::Spells& playerSpells = MWWorld::Class::get (player).getCreatureStats (player).getSpells();
|
||||||
|
for (MWMechanics::Spells::TIterator it = playerSpells.begin(); it != playerSpells.end(); ++it)
|
||||||
|
{
|
||||||
|
if (Misc::StringUtils::ciEqual(id, it->first))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void SpellBuyingWindow::onSpellButtonClick(MyGUI::Widget* _sender)
|
void SpellBuyingWindow::onSpellButtonClick(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
int price = *_sender->getUserData<int>();
|
int price = *_sender->getUserData<int>();
|
||||||
|
@ -47,6 +47,8 @@ namespace MWGui
|
|||||||
void updateLabels();
|
void updateLabels();
|
||||||
|
|
||||||
virtual void onReferenceUnavailable();
|
virtual void onReferenceUnavailable();
|
||||||
|
|
||||||
|
bool playerHasSpell (const std::string& id);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user