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:
Markus Armbruster 2011-02-26 16:06:09 +01:00
parent 90de24d038
commit ffbbfcb25f
19 changed files with 39 additions and 1894 deletions

View file

@ -452,6 +452,9 @@ bufrotate(char *buf, size_t bufsz, size_t i)
static double
cost_land(natid actor, int uid, int mobtype)
{
/*
* Non-negative cost must not depend on ACTOR, see BestLandPath().
*/
struct sctstr *sp = (void *)empfile[EF_SECTOR].cache;
if (sp[uid].sct_own != actor)