/*
* 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.
*
* ---
*
* information.
*/
-#include "gamesdef.h"
+#include <config.h>
+
#include "misc.h"
#include "xy.h"
-#include "var.h"
#include "sect.h"
#include "file.h"
#include "nat.h"
unsigned int routelen;
if (!mapbuf)
- mapbuf = (unsigned int *)malloc((WORLD_X * WORLD_Y) *
+ mapbuf = malloc((WORLD_X * WORLD_Y) *
sizeof(unsigned int));
if (!mapbuf)
- return ((s_char *)0);
+ return NULL;
if (!mapindex) {
- mapindex =
- (unsigned int **)malloc(WORLD_X * sizeof(unsigned int *));
+ mapindex = malloc(WORLD_X * sizeof(unsigned int *));
if (mapindex) {
/* Setup the map pointers */
for (i = 0; i < WORLD_X; i++)
}
}
if (!mapindex)
- return ((s_char *)0);
+ return NULL;
bpath[0] = 0;
if (0 != (restr2 = (*terrain == 'R')))
if (x == ex && y == ey) {
bpath[0] = 'h';
bpath[1] = 0;
- return ((s_char *)bpath);
+ return bpath;
}
if (!valid(x, y) || !valid(ex, ey))
- return ((s_char *)0);
+ return NULL;
if (restr2 && (!owned_and_navigable(bigmap, x, y, terrain, own) ||
!owned_and_navigable(bigmap, x, y, terrain, own)))
- return ((s_char *)0);
+ return NULL;
for (i = 0; i < WORLD_X; i++)
for (j = 0; j < WORLD_Y; j++)
if (++routelen == MAXROUTE) {
bpath[0] = '?';
bpath[1] = 0;
- return ((s_char *)bpath);
+ return bpath;
}
markedsectors = 0;
for (scanx = minx; scanx <= maxx; scanx++) {
tx = XNORM(tx);
ty = YNORM(ty);
}
- return ((s_char *)bpath);
+ return bpath;
}
}
}
} while (markedsectors);
bpath[0] = 0;
- return ((s_char *)0); /* no route possible */
+ return NULL; /* no route possible */
}
/* return TRUE if sector is passable */
/* No terrain to check? Everything is navigable! (this
probably means we are flying) */
if (!(*terrain))
- return (1);
+ return 1;
/* Are we checking this map? */
if (map) {
since otherwise we'll never venture anywhere */
mapspot = map[sctoff(x, y)];
if (mapspot == ' ' || mapspot == 0)
- return (1);
+ return 1;
/* Now, is it marked with a 'x' or 'X'? If so, avoid it! */
if (mapspot == 'x' || mapspot == 'X')
- return (0);
+ return 0;
} else {
/* We don't know what it is since we have no map, so return ok! */
- return (1);
+ return 1;
}
/* Now, check this bmap entry to see if it is one of the
}
if (negate && *t) {
/* We found it, so we say it's bad since we are negating */
- return (0);
+ return 0;
} else if (!negate && !*t) {
/* We didn't find it, so we say it's bad since we aren't negating */
- return (0);
+ return 0;
}
/* According to our bmap, this sector is ok so far. */
/* We can't sail through deity sectors, but we can sail
through any ocean */
if (rel < FRIENDLY && sect->sct_type != SCT_WATER)
- return (0);
+ return 0;
}
}
/* Ok, now, check these two sector types */
/* check for bad harbors. */
if (c == 'h' && sect->sct_effic < 2)
- return (0);
+ return 0;
/* check for bad bridges */
if (c == '=' && sect->sct_effic < 60)
- return (0);
+ return 0;
/* Woo-hoo, it's ok! */
- return (1);
+ return 1;
}