Browse Source

Remove false warning indicating something is wrong

Dydzio 6 years ago
parent
commit
cd78779d9c
2 changed files with 5 additions and 3 deletions
  1. 5 2
      client/battle/CBattleInterface.cpp
  2. 0 1
      lib/battle/CBattleInfoEssentials.cpp

+ 5 - 2
client/battle/CBattleInterface.cpp

@@ -792,8 +792,11 @@ void CBattleInterface::bSurrenderf()
 	if (cost >= 0)
 	if (cost >= 0)
 	{
 	{
 		std::string enemyHeroName = curInt->cb->battleGetEnemyHero().name;
 		std::string enemyHeroName = curInt->cb->battleGetEnemyHero().name;
-		if (enemyHeroName.empty())
-			enemyHeroName = "#ENEMY#"; //TODO: should surrendering without enemy hero be enabled?
+		if(enemyHeroName.empty())
+		{
+			logGlobal->warn("Surrender performed without enemy hero, should not happen!");
+			enemyHeroName = "#ENEMY#";
+		}
 
 
 		std::string surrenderMessage = boost::str(boost::format(CGI->generaltexth->allTexts[32]) % enemyHeroName % cost); //%s states: "I will accept your surrender and grant you and your troops safe passage for the price of %d gold."
 		std::string surrenderMessage = boost::str(boost::format(CGI->generaltexth->allTexts[32]) % enemyHeroName % cost); //%s states: "I will accept your surrender and grant you and your troops safe passage for the price of %d gold."
 		curInt->showYesNoDialog(surrenderMessage, [this](){ reallySurrender(); }, nullptr);
 		curInt->showYesNoDialog(surrenderMessage, [this](){ reallySurrender(); }, nullptr);

+ 0 - 1
lib/battle/CBattleInfoEssentials.cpp

@@ -241,7 +241,6 @@ InfoAboutHero CBattleInfoEssentials::battleGetHeroInfo(ui8 side) const
 	auto hero = getBattle()->getSideHero(side);
 	auto hero = getBattle()->getSideHero(side);
 	if(!hero)
 	if(!hero)
 	{
 	{
-		logGlobal->warn("%s: side %d does not have hero!", __FUNCTION__, static_cast<int>(side));
 		return InfoAboutHero();
 		return InfoAboutHero();
 	}
 	}
 	InfoAboutHero::EInfoLevel infoLevel = battleDoWeKnowAbout(side) ? InfoAboutHero::EInfoLevel::DETAILED : InfoAboutHero::EInfoLevel::BASIC;
 	InfoAboutHero::EInfoLevel infoLevel = battleDoWeKnowAbout(side) ? InfoAboutHero::EInfoLevel::DETAILED : InfoAboutHero::EInfoLevel::BASIC;