/*
* 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
*
* ---
*
- * 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.
*
* ---
*
* (unknown rewrite), 1989
*/
+#include <config.h>
+
#include "misc.h"
#include "player.h"
#include "xy.h"
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;
}
}
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);