diff options
Diffstat (limited to 'src/player')
| -rw-r--r-- | src/player/src/human_player.c | 4 | ||||
| -rw-r--r-- | src/player/src/human_player_gui.c | 34 |
2 files changed, 2 insertions, 36 deletions
diff --git a/src/player/src/human_player.c b/src/player/src/human_player.c index 08cfbe0..7f67ec7 100644 --- a/src/player/src/human_player.c +++ b/src/player/src/human_player.c @@ -279,8 +279,8 @@ static void update_selected(struct human_player *const h) { struct sel_instance *const si = &h->sel[i]; - if (si->d.i && (!si->d.i->alive || si->d.i->dying - || si->type == INSTANCE_TYPE_UNIT)) + if (si->d.i + && (!si->d.i->alive || si->type == INSTANCE_TYPE_UNIT)) { si->d.i = NULL; h->n_sel--; diff --git a/src/player/src/human_player_gui.c b/src/player/src/human_player_gui.c index 60a7ecd..3f79848 100644 --- a/src/player/src/human_player_gui.c +++ b/src/player/src/human_player_gui.c @@ -25,8 +25,6 @@ static int render_sel_single_building(const struct human_player *const h, const struct sel_instance *const sel, struct gui_common *const r) { const struct building *const b = sel->d.b; - const struct instance *const in = &b->instance; - const instance_hp hp = in->hp, max_hp = building_maxhp(b); struct gui_label bl; gui_label_init(&bl); @@ -35,21 +33,6 @@ static int render_sel_single_building(const struct human_player *const h, bl.text = building_str(b); gui_add_child(r, &bl.common); - char hp_str[sizeof "65535/65535"]; - - const int rs = snprintf(hp_str, sizeof hp_str, "%u/%u", hp, max_hp); - - if (rs < 0 || rs >= sizeof hp_str) - return -1; - - struct gui_label hpl; - - gui_label_init(&hpl); - hpl.common.x = X_OFF; - hpl.common.y = HP_Y; - hpl.text = hp_str; - gui_add_child(r, &hpl.common); - return gui_render(r); } @@ -57,8 +40,6 @@ static int render_sel_single_unit(const struct human_player *const h, const struct sel_instance *const sel, struct gui_common *const r) { const struct unit *const u = sel->d.u; - const struct instance *const in = &u->instance; - const instance_hp hp = in->hp, max_hp = unit_maxhp(u); enum {CARRY_X = 96, CARRY_Y = 8}; struct gui_label ul; @@ -69,21 +50,6 @@ static int render_sel_single_unit(const struct human_player *const h, ul.text = unit_str(u); gui_add_child(r, &ul.common); - char hp_str[sizeof "65535/65535"]; - - const int rs = snprintf(hp_str, sizeof hp_str, "%u/%u", hp, max_hp); - - if (rs < 0 || rs >= sizeof hp_str) - return -1; - - struct gui_label hpl; - - gui_label_init(&hpl); - hpl.common.x = X_OFF; - hpl.common.y = HP_Y; - hpl.text = hp_str; - gui_add_child(r, &hpl.common); - return gui_render(r); } |
