1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00
This commit is contained in:
AlexVinS 2016-10-01 18:18:46 +03:00
parent 799b8519e0
commit 52ae5b4a86
2 changed files with 13 additions and 5 deletions

View File

@ -1783,6 +1783,9 @@ void CBattleInterface::blockUI(bool on)
{
ESpellCastProblem::ESpellCastProblem spellcastingProblem;
bool canCastSpells = curInt->cb->battleCanCastSpell(&spellcastingProblem);
//if magic is blocked, we leave button active, so the message can be displayed (cf bug #97)
if(!canCastSpells)
canCastSpells = spellcastingProblem == ESpellCastProblem::MAGIC_IS_BLOCKED;
bool canWait = activeStack ? !activeStack->waited() : false;
bOptions->block(on);
@ -1804,8 +1807,8 @@ void CBattleInterface::blockUI(bool on)
bConsoleDown->block(on);
}
//if magic is blocked, we leave button active, so the message can be displayed (cf bug #97)
bSpell->block(on || (!canCastSpells && spellcastingProblem != ESpellCastProblem::MAGIC_IS_BLOCKED));
bSpell->block(on || tacticsMode || !canCastSpells);
bWait->block(on || tacticsMode || !canWait);
bDefence->block(on || tacticsMode);
}

View File

@ -618,9 +618,7 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
int spellCost = owner->myInt->cb->getSpellCost(sp, owner->myHero);
if(spellCost > owner->myHero->mana) //insufficient mana
{
char msgBuf[500];
sprintf(msgBuf, CGI->generaltexth->allTexts[206].c_str(), spellCost, owner->myHero->mana);
owner->myInt->showInfoDialog(std::string(msgBuf));
owner->myInt->showInfoDialog(boost::str(boost::format(CGI->generaltexth->allTexts[206]) % spellCost % owner->myHero->mana));
return;
}
//battle spell on adv map or adventure map spell during combat => display infowindow, not cast
@ -702,6 +700,13 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
owner->myInt->showInfoDialog(CGI->generaltexth->allTexts[185]);
}
break;
default:
{
// General message:
std::string text = CGI->generaltexth->allTexts[541], caster = owner->myHero->name;
text = boost::str(boost::format(text) % caster);
owner->myInt->showInfoDialog(text);
}
}
}
else if(sp->isAdventureSpell() && !owner->myInt->battleInt) //adventure spell and not in battle