From: Christian Heller <c.heller@plomlompom.de>
Date: Sat, 14 Dec 2013 05:16:50 +0000 (+0100)
Subject: Fixed bug that led to endless loop in nearest_enemy_dir().
X-Git-Tag: tce~895
X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/static/%27%29;%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20chunks.push%28escapeHTML%28span%5B2%5D%29%29;%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20chunks.push%28%27?a=commitdiff_plain;h=c3d87a1dee96775443fdf73c53e1350af7ca5fc2;p=plomrogue

Fixed bug that led to endless loop in nearest_enemy_dir().
---

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 <stdlib.h> /* for atoi(), exit(), EXIT_FAILURE */
 #include <stdio.h> /* for FILE typedef, F_OK */
-#include <ncurses.h> /* for initscr(), noecho(), curs_set(), keypad(), raw() */
+#include <ncurses.h> /* for noecho(), curs_set(), keypad(), raw() */
 #include <time.h> /* for time() */
 #include <unistd.h> /* for getopt(), optarg */
 #include <stdint.h> /* 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() */