]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/navi.c
Fix navigate and march not to lay mines free of charge
[empserver] / src / lib / commands / navi.c
index d7071ae202c44ddaf6e9af851a396162de49a7e4..745208e697e2a066b86732014ab23525b24471b8 100644 (file)
@@ -184,7 +184,10 @@ do_unit_move(struct emp_qelem *ulist, int *together,
            continue;
        }
        ac = parse(cp, scanspace, player->argp, NULL, NULL, NULL);
-       if (ac <= 1) {
+       if (ac <= 0) {
+           player->argp[0] = "";
+           cp = NULL;
+       } else if (ac == 1) {
            sprintf(dp, "%d", leader->uid);
            player->argp[1] = dp;
            cp++;
@@ -241,8 +244,8 @@ do_unit_move(struct emp_qelem *ulist, int *together,
            skip = 1;
            continue;
        case 'd':
-           if (ac == 2) {
-               player->argp[2] = player->argp[1];
+           if (ac < 3) {
+               player->argp[2] = ac < 2 ? "1" : player->argp[1];
                sprintf(dp, "%d", leader->uid);
                player->argp[1] = dp;
            }
@@ -250,6 +253,7 @@ do_unit_move(struct emp_qelem *ulist, int *together,
                mine();
            else
                landmine();
+           stopping = 1;
            skip = 1;
            player->btused++;
            continue;
@@ -278,7 +282,6 @@ nav_map(int x, int y, int show_designations)
 {
     char *ptr;
     struct nstr_sect ns;
-    struct natstr *np;
     struct sctstr sect;
     int i;
     /* Note this is not re-entrant anyway, so we keep the buffers
@@ -305,7 +308,6 @@ nav_map(int x, int y, int show_designations)
        return RET_FAIL;
     }
     snxtsct_dist(&ns, x, y, 1);
-    np = getnatp(player->cnum);
     blankfill(wmapbuf, &ns.range, 1);
     while (nxtsct(&ns, &sect)) {
        ptr = &wmap[ns.dy][ns.dx];