Explorar el Código

CBattleHero::clickRight: more elegant code for side detection

Arseniy Shestakov hace 8 años
padre
commit
4a302d4fe5
Se han modificado 1 ficheros con 2 adiciones y 5 borrados
  1. 2 5
      client/battle/CBattleInterfaceClasses.cpp

+ 2 - 5
client/battle/CBattleInterfaceClasses.cpp

@@ -214,11 +214,8 @@ void CBattleHero::clickRight(tribool down, bool previousState)
 
 
 	if (down && myOwner->myTurn)
 	if (down && myOwner->myTurn)
 	{
 	{
-		if (myHero != nullptr)
-			targetHero.initFromHero(myHero, InfoAboutHero::EInfoLevel::INBATTLE);
-		else
-			targetHero = myOwner->enemyHero();
-
+		auto h = flip ? myOwner->defendingHeroInstance : myOwner->attackingHeroInstance;
+		targetHero.initFromHero(h, InfoAboutHero::EInfoLevel::INBATTLE);
 		GH.pushInt(new CHeroInfoWindow(targetHero, &windowPosition));
 		GH.pushInt(new CHeroInfoWindow(targetHero, &windowPosition));
 	}
 	}
 }
 }