forked from mirror/openmw-tes3mp
fixed spell list handling
This commit is contained in:
parent
6c928e93d3
commit
f17756712a
1 changed files with 13 additions and 16 deletions
|
@ -91,24 +91,21 @@ namespace MWGui
|
|||
clearSpells();
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWMechanics::Spells& playerSpells = stats.getSpells();
|
||||
/// \todo get spell list via MWWorld::Class interface
|
||||
std::vector<std::string> spellList = actor.get<ESM::NPC>()->base->spells.list;
|
||||
for (std::vector<std::string>::const_iterator it = spellList.begin(); it != spellList.end(); ++it)
|
||||
|
||||
MWMechanics::Spells& playerSpells = MWWorld::Class::get (player).getCreatureStats (player).getSpells();
|
||||
MWMechanics::Spells& merchantSpells = MWWorld::Class::get (actor).getCreatureStats (actor).getSpells();
|
||||
|
||||
for (MWMechanics::Spells::TIterator iter = merchantSpells.begin(); iter!=merchantSpells.end(); ++iter)
|
||||
{
|
||||
bool alreadyHave = false;
|
||||
for (std::vector<std::string>::const_iterator it2 = playerSpells.begin(); it2 != playerSpells.end(); ++it2)
|
||||
{
|
||||
if (*it==*it2)
|
||||
{
|
||||
alreadyHave = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find (*iter);
|
||||
|
||||
if (alreadyHave==false)
|
||||
addSpell(*it);
|
||||
if (spell->data.type!=ESM::Spell::ST_Spell)
|
||||
continue; // don't try to sell diseases, curses or powers
|
||||
|
||||
if (std::find (playerSpells.begin(), playerSpells.end(), *iter)!=playerSpells.end())
|
||||
continue; // we have that spell already
|
||||
|
||||
addSpell (*iter);
|
||||
}
|
||||
|
||||
updateLabels();
|
||||
|
|
Loading…
Reference in a new issue