X-Git-Url: https://plomlompom.com/repos/feed.xml?a=blobdiff_plain;f=src%2Fserver%2Fai.c;h=1596d5ae1915d600712ed99657e2e0bffd563dcc;hb=4266e8b48fc5481ce24c0bf02fdd517217f8390a;hp=d099c5748ce2d69ca6df26e3652d9141532d787c;hpb=639a12151eeb7ce0d18de330b4bb8d9d8094c4d3;p=plomrogue diff --git a/src/server/ai.c b/src/server/ai.c index d099c57..1596d5a 100644 --- a/src/server/ai.c +++ b/src/server/ai.c @@ -5,7 +5,7 @@ #include /* uint8_t, uint16_t, uint32_t, UINT16_MAX */ #include /* free() */ #include "../common/try_malloc.h" /* try_malloc() */ -#include "field_of_view.h" /* build_fov_map() */ +#include "field_of_view.h" /* VISIBLE */ #include "map_object_actions.h" /* get_moa_id_by_name() */ #include "map_objects.h" /* struct MapObj */ #include "world.h" /* global world */ @@ -129,20 +129,11 @@ static char get_dir_to_nearest_enemy(struct MapObj * mo_origin) uint32_t map_size = world.map.size.y * world.map.size.x; uint16_t max_score = UINT16_MAX - 1; uint16_t * score_map = try_malloc(map_size * sizeof(uint16_t), f_name); - uint8_t * fov_map = world.enemy_fov ? build_fov_map(mo_origin) : NULL; uint32_t i; for (i = 0; i < map_size; i++) { - if (world.enemy_fov) - { - score_map[i] = fov_map[i] & VISIBLE ? max_score : UINT16_MAX; - } - else - { - score_map[i] = max_score; - } + score_map[i] = mo_origin->fov_map[i] & VISIBLE ? max_score : UINT16_MAX; } - free(fov_map); struct MapObj * mo = world.map_objs; for (; mo != NULL; mo = mo->next) {