(getpath): Supply the missing code for P_SAILING. This makes the sail

command accept destination sectors as well as paths.  Clean up the
case discrimination.
This commit is contained in:
Markus Armbruster 2006-04-05 07:30:41 +00:00
parent b923c951ed
commit 9c2b741b2e

View file

@ -119,18 +119,21 @@ getpath(char *buf, char *arg, coord x, coord y, int onlyown,
while (*p) { while (*p) {
if (sarg_xy(p, &dx, &dy)) { if (sarg_xy(p, &dx, &dy)) {
bp = NULL; bp = NULL;
if (destinations == P_NONE) { switch (destinations) {
case P_NONE:
pr("Destination sectors not allowed here!\n"); pr("Destination sectors not allowed here!\n");
} break;
if (getsect(dx, dy, &dsect)) { case P_WALKING:
if (destinations == P_WALKING) { if (getsect(dx, dy, &dsect))
bp = BestLandPath(buf2, &sect, &dsect, bp = BestLandPath(buf2, &sect, &dsect,
&mv_cost, MOB_ROAD); &mv_cost, MOB_ROAD);
} else if (destinations == P_FLYING) { break;
case P_FLYING:
bp = BestAirPath(buf2, nx, ny, dx, dy); bp = BestAirPath(buf2, nx, ny, dx, dy);
} break;
} else { case P_SAILING:
pr("Invalid destination sector!\n"); bp = BestShipPath(buf2, nx, ny, dx, dy, player->cnum);
break;
} }
if (bp && p + strlen(bp) + 1 < buf + MAX_PATH_LEN) { if (bp && p + strlen(bp) + 1 < buf + MAX_PATH_LEN) {
strcpy(p, bp); strcpy(p, bp);