X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/copy_structured?a=blobdiff_plain;f=src%2Fserver%2Fai.c;h=91a6c8618c918e7eaf925085b1c288f2f5f638da;hb=d304b75ee742d50b6cfa9ad81c44d37fb84a4b5a;hp=c6139287125f9881c1f0179b5e8b35225cfa4dda;hpb=fa4a1c651a7b5221780fc7c6ddc1fdc17bc8a0bb;p=plomrogue diff --git a/src/server/ai.c b/src/server/ai.c index c613928..91a6c86 100644 --- a/src/server/ai.c +++ b/src/server/ai.c @@ -5,6 +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" /* HIDDEN */ #include "hardcoded_strings.h" /* s */ #include "thing_actions.h" /* get_thing_action_id_by_name() */ #include "things.h" /* struct Thing */ @@ -138,7 +139,8 @@ static char get_dir_to_nearest_enemy(struct Thing * t_origin) struct Thing * t = world.things; for (; t != NULL; t = t->next) { - if (!t->lifepoints || t == t_origin) + if ( !t->lifepoints || t == t_origin + || HIDDEN == t_origin->fov_map[t->pos.y*world.map.length+t->pos.x]) { continue; }