1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-29 00:41:38 +02:00

* fixed bug #20

* minor changes
This commit is contained in:
mateuszb
2010-01-29 16:19:12 +00:00
parent b0a587ff08
commit 23a32ebf7a
8 changed files with 28 additions and 9 deletions

View File

@ -666,13 +666,25 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
{
if(!down && mySpell!=-1)
{
int spellCost = LOCPLINT->cb->getSpellCost(&CGI->spellh->spells[mySpell], owner->myHero);
//we will cast a spell
if(LOCPLINT->battleInt && LOCPLINT->cb->battleCanCastSpell() && LOCPLINT->cb->getSpellCost(&CGI->spellh->spells[mySpell], owner->myHero) <= owner->myHero->mana) //if battle window is open
if(LOCPLINT->battleInt && LOCPLINT->cb->battleCanCastSpell() && spellCost <= owner->myHero->mana) //if battle window is open
{
int spell = mySpell;
owner->fexitb();
LOCPLINT->battleInt->castThisSpell(spell);
}
else
{
//insufficient mana
if(spellCost > owner->myHero->mana)
{
std::vector<SComponent*> comps;
char msgBuf[500];
sprintf(msgBuf, CGI->generaltexth->allTexts[206].c_str(), spellCost, owner->myHero->mana);
LOCPLINT->showInfoDialog(std::string(msgBuf), comps);
}
}
}
}