diff --git a/include/path.h b/include/path.h index 8efa85f7..43477fba 100644 --- a/include/path.h +++ b/include/path.h @@ -55,12 +55,6 @@ #define MOB_SAIL 3 #define MOB_FLY 4 -enum p_mode { /* How to find path to destination */ - P_NONE, /* don't */ - P_FLYING, /* use BestAirPath() */ - P_SAILING /* use BestShipPath() */ -}; - /* src/lib/global/dir.c */ extern signed char dirindex['z'-'a'+1]; extern int diroff[DIR_MAP+1][2]; @@ -82,7 +76,7 @@ extern void path_find_print_stats(void); #endif /* src/lib/subs/paths.c */ -extern char *getpath(char *, char *, coord, coord, int, int, enum p_mode); +extern char *getpath(char *, char *, coord, coord, int, int, int); extern double fcost(struct sctstr *, natid); extern double ncost(struct sctstr *, natid); extern double pathtoxy(char *, coord *, coord *, diff --git a/src/lib/commands/bomb.c b/src/lib/commands/bomb.c index f4be206a..19e4a4ab 100644 --- a/src/lib/commands/bomb.c +++ b/src/lib/commands/bomb.c @@ -30,7 +30,7 @@ * Dave Pare, 1986 * Ken Stevens, 1995 * Steve McClure, 1998-2000 - * Markus Armbruster, 2004-2009 + * Markus Armbruster, 2004-2011 */ #include @@ -108,7 +108,7 @@ bomb(void) return RET_SYN; ax = ap_sect.sct_x; ay = ap_sect.sct_y; - if (!getpath(flightpath, player->argp[5], ax, ay, 0, 0, P_FLYING) + if (!getpath(flightpath, player->argp[5], ax, ay, 0, 0, MOB_FLY) || *flightpath == 0) return RET_SYN; tx = ax; diff --git a/src/lib/commands/drop.c b/src/lib/commands/drop.c index 69d5dd31..b6242dcf 100644 --- a/src/lib/commands/drop.c +++ b/src/lib/commands/drop.c @@ -28,7 +28,7 @@ * * Known contributors to this file: * Dave Pare, 1986 - * Markus Armbruster, 2004-2009 + * Markus Armbruster, 2004-2011 */ #include @@ -62,7 +62,7 @@ drop(void) return RET_SYN; ax = ap_sect.sct_x; ay = ap_sect.sct_y; - if (!getpath(flightpath, player->argp[4], ax, ay, 0, 0, P_FLYING) + if (!getpath(flightpath, player->argp[4], ax, ay, 0, 0, MOB_FLY) || *flightpath == 0) return RET_SYN; tx = ax; diff --git a/src/lib/commands/fly.c b/src/lib/commands/fly.c index 4a4abcd3..aef82611 100644 --- a/src/lib/commands/fly.c +++ b/src/lib/commands/fly.c @@ -29,7 +29,7 @@ * Known contributors to this file: * Dave Pare, 1986 * Steve McClure, 2000 - * Markus Armbruster, 2004-2009 + * Markus Armbruster, 2004-2011 */ #include @@ -65,7 +65,7 @@ fly(void) return RET_SYN; ax = ap_sect.sct_x; ay = ap_sect.sct_y; - if (!getpath(flightpath, player->argp[4], ax, ay, 0, 0, P_FLYING) + if (!getpath(flightpath, player->argp[4], ax, ay, 0, 0, MOB_FLY) || *flightpath == 0) return RET_SYN; tx = ax; diff --git a/src/lib/commands/para.c b/src/lib/commands/para.c index 80f2c181..3a424fb5 100644 --- a/src/lib/commands/para.c +++ b/src/lib/commands/para.c @@ -29,7 +29,7 @@ * Known contributors to this file: * Dave Pare, 1986 * Ken Stevens, 1995 - * Markus Armbruster, 2004-2009 + * Markus Armbruster, 2004-2011 */ #include @@ -66,7 +66,7 @@ para(void) return RET_SYN; ax = ap_sect.sct_x; ay = ap_sect.sct_y; - if (!getpath(flightpath, player->argp[4], ax, ay, 0, 0, P_FLYING) + if (!getpath(flightpath, player->argp[4], ax, ay, 0, 0, MOB_FLY) || *flightpath == 0) return RET_SYN; tx = ax; diff --git a/src/lib/commands/reco.c b/src/lib/commands/reco.c index ed4ad6bf..1a5f74f4 100644 --- a/src/lib/commands/reco.c +++ b/src/lib/commands/reco.c @@ -28,7 +28,7 @@ * * Known contributors to this file: * Dave Pare, 1986 - * Markus Armbruster, 2004-2009 + * Markus Armbruster, 2004-2011 */ #include @@ -63,7 +63,7 @@ reco(void) return RET_SYN; ax = ap_sect.sct_x; ay = ap_sect.sct_y; - if (!getpath(flightpath, player->argp[4], ax, ay, 0, 0, P_FLYING) + if (!getpath(flightpath, player->argp[4], ax, ay, 0, 0, MOB_FLY) || *flightpath == 0) return RET_SYN; tx = ax; diff --git a/src/lib/commands/sail.c b/src/lib/commands/sail.c index 49a4216f..940ff78b 100644 --- a/src/lib/commands/sail.c +++ b/src/lib/commands/sail.c @@ -121,7 +121,7 @@ cmd_sail_ship(struct nstr_item *nstr) pr("Ship #%d at %s\n", ship.shp_uid, xyas(ship.shp_x, ship.shp_y, player->cnum)); cp = getpath(navpath, player->argp[2], - ship.shp_x, ship.shp_y, 0, 0, P_SAILING); + ship.shp_x, ship.shp_y, 0, 0, MOB_SAIL); if (!cp) return RET_FAIL; if (!check_ship_ok(&ship)) diff --git a/src/lib/subs/paths.c b/src/lib/subs/paths.c index f0c10055..c1d740f4 100644 --- a/src/lib/subs/paths.c +++ b/src/lib/subs/paths.c @@ -88,8 +88,8 @@ diridx(char dir) * which do not accept partial moves. */ char * -getpath(char *buf, char *arg, coord x, coord y, int onlyown, - int showdes, enum p_mode destinations) +getpath(char *buf, char *arg, coord x, coord y, int onlyown, int showdes, + int mobtype) { char buf2[1024]; char *p = buf; @@ -114,11 +114,12 @@ more: while (*p) { if (sarg_xy(p, &dx, &dy)) { bp = NULL; - switch (destinations) { - case P_NONE: + switch (mobtype) { + default: + CANT_REACH(); pr("Destination sectors not allowed here!\n"); break; - case P_FLYING: + case MOB_FLY: if (path_find(x, y, dx, dy, 0, MOB_FLY) < 0) bp = NULL; else { @@ -132,7 +133,7 @@ more: } } break; - case P_SAILING: + case MOB_SAIL: if (path_find(x, y, dx, dy, player->cnum, MOB_SAIL) < 0) bp = NULL; else {