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 --- ia.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ia.c') diff --git a/ia.c b/ia.c index 0844339..3b5d3f4 100644 --- a/ia.c +++ b/ia.c @@ -39,16 +39,18 @@ void ai_play_turn(struct action_params_t *params) /* XXX complete brainless articial intelligence */ struct team_t *target_team; - struct character_t *target; + struct target_t target; + + target.is_chr = true; target_team = (params->src->team == params->t1) ? params->t2 : params->t1; - target = ai_find_random_target(target_team); + target.chr = ai_find_random_target(target_team); - if (target == NULL) { + if (target.chr == NULL) { /* do nothing, everyone is dead */ return; } - attack(params->surfaces, params->positions, params->src, target, NULL); + attack(params->surfaces, params->positions, params->src, &target, NULL); } -- cgit v1.2.3