Browse Source

Fixed missing info about dealt damage in combat log when there were casualties;
Fixed blank row in combat log in the same case;

Fay 10 years ago
parent
commit
413523956f
1 changed files with 8 additions and 3 deletions
  1. 8 3
      client/battle/CBattleInterface.cpp

+ 8 - 3
client/battle/CBattleInterface.cpp

@@ -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 )
 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
 	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;
 			(attacker->count > 1 ? attacker->getCreature()->namePl : attacker->getCreature()->nameSing) % dmg;
+		formattedText.append(boost::to_string(txt));
 	}
 	}
 	if(killed > 0)
 	if(killed > 0)
 	{
 	{
+		boost::format txt;
 		if(killed > 1)
 		if(killed > 1)
 		{
 		{
 			txt = boost::format (CGI->generaltexth->allTexts[379]) % killed % (multiple ? CGI->generaltexth->allTexts[43] : defender->getCreature()->namePl); // creatures perish
 			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
 			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));
 }
 }