From b4038deb223e309fe886c71b3765a7e82e65f9bb Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Fri, 9 Jan 2015 21:05:46 +0100 Subject: handle the different type of targets Signed-off-by: Olivier Gayot --- jouer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'jouer.c') diff --git a/jouer.c b/jouer.c index 95ee0f4..4aac874 100644 --- a/jouer.c +++ b/jouer.c @@ -110,12 +110,13 @@ static void update_current_character(struct team_t *t1, struct team_t *t2, struc static enum action_state_t select_target(struct action_params_t *params, void *data, - void (*cb)(SURFACES *, POSITIONS *, struct character_t *, struct character_t *, void *)) + void (*cb)(SURFACES *, POSITIONS *, struct character_t *, struct target_t *, void *)) { SURFACES *surfaces = params->surfaces; POSITIONS *positions = params->positions; /* select our own character because he exists no matter what */ struct team_t *target_team = params->src->team; + struct target_t target; int selection = target_team->chr_cur; int new_selection; SDL_Event event; @@ -172,9 +173,12 @@ enum action_state_t select_target(struct action_params_t *params, void *data, break; case SDLK_RETURN: case SDLK_f: + target.is_chr = true; + target.chr = &target_team->chrs[selection]; + update_selected_target(surfaces, positions, NULL); - (*cb)(surfaces, positions, params->src, &target_team->chrs[selection], data); + (*cb)(surfaces, positions, params->src, &target, data); return ACTION_PERFORMED; default: -- cgit v1.2.3