]> git.pond.sub.org Git - empserver/commitdiff
Remove p_mode, use MOB_FLY and MOB_SAIL instead
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 27 Mar 2011 06:29:50 +0000 (08:29 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 12 Apr 2011 19:51:32 +0000 (21:51 +0200)
include/path.h
src/lib/commands/bomb.c
src/lib/commands/drop.c
src/lib/commands/fly.c
src/lib/commands/para.c
src/lib/commands/reco.c
src/lib/commands/sail.c
src/lib/subs/paths.c

index 8efa85f7735ec07df147a25ebf44c80c9c81a845..43477fba3df8bcafbdc135cfcd52d58dd155d0b4 100644 (file)
 #define MOB_SAIL       3
 #define MOB_FLY                4
 
 #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];
 /* 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 */
 #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 *,
 extern double fcost(struct sctstr *, natid);
 extern double ncost(struct sctstr *, natid);
 extern double pathtoxy(char *, coord *, coord *,
index f4be206adeeef7a3c0d0f1762937fe61e5249642..19e4a4abd477398e4cb66ea30aaa8682213da499 100644 (file)
@@ -30,7 +30,7 @@
  *     Dave Pare, 1986
  *     Ken Stevens, 1995
  *     Steve McClure, 1998-2000
  *     Dave Pare, 1986
  *     Ken Stevens, 1995
  *     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;
     ax = ap_sect.sct_x;
     ay = ap_sect.sct_y;
        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;
        || *flightpath == 0)
        return RET_SYN;
     tx = ax;
index 69d5dd3126f5bea33324603f5144c5420c52669b..b6242dcf8f82a0dbb386b3160a4f45ffe30eaf3a 100644 (file)
@@ -28,7 +28,7 @@
  *
  *  Known contributors to this file:
  *     Dave Pare, 1986
  *
  *  Known contributors to this file:
  *     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;
     ax = ap_sect.sct_x;
     ay = ap_sect.sct_y;
        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;
        || *flightpath == 0)
        return RET_SYN;
     tx = ax;
index 4a4abcd305b9ae10bb3cb038650569bc8a0d2cde..aef826110fedd85e9a5eff82d4e5b13a62996659 100644 (file)
@@ -29,7 +29,7 @@
  *  Known contributors to this file:
  *     Dave Pare, 1986
  *     Steve McClure, 2000
  *  Known contributors to this file:
  *     Dave Pare, 1986
  *     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;
     ax = ap_sect.sct_x;
     ay = ap_sect.sct_y;
        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;
        || *flightpath == 0)
        return RET_SYN;
     tx = ax;
index 80f2c181c9261c0d646bf3126316a2b4bd99cdea..3a424fb59cd196dec07a2c8ba8ff1597697689bd 100644 (file)
@@ -29,7 +29,7 @@
  *  Known contributors to this file:
  *     Dave Pare, 1986
  *     Ken Stevens, 1995
  *  Known contributors to this file:
  *     Dave Pare, 1986
  *     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;
     ax = ap_sect.sct_x;
     ay = ap_sect.sct_y;
        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;
        || *flightpath == 0)
        return RET_SYN;
     tx = ax;
index ed4ad6bf0c18fc1749f21fdf639415219a0be319..1a5f74f4bce0bb62c9f48edb5eab47068bc0ecbe 100644 (file)
@@ -28,7 +28,7 @@
  *
  *  Known contributors to this file:
  *     Dave Pare, 1986
  *
  *  Known contributors to this file:
  *     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;
     ax = ap_sect.sct_x;
     ay = ap_sect.sct_y;
        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;
        || *flightpath == 0)
        return RET_SYN;
     tx = ax;
index 49a4216f5223a0e67b3fd0c9e434f3b429eca796..940ff78b486945b88a968f31b6229589a21decd5 100644 (file)
@@ -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],
        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))
        if (!cp)
            return RET_FAIL;
        if (!check_ship_ok(&ship))
index f0c100553f1a043906204f286ae222610d59260c..c1d740f4cac5ad22ae1cf64322c49068100852fa 100644 (file)
@@ -88,8 +88,8 @@ diridx(char dir)
  * which do not accept partial moves.
  */
 char *
  * 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;
 {
     char buf2[1024];
     char *p = buf;
@@ -114,11 +114,12 @@ more:
     while (*p) {
        if (sarg_xy(p, &dx, &dy)) {
            bp = NULL;
     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;
                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 {
                if (path_find(x, y, dx, dy, 0, MOB_FLY) < 0)
                    bp = NULL;
                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)
                    bp = NULL;
                else {
                if (path_find(x, y, dx, dy, player->cnum, MOB_SAIL) < 0)
                    bp = NULL;
                else {