aboutsummaryrefslogtreecommitdiff
path: root/hud/hud_views.c
diff options
context:
space:
mode:
authorjacopo grandi <jak.sk8@hotmail.it>2021-03-02 18:26:39 +0100
committerjacopo grandi <jak.sk8@hotmail.it>2021-03-02 18:26:39 +0100
commita988df656b4d37dfa2472a4cde390185cfcea8b5 (patch)
tree262b48644a5aff086b6ead687d0f2297bf946c2b /hud/hud_views.c
parent7932daa7e308b1c92ab97dde00fcc0ed790895a6 (diff)
test foundation and functional reimplementation of cost function
Diffstat (limited to 'hud/hud_views.c')
-rw-r--r--hud/hud_views.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/hud/hud_views.c b/hud/hud_views.c
index b2192b3..385501e 100644
--- a/hud/hud_views.c
+++ b/hud/hud_views.c
@@ -72,6 +72,10 @@ void render_view_stats_unit (SDL_Renderer* rend, txtd *t, int px, int py,
int n = stats_weapon_sprintf(info, u->weapon +i, arr);
for (int i=0; i<n; i++) { LABEL(px+pad, py+h, arr[i], 1); h += 15; }
}
+ h += 5;
+ float cost = stats_compute_cost(&info->cost_weights, u);
+ char s[64]; sprintf(s, "COST: %.2f", cost);
+ LABEL(px+pad, py+h, s, 1); h += 15;
}
@@ -84,7 +88,9 @@ void render_view_stats (SDL_Renderer* rend, txtd *t, int px, int py,
stats_unit base;
stats_unit_compute(info, tm, &base);
- render_view_stats_unit(rend, t, px+10, py+h, info, &base);
+ if (tm->chassis != -1) {
+ render_view_stats_unit(rend, t, px+10, py+h, info, &base);
+ }
}