From 536ff3bcbd6a10b5709fd5d7c9f7c16869c36353 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Wed, 14 Jun 2017 04:12:05 +1100 Subject: [PATCH] Uint: fixed bad bar alpha on unit mouseover --- src/units/drawer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/units/drawer.cpp b/src/units/drawer.cpp index 23ce03466533..bca9b8f1e3ca 100644 --- a/src/units/drawer.cpp +++ b/src/units/drawer.cpp @@ -331,6 +331,7 @@ void unit_drawer::redraw_unit(const unit & u) const const int bar_shift = static_cast(-5*zoom_factor); const int hp_bar_height = static_cast(max_hitpoints * u.hp_bar_scaling()); + // TODO: stop using fixed-point stuff. const fixed_t bar_alpha = (loc == mouse_hex || loc == sel_hex) ? ftofxp(1.0): ftofxp(0.8); // HP bar @@ -391,7 +392,7 @@ void unit_drawer::draw_bar(int xpos, int ypos, size_t height, double filled, col static const color_t bar_color_border {213, 213, 213, 200}; // Override the filled area's color's alpha. - col.a = alpha; + col.a = std::min(alpha, 255); // Bar dimensions. // Note about the magic x, y additions: we used to use an image for the bar instead of drawing