]> git.pond.sub.org Git - empserver/commitdiff
(shp_sweep): New parameter takemob. Charge mobility only if it's
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 11 Jun 2006 18:09:09 +0000 (18:09 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 11 Jun 2006 18:09:09 +0000 (18:09 +0000)
true.
(shp_nav_one_sector): Pass false.  This lets minesweepers move at the
speed their stats indicate.  Closes #1498801.
(navi): Pass true.  This ensures sweeping without moving still costs
mobility.

include/prototypes.h
src/lib/commands/navi.c
src/lib/subs/shpsub.c

index e241f6dee5fc8467e90f58f28e7bdcb0c759eb26..30679173e439950a3ff46e8cf9539d80a42bb187 100644 (file)
@@ -656,7 +656,7 @@ extern void show_news(int);
 /* shpsub.c */
 extern void shp_sel(struct nstr_item *, struct emp_qelem *);
 extern void shp_nav(struct emp_qelem *, double *, double *, int *, natid);
-extern int shp_sweep(struct emp_qelem *, int, natid);
+extern int shp_sweep(struct emp_qelem *, int, int, natid);
 extern char *shp_path(int, struct shpstr *, char *);
 extern void shp_put(struct emp_qelem *, natid);
 extern void shp_list(struct emp_qelem *);
index 266f9733da769159983e7c6692ae51523034752c..793c3bd65c79135a7baa86226f14dbb1b2b4e7f7 100644 (file)
@@ -156,7 +156,7 @@ navi(void)
            } else if (cp[-1] == 'i') {
                shp_list(&ship_list);
            } else {
-               stopping |= shp_sweep(&ship_list, 1, player->cnum);
+               stopping |= shp_sweep(&ship_list, 1, 0, player->cnum);
            }
            continue;
        } else if (*cp == 'r' || *cp == 'l' || *cp == 's') {
index 77f33d73433ae88707c7b4d3e40f01929acf7b89..8cb234a49ab1d6080e4937b00f03a1a64eefbc26 100644 (file)
@@ -210,7 +210,7 @@ shp_put(struct emp_qelem *list, natid actor)
 }
 
 int
-shp_sweep(struct emp_qelem *ship_list, int verbose, natid actor)
+shp_sweep(struct emp_qelem *ship_list, int verbose, int takemob, natid actor)
 {
     struct emp_qelem *qp;
     struct emp_qelem *next;
@@ -229,7 +229,7 @@ shp_sweep(struct emp_qelem *ship_list, int verbose, natid actor)
                    prship(&mlp->ship));
            continue;
        }
-       if (mlp->mobil <= 0.0) {
+       if (takemob && mlp->mobil <= 0.0) {
            if (verbose)
                mpr(actor, "%s is out of mobility!\n", prship(&mlp->ship));
            continue;
@@ -241,8 +241,10 @@ shp_sweep(struct emp_qelem *ship_list, int verbose, natid actor)
                    prship(&mlp->ship));
            continue;
        }
-       mlp->mobil -= shp_mobcost(&mlp->ship);
-       mlp->ship.shp_mobil = (int)mlp->mobil;
+       if (takemob) {
+           mlp->mobil -= shp_mobcost(&mlp->ship);
+           mlp->ship.shp_mobil = (int)mlp->mobil;
+       }
        putship(mlp->ship.shp_uid, &mlp->ship);
        if (!(mines = sect.sct_mines))
            continue;
@@ -877,7 +879,7 @@ shp_nav_one_sector(struct emp_qelem *list, int dir, natid actor,
     }
     if (QEMPTY(list))
        return stopping;
-    stopping |= shp_sweep(list, 0, actor);
+    stopping |= shp_sweep(list, 0, 0, actor);
     if (QEMPTY(list))
        return stopping;
     stopping |= shp_check_mines(list);