mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
fixes related to http://bugs.vcmi.eu/view.php?id=2520
This commit is contained in:
parent
9834db1b7d
commit
ef9bff9006
@ -251,18 +251,26 @@ void CBank::doVisit(const CGHeroInstance * hero) const
|
|||||||
cb->showInfoDialog(&iw);
|
cb->showInfoDialog(&iw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loot.clear();
|
||||||
|
iw.components.clear();
|
||||||
|
iw.text.clear();
|
||||||
|
|
||||||
if (!bc->spells.empty())
|
if (!bc->spells.empty())
|
||||||
{
|
{
|
||||||
std::set<SpellID> spells;
|
std::set<SpellID> spells;
|
||||||
|
|
||||||
bool noWisdom = false;
|
bool noWisdom = false;
|
||||||
for (SpellID spell : bc->spells)
|
for(const SpellID & spellId : bc->spells)
|
||||||
{
|
{
|
||||||
iw.text.addTxt (MetaString::SPELL_NAME, spell);
|
const CSpell * spell = spellId.toSpell();
|
||||||
if (VLC->spellh->objects[spell]->level <= hero->getSecSkillLevel(SecondarySkill::WISDOM) + 2)
|
iw.text.addTxt (MetaString::SPELL_NAME, spellId);
|
||||||
|
if(spell->level <= hero->getSecSkillLevel(SecondarySkill::WISDOM) + 2)
|
||||||
{
|
{
|
||||||
spells.insert(spell);
|
if(hero->canLearnSpell(spell))
|
||||||
iw.components.push_back(Component (Component::SPELL, spell, 0, 0));
|
{
|
||||||
|
spells.insert(spellId);
|
||||||
|
iw.components.push_back(Component (Component::SPELL, spellId, 0, 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
noWisdom = true;
|
noWisdom = true;
|
||||||
@ -272,10 +280,14 @@ void CBank::doVisit(const CGHeroInstance * hero) const
|
|||||||
iw.text.addTxt (MetaString::ADVOB_TXT, 109); //no spellbook
|
iw.text.addTxt (MetaString::ADVOB_TXT, 109); //no spellbook
|
||||||
else if (noWisdom)
|
else if (noWisdom)
|
||||||
iw.text.addTxt (MetaString::ADVOB_TXT, 108); //no expert Wisdom
|
iw.text.addTxt (MetaString::ADVOB_TXT, 108); //no expert Wisdom
|
||||||
if (spells.empty())
|
|
||||||
|
if(!iw.components.empty() || !iw.text.toString().empty())
|
||||||
|
cb->showInfoDialog(&iw);
|
||||||
|
|
||||||
|
if(!spells.empty())
|
||||||
cb->changeSpells (hero, true, spells);
|
cb->changeSpells (hero, true, spells);
|
||||||
}
|
}
|
||||||
loot.clear();
|
|
||||||
iw.components.clear();
|
iw.components.clear();
|
||||||
iw.text.clear();
|
iw.text.clear();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user