]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/radmap.c
Update copyright notice.
[empserver] / src / lib / subs / radmap.c
index 312480670c1cac29c2b599408c13b320e8d61217..4e41418c4b61bd3d7f716b444f0a11d99a5a8586 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2007, 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.
  *
  *  ---
  *
  *     Dave Pare, 1989
  */
 
+#include <config.h>
+
+#include <stdlib.h>
+#include "file.h"
+#include "map.h"
 #include "misc.h"
-#include "player.h"
-#include "xy.h"
 #include "nat.h"
-#include "sect.h"
-#include "ship.h"
-#include "plane.h"
-#include "file.h"
 #include "nsc.h"
-#include "prototypes.h"
 #include "optlist.h"
+#include "plane.h"
+#include "player.h"
+#include "prototypes.h"
+#include "sect.h"
+#include "ship.h"
+#include "xy.h"
 
 static void radmap2(int, int, int, int, int, double, int);
 
@@ -66,10 +70,10 @@ radmapupd(int own, int cx, int cy, int eff, int range, double seesub)
 /* More dynamic world sized buffers.  We create 'em once, and then
  * never again.  No need to keep creating/tearing apart.  We may
  * want to do this in other places too where it doesn't matter. */
-static s_char **rad;
-static s_char *radbuf;
-static s_char **vis;
-static s_char *visbuf;
+static char **rad;
+static char *radbuf;
+static signed char **vis;
+static signed char *visbuf;
 
 static void
 radmap2(int owner,
@@ -87,20 +91,18 @@ radmap2(int owner,
     int changed = 0;
 
     if (!radbuf)
-       radbuf = (s_char *)malloc((WORLD_Y * (WORLD_X + 1)) *
-                                 sizeof(s_char));
+       radbuf = malloc(WORLD_Y * (WORLD_X + 1));
     if (!visbuf)
-       visbuf = (s_char *)malloc((WORLD_Y * (WORLD_X + 1)) *
-                                 sizeof(s_char));
+       visbuf = malloc(WORLD_Y * (WORLD_X + 1));
     if (!rad) {
-       rad = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
+       rad = malloc(WORLD_Y * sizeof(char *));
        if (rad && radbuf) {
            for (x = 0; x < WORLD_Y; x++)
                rad[x] = &radbuf[(WORLD_X + 1) * x];
        }
     }
     if (!vis) {
-       vis = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
+       vis = malloc(WORLD_Y * sizeof(signed char *));
        if (vis && visbuf) {
            for (x = 0; x < WORLD_Y; x++)
                vis[x] = &visbuf[(WORLD_X + 1) * x];
@@ -119,7 +121,7 @@ radmap2(int owner,
        pr("%s efficiency %d%%, max range %d\n",
           xyas(cx, cy, owner), eff, range);
     snxtsct_dist(&ns, cx, cy, range);
-    blankfill((s_char *)radbuf, &ns.range, 1);
+    blankfill(radbuf, &ns.range, 1);
     while (nxtsct(&ns, &sect)) {
        if (sect.sct_own == owner
            || sect.sct_type == SCT_WATER
@@ -144,7 +146,7 @@ radmap2(int owner,
        y = delty(&ns.range, (int)plane.pln_y);
 
        if ((plane.pln_flags & PLN_LAUNCHED) && plane.pln_own != owner) {
-           vis[y][x] = (s_char)100;
+           vis[y][x] = 100;
            rad[y][x] = '$';
        }
     }