]> git.pond.sub.org Git - empserver/commitdiff
Fix flying commands for destination equal to assembly point
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 11 Aug 2012 14:46:25 +0000 (16:46 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 12 Aug 2012 07:34:49 +0000 (09:34 +0200)
bomb, drop, fly, paradrop, recon and sweep fail when given a
destination sector equal to the assembly point.  Broken in commit
404a76f7, v4.3.27.  Reported by Tom Johnson.

Before that commit, getpath() returned NULL on error, "" when input is
an empty path, "h" when it's coordinates of the assembly point, and a
non-empty path otherwise.

The commit accidentally changed it to return "" instead of "h".

Instead of changing it back, make it return NULL when input is an
empty path, and change bomb() & friends to accept empty flight paths.

This also affects sail: it now fails when you give it an empty path,
just like bomb & friends.  Path "h" still works.

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/subs/paths.c

index e17f411c94ba1295d9d7b9c61268aef052c20c9f..ddfb3d2b48c67816162384a61c76fa9a09893a4a 100644 (file)
@@ -108,8 +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, MOB_FLY)
-       || *flightpath == 0)
+    if (!getpath(flightpath, player->argp[5], ax, ay, 0, 0, MOB_FLY))
        return RET_SYN;
     tx = ax;
     ty = ay;
index 330f9cd47f665ceee8d1ea9a2a2da67072f1fc8c..cb6273b2170d02538ae56fd4bf6ed263afc275ae 100644 (file)
@@ -61,8 +61,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, MOB_FLY)
-       || *flightpath == 0)
+    if (!getpath(flightpath, player->argp[4], ax, ay, 0, 0, MOB_FLY))
        return RET_SYN;
     tx = ax;
     ty = ay;
index f861b331b2e523c69b4092f4c1f57e3d6bd327a2..c7f7ca64c0e887e504ac9622924e7697af7122a4 100644 (file)
@@ -65,8 +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, MOB_FLY)
-       || *flightpath == 0)
+    if (!getpath(flightpath, player->argp[4], ax, ay, 0, 0, MOB_FLY))
        return RET_SYN;
     tx = ax;
     ty = ay;
index da5ac9acdc29698605d46b28f7b05969486093a7..85cdb54d5666df9da14c430b19c2b9d589beb09e 100644 (file)
@@ -64,8 +64,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, MOB_FLY)
-       || *flightpath == 0)
+    if (!getpath(flightpath, player->argp[4], ax, ay, 0, 0, MOB_FLY))
        return RET_SYN;
     tx = ax;
     ty = ay;
index 381bbf54223a8bad10f4784570d8741c68eed885..bee553ac06ffeb26ff8222336635595a8936598e 100644 (file)
@@ -63,8 +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, MOB_FLY)
-       || *flightpath == 0)
+    if (!getpath(flightpath, player->argp[4], ax, ay, 0, 0, MOB_FLY))
        return RET_SYN;
     tx = ax;
     ty = ay;
index f1875964c8a4448f8b0638348b98cfc5fe5c6f5c..7de13c182d10250030568d027134dc67ef6c053a 100644 (file)
@@ -143,7 +143,7 @@ more:
            break;
        }
        if (dir == DIR_STOP) {
-           p[1] = 0;
+           *p = 0;
            return buf;
        }
        ++p;
@@ -170,7 +170,7 @@ more:
     strcpy(p, bp);
     if (*bp)
        goto more;
-    return buf;
+    return buf[0] ? buf : NULL;
 }
 
 /*