Skip to content

Commit 52ae5b4

Browse files
committed
1 parent 799b851 commit 52ae5b4

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

client/battle/CBattleInterface.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,6 +1783,9 @@ void CBattleInterface::blockUI(bool on)
17831783
{
17841784
ESpellCastProblem::ESpellCastProblem spellcastingProblem;
17851785
bool canCastSpells = curInt->cb->battleCanCastSpell(&spellcastingProblem);
1786+
//if magic is blocked, we leave button active, so the message can be displayed (cf bug #97)
1787+
if(!canCastSpells)
1788+
canCastSpells = spellcastingProblem == ESpellCastProblem::MAGIC_IS_BLOCKED;
17861789
bool canWait = activeStack ? !activeStack->waited() : false;
17871790

17881791
bOptions->block(on);
@@ -1804,8 +1807,8 @@ void CBattleInterface::blockUI(bool on)
18041807
bConsoleDown->block(on);
18051808
}
18061809

1807-
//if magic is blocked, we leave button active, so the message can be displayed (cf bug #97)
1808-
bSpell->block(on || (!canCastSpells && spellcastingProblem != ESpellCastProblem::MAGIC_IS_BLOCKED));
1810+
1811+
bSpell->block(on || tacticsMode || !canCastSpells);
18091812
bWait->block(on || tacticsMode || !canWait);
18101813
bDefence->block(on || tacticsMode);
18111814
}

client/windows/CSpellWindow.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -618,9 +618,7 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
618618
int spellCost = owner->myInt->cb->getSpellCost(sp, owner->myHero);
619619
if(spellCost > owner->myHero->mana) //insufficient mana
620620
{
621-
char msgBuf[500];
622-
sprintf(msgBuf, CGI->generaltexth->allTexts[206].c_str(), spellCost, owner->myHero->mana);
623-
owner->myInt->showInfoDialog(std::string(msgBuf));
621+
owner->myInt->showInfoDialog(boost::str(boost::format(CGI->generaltexth->allTexts[206]) % spellCost % owner->myHero->mana));
624622
return;
625623
}
626624
//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)
702700
owner->myInt->showInfoDialog(CGI->generaltexth->allTexts[185]);
703701
}
704702
break;
703+
default:
704+
{
705+
// General message:
706+
std::string text = CGI->generaltexth->allTexts[541], caster = owner->myHero->name;
707+
text = boost::str(boost::format(text) % caster);
708+
owner->myInt->showInfoDialog(text);
709+
}
705710
}
706711
}
707712
else if(sp->isAdventureSpell() && !owner->myInt->battleInt) //adventure spell and not in battle

0 commit comments

Comments
 (0)