From c3d87a1dee96775443fdf73c53e1350af7ca5fc2 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sat, 14 Dec 2013 06:16:50 +0100 Subject: [PATCH] Fixed bug that led to endless loop in nearest_enemy_dir(). --- src/ai.c | 3 ++- src/main.c | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ai.c b/src/ai.c index 7efacf2..a4d4fbe 100644 --- a/src/ai.c +++ b/src/ai.c @@ -66,7 +66,8 @@ static char nearest_enemy_dir(struct yx_uint16 origin) dist_max = world.map->size.x; } uint8_t escape = 0; - uint8_t dist, i, j; + uint8_t dist, j; + uint16_t i; for (dist = 1; !escape && dist <= dist_max; dist++) { char * path = try_malloc(dist + 1, f_name); diff --git a/src/main.c b/src/main.c index 74ef761..c9e468b 100644 --- a/src/main.c +++ b/src/main.c @@ -3,7 +3,7 @@ #include "main.h" /* for world global */ #include /* for atoi(), exit(), EXIT_FAILURE */ #include /* for FILE typedef, F_OK */ -#include /* for initscr(), noecho(), curs_set(), keypad(), raw() */ +#include /* for noecho(), curs_set(), keypad(), raw() */ #include /* for time() */ #include /* for getopt(), optarg */ #include /* for uint32_t */ @@ -15,12 +15,12 @@ * try_fclose_unlink_rename(), try_fgetc_noeof(), */ #include "map_objects.h" /* for structs MapObj, init_map_object_defs(), - * build_map_objects(), get_player() + * add_map_objects(), get_player() */ #include "map.h" /* for struct Map, init_map() */ -#include "misc.h" /* for update_log(), find_passable_pos(), save_game(), - * try_calloc(), check_tempfile(), check_xor_files(), - * load_interface_conf(), load_game(), rrand() +#include "misc.h" /* for update_log(), save_game(), try_calloc(), load_game(), + * check_tempfile(), check_files_xor(), load_interface_conf(), + * rrand() */ #include "wincontrol.h" /* get_win_by_id(), get_winconf_by_win() */ #include "rexit.h" /* for exit_game() */ -- 2.30.2