summaryrefslogtreecommitdiff
path: root/jouer.c
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-01-09 21:05:46 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-01-09 21:06:03 +0100
commitb4038deb223e309fe886c71b3765a7e82e65f9bb (patch)
treecf259313fc52a280400b6c1811e2eadb4e1a1bbf /jouer.c
parent2a76d0662f9494f8469283a7b0fc72c17f40ecf6 (diff)
handle the different type of targets
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'jouer.c')
-rw-r--r--jouer.c8
1 files changed, 6 insertions, 2 deletions
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: