]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/move.c
Fix trailing whitespace
[empserver] / src / lib / commands / move.c
index e32d91dea544bf8e5156170d694eb4b34e539509..0891ee8672e18e2347aecbf2feac0b3de0256709 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
  *  ---
  *
  *  move.c: Move commodities around
- * 
+ *
  *  Known contributors to this file:
- *     
+ *
  */
 
 #include <config.h>
 
-#include "misc.h"
-#include "player.h"
-#include "plague.h"
-#include "sect.h"
+#include "commands.h"
 #include "item.h"
-#include "file.h"
-#include "xy.h"
-#include "nat.h"
-#include "nsc.h"
 #include "land.h"
+#include "optlist.h"
 #include "path.h"
-#include "commands.h"
+#include "plague.h"
 
 
 static int cmd_move_map(coord curx, coord cury, char *arg);
@@ -170,8 +164,9 @@ move(void)
        }
        amt_src = start.sct_item[vtype];
        if (amt_src < amount) {
-           pr("Only %d %s left in %s!\n", amt_src,
-              ip->i_name, xyas(start.sct_x, start.sct_y, player->cnum));
+           pr("Only %d %s left in %s!\n",
+              amt_src, ip->i_name,
+              xyas(start.sct_x, start.sct_y, player->cnum));
            amount = amt_src;
            amt_src = 0;
        } else
@@ -185,7 +180,7 @@ move(void)
     /*
      * Now parse the path and return ending sector.
      */
-    dam = (istest ? 0 : 1);
+    dam = !istest && !(opt_SUPER_BARS && vtype == I_BAR);
     if (dam && !chance(weight / 200.0))
        dam = 0;
     mcost = move_ground(&sect, &endsect, weight, player->argp[4],
@@ -348,11 +343,7 @@ move(void)
 static int
 cmd_move_map(coord curx, coord cury, char *arg)
 {
-    player->argp[0] = "map";
-    player->argp[1] = arg;
-    player->argp[2] = NULL;
-    player->condarg = NULL;
-    return map();
+    return display_region_map(0, EF_SHIP, curx, cury, arg);
 }
 
 int
@@ -376,9 +367,9 @@ want_to_abandon(struct sctstr *sp, i_type vtype, int amnt, struct lndstr *lp)
 int
 would_abandon(struct sctstr *sp, i_type vtype, int amnt, struct lndstr *lp)
 {
-    int mil, civs, loyalcivs;
+    int mil, civs;
 
-    if ((vtype != I_CIVIL) && (vtype != I_MILIT))
+    if (vtype != I_CIVIL && vtype != I_MILIT)
        return 0;
 
     mil = sp->sct_item[I_MILIT];
@@ -386,20 +377,9 @@ would_abandon(struct sctstr *sp, i_type vtype, int amnt, struct lndstr *lp)
 
     if (vtype == I_MILIT)
        mil -= amnt;
-
     if (vtype == I_CIVIL)
        civs -= amnt;
 
-    if (sp->sct_own == sp->sct_oldown)
-       loyalcivs = civs;
-    else
-       loyalcivs = 0;
-
-    /* If they have a military unit there, they still own it */
-    if (sp->sct_own != 0
-       && ((loyalcivs == 0) && (mil == 0)
-           && (has_units(sp->sct_x, sp->sct_y, sp->sct_own, lp) == 0)))
-       return 1;
-
-    return 0;
+    return sp->sct_own != 0 && civs <= 0 && mil <= 0
+       && !has_units(sp->sct_x, sp->sct_y, sp->sct_own, lp);
 }