Remove p_mode, use MOB_FLY and MOB_SAIL instead
This commit is contained in:
parent
8f008bf849
commit
182d62deed
8 changed files with 19 additions and 24 deletions
|
@ -55,12 +55,6 @@
|
||||||
#define MOB_SAIL 3
|
#define MOB_SAIL 3
|
||||||
#define MOB_FLY 4
|
#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 */
|
/* src/lib/global/dir.c */
|
||||||
extern signed char dirindex['z'-'a'+1];
|
extern signed char dirindex['z'-'a'+1];
|
||||||
extern int diroff[DIR_MAP+1][2];
|
extern int diroff[DIR_MAP+1][2];
|
||||||
|
@ -82,7 +76,7 @@ extern void path_find_print_stats(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* src/lib/subs/paths.c */
|
/* 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 fcost(struct sctstr *, natid);
|
||||||
extern double ncost(struct sctstr *, natid);
|
extern double ncost(struct sctstr *, natid);
|
||||||
extern double pathtoxy(char *, coord *, coord *,
|
extern double pathtoxy(char *, coord *, coord *,
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
* Dave Pare, 1986
|
* Dave Pare, 1986
|
||||||
* Ken Stevens, 1995
|
* Ken Stevens, 1995
|
||||||
* Steve McClure, 1998-2000
|
* Steve McClure, 1998-2000
|
||||||
* Markus Armbruster, 2004-2009
|
* Markus Armbruster, 2004-2011
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -108,7 +108,7 @@ bomb(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
ax = ap_sect.sct_x;
|
ax = ap_sect.sct_x;
|
||||||
ay = ap_sect.sct_y;
|
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)
|
|| *flightpath == 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
tx = ax;
|
tx = ax;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Dave Pare, 1986
|
* Dave Pare, 1986
|
||||||
* Markus Armbruster, 2004-2009
|
* Markus Armbruster, 2004-2011
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -62,7 +62,7 @@ drop(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
ax = ap_sect.sct_x;
|
ax = ap_sect.sct_x;
|
||||||
ay = ap_sect.sct_y;
|
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)
|
|| *flightpath == 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
tx = ax;
|
tx = ax;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Dave Pare, 1986
|
* Dave Pare, 1986
|
||||||
* Steve McClure, 2000
|
* Steve McClure, 2000
|
||||||
* Markus Armbruster, 2004-2009
|
* Markus Armbruster, 2004-2011
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -65,7 +65,7 @@ fly(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
ax = ap_sect.sct_x;
|
ax = ap_sect.sct_x;
|
||||||
ay = ap_sect.sct_y;
|
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)
|
|| *flightpath == 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
tx = ax;
|
tx = ax;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Dave Pare, 1986
|
* Dave Pare, 1986
|
||||||
* Ken Stevens, 1995
|
* Ken Stevens, 1995
|
||||||
* Markus Armbruster, 2004-2009
|
* Markus Armbruster, 2004-2011
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -66,7 +66,7 @@ para(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
ax = ap_sect.sct_x;
|
ax = ap_sect.sct_x;
|
||||||
ay = ap_sect.sct_y;
|
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)
|
|| *flightpath == 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
tx = ax;
|
tx = ax;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Dave Pare, 1986
|
* Dave Pare, 1986
|
||||||
* Markus Armbruster, 2004-2009
|
* Markus Armbruster, 2004-2011
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -63,7 +63,7 @@ reco(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
ax = ap_sect.sct_x;
|
ax = ap_sect.sct_x;
|
||||||
ay = ap_sect.sct_y;
|
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)
|
|| *flightpath == 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
tx = ax;
|
tx = ax;
|
||||||
|
|
|
@ -121,7 +121,7 @@ cmd_sail_ship(struct nstr_item *nstr)
|
||||||
pr("Ship #%d at %s\n", ship.shp_uid,
|
pr("Ship #%d at %s\n", ship.shp_uid,
|
||||||
xyas(ship.shp_x, ship.shp_y, player->cnum));
|
xyas(ship.shp_x, ship.shp_y, player->cnum));
|
||||||
cp = getpath(navpath, player->argp[2],
|
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)
|
if (!cp)
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if (!check_ship_ok(&ship))
|
if (!check_ship_ok(&ship))
|
||||||
|
|
|
@ -88,8 +88,8 @@ diridx(char dir)
|
||||||
* which do not accept partial moves.
|
* which do not accept partial moves.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
getpath(char *buf, char *arg, coord x, coord y, int onlyown,
|
getpath(char *buf, char *arg, coord x, coord y, int onlyown, int showdes,
|
||||||
int showdes, enum p_mode destinations)
|
int mobtype)
|
||||||
{
|
{
|
||||||
char buf2[1024];
|
char buf2[1024];
|
||||||
char *p = buf;
|
char *p = buf;
|
||||||
|
@ -114,11 +114,12 @@ more:
|
||||||
while (*p) {
|
while (*p) {
|
||||||
if (sarg_xy(p, &dx, &dy)) {
|
if (sarg_xy(p, &dx, &dy)) {
|
||||||
bp = NULL;
|
bp = NULL;
|
||||||
switch (destinations) {
|
switch (mobtype) {
|
||||||
case P_NONE:
|
default:
|
||||||
|
CANT_REACH();
|
||||||
pr("Destination sectors not allowed here!\n");
|
pr("Destination sectors not allowed here!\n");
|
||||||
break;
|
break;
|
||||||
case P_FLYING:
|
case MOB_FLY:
|
||||||
if (path_find(x, y, dx, dy, 0, MOB_FLY) < 0)
|
if (path_find(x, y, dx, dy, 0, MOB_FLY) < 0)
|
||||||
bp = NULL;
|
bp = NULL;
|
||||||
else {
|
else {
|
||||||
|
@ -132,7 +133,7 @@ more:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case P_SAILING:
|
case MOB_SAIL:
|
||||||
if (path_find(x, y, dx, dy, player->cnum, MOB_SAIL) < 0)
|
if (path_find(x, y, dx, dy, player->cnum, MOB_SAIL) < 0)
|
||||||
bp = NULL;
|
bp = NULL;
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue