Fix hp bar not being displayed when carrying
This commit is contained in:
parent
afc554167e
commit
7196c6a0cc
|
@ -143,26 +143,25 @@ static int render_sel_single_unit(const struct human_player *const h,
|
|||
hpl.text = hp_str;
|
||||
gui_add_child(r, &hpl.common);
|
||||
|
||||
char c_str[sizeof "255"];
|
||||
struct gui_label cl;
|
||||
|
||||
if (unit_can_harvest(u))
|
||||
{
|
||||
const struct unit_harvester *const uh = &u->us.harvester;
|
||||
|
||||
if (uh->carry)
|
||||
{
|
||||
char c_str[sizeof "255"];
|
||||
const int rs = snprintf(c_str, sizeof c_str, "%hhu", uh->carry);
|
||||
struct gui_label cl;
|
||||
|
||||
if (rs < 0 || rs >= sizeof c_str)
|
||||
return -1;
|
||||
|
||||
gui_label_init(&cl);
|
||||
cl.common.x = CARRY_X;
|
||||
cl.common.y = CARRY_Y;
|
||||
cl.text = c_str;
|
||||
gui_add_child(r, &cl.common);
|
||||
|
||||
if (rs < 0 || rs >= sizeof c_str)
|
||||
return -1;
|
||||
|
||||
return gui_render(r);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue