]> git.pond.sub.org Git - empserver/commitdiff
Fix 'm' in path argument of explore, move, transport
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 11 Feb 2012 08:51:46 +0000 (09:51 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 21 Feb 2012 17:11:23 +0000 (18:11 +0100)
Two related bugs:

* It moans about deprecated argument syntax ('m' without a space
  before its argument) even when there's no argument.

* It uses the third instead of second argument for map flags (second
  argument is ignored): "m# s" doesn't show ships, and "m# s p" shows
  planes instead of ships.

Broken in commit 28d48474, v4.3.27.

src/lib/subs/move.c

index 748548edb1d521c15646b94dc9037bebd2f14977..0d7de92ac88a2ee2df0de2b4c86d44d3476b418e 100644 (file)
@@ -64,7 +64,6 @@ move_ground(struct sctstr *start, struct sctstr *end,
     int dir;
     char scanspace[1024];
     char *argp[128];
     int dir;
     char scanspace[1024];
     char *argp[128];
-    int ac;
     int intcost;
     int takedam = *dam;
     int out = 0;
     int intcost;
     int takedam = *dam;
     int out = 0;
@@ -172,11 +171,12 @@ move_ground(struct sctstr *start, struct sctstr *end,
            continue;
        }
        if (dir == DIR_MAP) {
            continue;
        }
        if (dir == DIR_MAP) {
-           ac = parse(movstr, scanspace, argp, NULL, NULL, NULL);
-           if (ac == 1) {
+           parse(movstr, scanspace, argp, NULL, NULL, NULL);
+           if (argp[0][1]) {
                pr("Use of '%c' without a space before its argument is deprecated.\n"
                   "Support for it will go away in a future release\n",
                   *movstr);
                pr("Use of '%c' without a space before its argument is deprecated.\n"
                   "Support for it will go away in a future release\n",
                   *movstr);
+               argp[2] = argp[1];
                argp[1] = argp[0] + 1;
            }
            if (!exploring)
                argp[1] = argp[0] + 1;
            }
            if (!exploring)