Browse Source

Merge pull request #5619 from Laserlicht/commander_health

fix health bar for commander
Ivan Savenko 6 months ago
parent
commit
74452116d1
1 changed files with 1 additions and 1 deletions
  1. 1 1
      client/battle/BattleStacksController.cpp

+ 1 - 1
client/battle/BattleStacksController.cpp

@@ -321,7 +321,7 @@ void BattleStacksController::showStackAmountBox(Canvas & canvas, const CStack *
 	{
 		double healthMaxType = stack->unitType()->getMaxHealth();
 		double healthMaxStack = stack->getMaxHealth();
-		double healthMaxRatio = healthMaxStack / healthMaxType;
+		double healthMaxRatio = std::min(healthMaxStack / healthMaxType, 1.0);
 		double healthRemaining = std::max(stack->getAvailableHealth() - (stack->getCount() - 1) * healthMaxStack, .0) * healthMaxRatio;
 		Rect r(boxPosition.x, boxPosition.y - 3, amountBG->width(), 4);
 		canvas.drawColor(r, Colors::RED);