]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/path.c
COPYING duplicates information from README. Remove. Move GPL from
[empserver] / src / lib / commands / path.c
index f73eacf9eb00b9d6a14ecd9733d8943c04d154ee..abe1b009eb4029989a3351486562c787e2270541 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2004, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -19,9 +19,9 @@
  *
  *  ---
  *
- *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- *  related information and legal notices. It is expected that any future
- *  projects/authors will amend these files as needed.
+ *  See files README, COPYING and CREDITS in the root of the source
+ *  tree for related information and legal notices.  It is expected
+ *  that future projects/authors will amend these files as needed.
  *
  *  ---
  *
@@ -32,6 +32,8 @@
  *     (unknown rewrite), 1989
  */
 
+#include <config.h>
+
 #include "misc.h"
 #include "player.h"
 #include "xy.h"
@@ -80,15 +82,14 @@ path(void)
        return RET_FAIL;
     }
     if (!mapbuf)
-       mapbuf =
-           (s_char *)malloc((WORLD_Y * MAPWIDTH(3)) * sizeof(s_char));
+       mapbuf = malloc((WORLD_Y * MAPWIDTH(3)) * sizeof(s_char));
     if (!map) {
-       map = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
+       map = malloc(WORLD_Y * sizeof(s_char *));
        if (map && mapbuf) {
            for (i = 0; i < WORLD_Y; i++)
                map[i] = &mapbuf[MAPWIDTH(3) * i];
        } else if (map) {
-           free((s_char *)map);
+           free(map);
            map = (s_char **)0;
        }
     }
@@ -102,7 +103,10 @@ path(void)
     natp = getnatp(player->cnum);
     xyrelrange(natp, &absrange, &relrange);
     blankfill((s_char *)mapbuf, &ns.range, 3);
-    while (*pp && (i = chkdir(*pp, DIR_STOP, DIR_LAST)) >= 0) {
+    for (; *pp; ++pp) {
+       i = diridx(*pp);
+       if (i == DIR_STOP)
+           break;
        memcpy(&map[deltay(cy, ns.range.ly)][deltax(cx, ns.range.lx) * 2],
               routech[i][0],
               3);