home · contact · privacy
Fixed bug that led to endless loop in nearest_enemy_dir().
[plomrogue] / src / ai.c
index aee8e738de50e245a40a057e513753723ba13eaf..a4d4fbe09d15b03e8f3d5747dd272e59dc1ff056 100644 (file)
--- a/src/ai.c
+++ b/src/ai.c
@@ -45,8 +45,7 @@ static void clockwise_path(char ** path_ptr)
     for (; i < len; i++)
     {
         uint8_t next_i = i + 1;
-        if (   next_i == len
-            || old_char != path[next_i])
+        if (next_i == len || old_char != path[next_i])
         {
             break;
         }
@@ -67,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);