]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/pathlib/utility.qc
Fix a crash and a bunch of warnings when fancy pathing is enabled
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / pathlib / utility.qc
index 9ebaac9f275830a8115f4ac661165cd8f4235a6b..da64db697345b9a2cd70f0ef100ef6ff6409661b 100644 (file)
@@ -28,12 +28,14 @@ entity pathlib_nodeatpoint(vector where)
     where.x = fsnap(where.x,pathlib_gridsize);
     where.y = fsnap(where.y,pathlib_gridsize);
 
-    FOREACH_ENTITY_RADIUS(where, pathlib_gridsize * 0.5, it.is_path_node,
+    entity found = NULL; // TODO: using FOREACH_ENTITY_RADIUS here causes mutex loop warnings, this may need a proper fix!
+    IL_EACH(g_pathlib_nodes, it.is_path_node && vdist(it.origin - where, <, pathlib_gridsize * 0.5),
     {
-       return it;
+       found = it;
+        break;
     });
 
-    return NULL;
+    return found;
 }
 
 bool tile_check_cross(entity this, vector where)