diff --git a/src/lib/commands/orde.c b/src/lib/commands/orde.c index 3cd98a5d..3b6706a8 100644 --- a/src/lib/commands/orde.c +++ b/src/lib/commands/orde.c @@ -474,12 +474,10 @@ sorde(void) c = BestShipPath(buf, ship.shp_x, ship.shp_y, ship.shp_destx[0], ship.shp_desty[0], ship.shp_own); - if (!c || !*c) + if (!c) pr(" no route possible"); else if (*c == 'h') pr(" has arrived"); - else if (*c == '?') - pr(" route too long"); else { /* distance to destination */ eta_calc(&ship, c, &len, &updates); diff --git a/src/lib/common/bestpath.c b/src/lib/common/bestpath.c index be159102..0d9c011a 100644 --- a/src/lib/common/bestpath.c +++ b/src/lib/common/bestpath.c @@ -176,8 +176,8 @@ bestownedpath(s_char *bpath, maxy = y + 1; do { - if (++routelen == MAXROUTE) - return "?"; + if (++routelen == MAXROUTE - 1) + return NULL; markedsectors = 0; for (scanx = minx; scanx <= maxx; scanx++) { x = XNORM(scanx); @@ -200,7 +200,8 @@ bestownedpath(s_char *bpath, } } if (tx == ex && ty == ey) { - bpath[routelen] = 0; + bpath[routelen] = 'h'; + bpath[routelen + 1] = 0; while (routelen--) { i = ((mapindex[tx][ty]) >> 13) - 1; bpath[routelen] = dirchar[i]; diff --git a/src/lib/update/nav_ship.c b/src/lib/update/nav_ship.c index 9907e012..9c8e5018 100644 --- a/src/lib/update/nav_ship.c +++ b/src/lib/update/nav_ship.c @@ -285,7 +285,7 @@ nav_ship(struct shpstr *sp) cp = BestShipPath(buf, sp->shp_x, sp->shp_y, sp->shp_destx[0], sp->shp_desty[0], sp->shp_own); - if (cp == 0 || (*cp == '\0') || (*cp == '?')) { + if (cp == 0) { wu(0, cnum, "%s bad path, ship put on standby\n", prship(sp)); sp->shp_autonav |= AN_STANDBY;