diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2024-01-27 13:54:57 +0100 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2024-01-27 17:38:11 +0100 |
| commit | b4f904ecdcf6b0857d28ab4a877ad0f3468153f7 (patch) | |
| tree | 656b7c75ff57963e18dac972e38baf9ba3d46ddb /src/player | |
| parent | 69f753d26f44c28668d23e0ba40bb3994141df82 (diff) | |
| download | jancity-b4f904ecdcf6b0857d28ab4a877ad0f3468153f7.tar.gz | |
Remove hp
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); } |
