]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/move.c
Update copyright notice
[empserver] / src / lib / subs / move.c
index 5fdd967df13e9b4b7f6a94484dca6cc43fc70cf6..03cf9c5065bea8339339534be155985cf0767bed 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
 
 #include <config.h>
 
-#include "misc.h"
-#include "player.h"
-#include "sect.h"
-#include "item.h"
+#include <ctype.h>
+#include "damage.h"
 #include "file.h"
-#include "xy.h"
-#include "path.h"
-#include "nat.h"
 #include "map.h"
-#include "nsc.h"
-#include "damage.h"
+#include "path.h"
+#include "player.h"
 #include "prototypes.h"
+#include "sect.h"
 
 static int move_map(coord curx, coord cury, char *arg);
 
@@ -63,7 +59,7 @@ move_ground(struct sctstr *start, struct sctstr *end,
     double sect_mcost;
     double total_mcost;
     double mv_cost;
-    double mobility = (double)start->sct_mobil;
+    double mobility = start->sct_mobil;
     int dir;
     int intcost;
     int takedam = *dam;
@@ -85,7 +81,7 @@ move_ground(struct sctstr *start, struct sctstr *end,
        }
        pr("Looking for best path to %s\n", path);
        path = BestLandPath(buf2, start, &ending_sect, &total_mcost,
-                           MOB_ROAD);
+                           MOB_MOVE);
        if (exploring && path)  /* take off the 'h' */
            path[strlen(path) - 1] = '\0';
        if (!path)
@@ -126,7 +122,7 @@ move_ground(struct sctstr *start, struct sctstr *end,
        if (movstr && sarg_xy(movstr, &dx, &dy)) {
            if (getsect(dx, dy, &dsect)) {
                movstr = BestLandPath(buf2, &sect, &dsect, &mv_cost,
-                                     MOB_ROAD);
+                                     MOB_MOVE);
            } else {
                pr("Invalid destination sector!\n");
                movstr = NULL;
@@ -158,18 +154,17 @@ move_ground(struct sctstr *start, struct sctstr *end,
            *movstr = 0;
            continue;
        }
-       movstr++;
+       do  movstr++; while (isspace(*movstr));
        if (dir == DIR_MAP) {
            if (!exploring)
-               map(curx, cury, movstr + 1);
+               map(curx, cury, movstr);
            *movstr = 0;
            continue;
        } else if (dir == DIR_STOP)
            break;
        else if (dir == DIR_VIEW) {
            pr("%d%% %s with %d civilians.\n", sect.sct_effic,
-              dchr[sect.sct_type].d_name,
-              sect.sct_item[I_CIVIL]);
+              dchr[sect.sct_type].d_name, sect.sct_item[I_CIVIL]);
            continue;
        }
        /*
@@ -191,7 +186,7 @@ move_ground(struct sctstr *start, struct sctstr *end,
                *movstr = 0;
                continue;
            }
-           sect_mcost = sector_mcost(&next, MOB_ROAD);
+           sect_mcost = sector_mcost(&next, MOB_MOVE);
            if ((!player->owner && (!exploring
                                    || next.sct_item[I_MILIT]
                                    || next.sct_item[I_CIVIL]))
@@ -230,7 +225,7 @@ move_ground(struct sctstr *start, struct sctstr *end,
        if (takedam && chance(weight / 100.0) &&
            ((curx != oldx) || (cury != oldy)))
            *dam += ground_interdict(curx, cury, player->cnum,
-                                      "commodities");
+                                    "commodities");
        if (*dam >= 100)
            break;
     }