summaryrefslogtreecommitdiff
path: root/ia.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 /ia.c
parent2a76d0662f9494f8469283a7b0fc72c17f40ecf6 (diff)
handle the different type of targets
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'ia.c')
-rw-r--r--ia.c10
1 files changed, 6 insertions, 4 deletions
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);
}