]> git.pond.sub.org Git - empserver/blobdiff - src/lib/common/path.c
A* path and neighbor cache performance statistics
[empserver] / src / lib / common / path.c
index c0344d13e33a8cfda3613b75f8f97fdb71a20903..965da6e29b81ea838ad47818b855fdd713f09707 100644 (file)
@@ -51,8 +51,6 @@
 #define BP_NEIGHBORS   6       /* max number of neighbors */
 
 struct bestp {
-    int sctcache_hits;
-    int sctcache_misses;
     int bp_mobtype;
     struct as_data *adp;
 };
@@ -91,6 +89,8 @@ bp_init(void)
 /*
  * Find the best path from sector to to sector, and put the Empire movement
  * string in path.  Return 0 on success, -1 on error.
+ * FIXME unsafe by design: assumes path[] has space; buffer overrun
+ * when path gets long!
  */
 static int
 best_path(struct sctstr *from, struct sctstr *to, char *path, int mob_type)
@@ -120,12 +120,9 @@ best_path(struct sctstr *from, struct sctstr *to, char *path, int mob_type)
 
 #ifdef AS_STATS
     as_stats(adp, stderr);
+    fprintf(stderr, "neighbor cache %zu bytes\n",
+           WORLD_SZ() * 6 * sizeof(struct sctstr *));
 #endif /* AS_STATS */
-#ifdef BP_STATS
-    fprintf(stderr, "best path %s\n", path);
-    fprintf(stderr, "cache hits/misses: %d/%d\n",
-           bp->sctcache_hits, bp->sctcache_misses);
-#endif /* BP_STATS */
     return 0;
 }