From d06b4a2fb38e831b877a4e1da8107b2989ee4e10 Mon Sep 17 00:00:00 2001 From: n0pen <109176125+n0pen@users.noreply.github.com> Date: Sun, 17 Jul 2022 08:06:22 -0400 Subject: [PATCH] Change the bodygraph colors and thresholds (#59349) The bodygraph and HP colors did not match at different thresholds The widget colors are calculated using an offset. That offset was not used in the bodygraph color calc. resolves #59274 Co-authored-by: nopen --- src/display.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/display.cpp b/src/display.cpp index 29560ae4d47b0..1d45f430bd4eb 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -1484,14 +1484,16 @@ static std::pair get_bodygraph_bp_sym_color( const Charac const int cur_hp = u.get_part_hp_cur( bid ); const int max_hp = u.get_part_hp_max( bid ); const float cur_hp_pcnt = cur_hp / static_cast( max_hp ); - if( cur_hp_pcnt < 0.25f ) { + if( cur_hp_pcnt < 0.125f ) { return { bgp.sym, c_red }; - } else if( cur_hp_pcnt < 0.5f ) { + } else if( cur_hp_pcnt < 0.375f ) { return { bgp.sym, c_light_red }; - } else if( cur_hp_pcnt < 0.75f ) { + } else if( cur_hp_pcnt < 0.625f ) { return { bgp.sym, c_yellow }; + } else if( cur_hp_pcnt < 0.875f ) { + return { bgp.sym, c_light_green }; } - return { bgp.sym, c_light_green }; + return { bgp.sym, c_green }; } std::string display::colorized_bodygraph_text( const Character &u, const std::string graph_id,