]> git.pond.sub.org Git - empserver/commitdiff
(getpath): Supply the missing code for P_SAILING. This makes the sail
authorMarkus Armbruster <armbru@pond.sub.org>
Wed, 5 Apr 2006 07:30:41 +0000 (07:30 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Wed, 5 Apr 2006 07:30:41 +0000 (07:30 +0000)
command accept destination sectors as well as paths.  Clean up the
case discrimination.

src/lib/subs/paths.c

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