Clean up path finding in nav_ship()
Destinations are no longer treated as unreachable when the best path is longer than 99 characters. Instead, consider up to 1023 characters of the best path.
This commit is contained in:
parent
404a76f79e
commit
8d23975299
1 changed files with 4 additions and 15 deletions
|
@ -243,7 +243,6 @@ int
|
|||
nav_ship(struct shpstr *sp)
|
||||
{
|
||||
char *cp;
|
||||
size_t len;
|
||||
int stopping;
|
||||
int quit;
|
||||
int didsomething = 0;
|
||||
|
@ -278,20 +277,7 @@ nav_ship(struct shpstr *sp)
|
|||
|
||||
if (path_find(sp->shp_x, sp->shp_y,
|
||||
sp->shp_destx[0], sp->shp_desty[0],
|
||||
sp->shp_own, MOB_SAIL) < 0)
|
||||
cp = NULL;
|
||||
else {
|
||||
len = path_find_route(buf, 100, sp->shp_x, sp->shp_y,
|
||||
sp->shp_destx[0], sp->shp_desty[0]);
|
||||
if (len >= 100)
|
||||
cp = NULL;
|
||||
else {
|
||||
if (len == 0)
|
||||
strcpy(buf, "h");
|
||||
cp = buf;
|
||||
}
|
||||
}
|
||||
if (!cp) {
|
||||
sp->shp_own, MOB_SAIL) < 0) {
|
||||
wu(0, sp->shp_own,
|
||||
"%s bad path, ship put on standby\n", prship(sp));
|
||||
sp->shp_autonav |= AN_STANDBY;
|
||||
|
@ -307,8 +293,11 @@ nav_ship(struct shpstr *sp)
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
path_find_route(buf, sizeof(buf), sp->shp_x, sp->shp_y,
|
||||
sp->shp_destx[0], sp->shp_desty[0]);
|
||||
stopping = 0;
|
||||
|
||||
cp = buf;
|
||||
while (*cp && !stopping && sp->shp_own && mlp->mobil > 0.0) {
|
||||
dir = diridx(*cp++);
|
||||
stopping |= shp_nav_one_sector(&ship_list, dir,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue