diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-01-09 21:05:46 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-01-09 21:06:03 +0100 |
commit | b4038deb223e309fe886c71b3765a7e82e65f9bb (patch) | |
tree | cf259313fc52a280400b6c1811e2eadb4e1a1bbf /ia.c | |
parent | 2a76d0662f9494f8469283a7b0fc72c17f40ecf6 (diff) |
handle the different type of targets
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'ia.c')
-rw-r--r-- | ia.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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); } |