1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Fixed missing info about dealt damage in combat log when there were casualties;

Fixed blank row in combat log in the same case;
This commit is contained in:
Fay 2015-01-25 18:03:34 +01:00
parent 86fde2ba54
commit 413523956f

View File

@ -1788,14 +1788,16 @@ void CBattleInterface::getPossibleActionsForStack(const CStack * stack)
void CBattleInterface::printConsoleAttacked( const CStack * defender, int dmg, int killed, const CStack * attacker, bool multiple )
{
boost::format txt;
std::string formattedText;
if (attacker) //ignore if stacks were killed by spell
{
txt = boost::format (CGI->generaltexth->allTexts[attacker->count > 1 ? 377 : 376]) %
boost::format txt = boost::format (CGI->generaltexth->allTexts[attacker->count > 1 ? 377 : 376]) %
(attacker->count > 1 ? attacker->getCreature()->namePl : attacker->getCreature()->nameSing) % dmg;
formattedText.append(boost::to_string(txt));
}
if(killed > 0)
{
boost::format txt;
if(killed > 1)
{
txt = boost::format (CGI->generaltexth->allTexts[379]) % killed % (multiple ? CGI->generaltexth->allTexts[43] : defender->getCreature()->namePl); // creatures perish
@ -1804,9 +1806,12 @@ void CBattleInterface::printConsoleAttacked( const CStack * defender, int dmg, i
{
txt = boost::format (CGI->generaltexth->allTexts[378]) % (multiple ? CGI->generaltexth->allTexts[42] : defender->getCreature()->nameSing); // creature perishes
}
std::string trimmed = boost::to_string(txt);
boost::algorithm::trim(trimmed); // these default h3 texts have unnecessary new lines, so get rid of them before displaying
formattedText.append(trimmed);
}
console->addText(formattedText);
console->addText(boost::to_string (txt));
}