From 4305732e0a09a9e8ae8da6c076c4f65fa0c9c280 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Sun, 26 Jun 2022 23:40:35 +0200 Subject: human_player.c: reset deselected instances --- src/player/src/human_player.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/player/src/human_player.c b/src/player/src/human_player.c index 221146d..ffc4fd4 100644 --- a/src/player/src/human_player.c +++ b/src/player/src/human_player.c @@ -59,6 +59,9 @@ static bool select_units(struct human_player *const h, const short x, { sel = h->sel; h->n_sel = 1; + + for (size_t i = 1; i < sizeof h->sel / sizeof *h->sel; i++) + h->sel[i].d.u = NULL; } else { @@ -123,6 +126,9 @@ static bool select_buildings(struct human_player *const h, const short x, { sel = h->sel; h->n_sel = 1; + + for (size_t i = 1; i < sizeof h->sel / sizeof *h->sel; i++) + h->sel[i].d.b = NULL; } else { @@ -176,6 +182,9 @@ static bool select_resources(struct human_player *const h, const short x, { sel = h->sel; h->n_sel = 1; + + for (size_t i = 1; i < sizeof h->sel / sizeof *h->sel; i++) + h->sel[i].d.r = NULL; } else { -- cgit v1.2.3