]> 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 ddab374868fedfcfd3a31c1628bee7da035fd847..745208e697e2a066b86732014ab23525b24471b8 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2010, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -82,7 +82,7 @@ do_unit_move(struct emp_qelem *ulist, int *together,
     char *pt = pathtaken;
     char bmap_flag;
     int ac;
-    short type;
+    int type;
 
     leader = get_leader(ulist);
     leader_uid = leader->uid;
@@ -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];