Use the new path finder for land paths, drop old A*
This gets rid of the memory leak mentioned in the previous commit. To get rid of the buffer overruns for long paths mentioned in the previous commit, make BestLandPath() fail when path length exceeds 1023 characters. assemble_dist_paths() and move_ground() pass buffers with a different size. Eliminate assemble_dist_paths()'s buffer. Update now works regardless of distribution distance (the distribute command still limits to 1023, to be fixed in a later commit). Enlarge move_ground()'s buffers. Doubles the length of paths accepted by explore, move, and transport. I use two test cases to benchmark the path finders: "continental" (Hvy Metal 2 updates) and "island" (Hvy Plastic 2 updates). The new path finder runs my tests around 3-4 times faster than the old A* without its caches. That's enough to meet its cached performance for "island", but it's only half as fast for "continental". Not for long; big speedups are coming.
This commit is contained in:
parent
90de24d038
commit
ffbbfcb25f
19 changed files with 39 additions and 1894 deletions
|
@ -75,16 +75,12 @@ extern double path_find(coord, coord, coord, coord, natid, int);
|
|||
extern size_t path_find_route(char *, size_t, coord, coord, coord, coord);
|
||||
|
||||
/* src/lib/common/path.c */
|
||||
extern void bp_enable_cachepath(void);
|
||||
extern void bp_disable_cachepath(void);
|
||||
extern void bp_clear_cachepath(void);
|
||||
extern char *BestDistPath(char *, struct sctstr *, struct sctstr *,
|
||||
double *);
|
||||
extern char *BestLandPath(char *, struct sctstr *, struct sctstr *,
|
||||
double *, int);
|
||||
extern char *BestShipPath(char *, int, int, int, int, int);
|
||||
extern char *BestAirPath(char *, int, int, int, int);
|
||||
extern double pathcost(struct sctstr *, char *, int);
|
||||
|
||||
/* src/lib/subs/paths.c */
|
||||
extern char *getpath(char *, char *, coord, coord, int, int, enum p_mode);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue