Remove a bunch of redundant casts.
This commit is contained in:
parent
ee6d72f3b8
commit
4f59fc9967
125 changed files with 417 additions and 432 deletions
|
@ -132,13 +132,12 @@ bestownedpath(s_char *bpath,
|
|||
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);
|
||||
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++)
|
||||
|
@ -160,7 +159,7 @@ bestownedpath(s_char *bpath,
|
|||
if (x == ex && y == ey) {
|
||||
bpath[0] = 'h';
|
||||
bpath[1] = 0;
|
||||
return ((s_char *)bpath);
|
||||
return bpath;
|
||||
}
|
||||
|
||||
if (!valid(x, y) || !valid(ex, ey))
|
||||
|
@ -186,7 +185,7 @@ bestownedpath(s_char *bpath,
|
|||
if (++routelen == MAXROUTE) {
|
||||
bpath[0] = '?';
|
||||
bpath[1] = 0;
|
||||
return ((s_char *)bpath);
|
||||
return bpath;
|
||||
}
|
||||
markedsectors = 0;
|
||||
for (scanx = minx; scanx <= maxx; scanx++) {
|
||||
|
@ -219,7 +218,7 @@ bestownedpath(s_char *bpath,
|
|||
tx = XNORM(tx);
|
||||
ty = YNORM(ty);
|
||||
}
|
||||
return ((s_char *)bpath);
|
||||
return bpath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ knockdown(struct sctstr *sp, struct emp_qelem *list)
|
|||
|
||||
/* Sink all the units */
|
||||
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
|
||||
while (nxtitem(&ni, (s_char *)&land)) {
|
||||
while (nxtitem(&ni, &land)) {
|
||||
if (land.lnd_own == 0)
|
||||
continue;
|
||||
if (land.lnd_x != sp->sct_x || land.lnd_y != sp->sct_y)
|
||||
|
@ -137,7 +137,7 @@ knockdown(struct sctstr *sp, struct emp_qelem *list)
|
|||
}
|
||||
/* Sink all the planes */
|
||||
snxtitem_xy(&ni, EF_PLANE, sp->sct_x, sp->sct_y);
|
||||
while (nxtitem(&ni, (s_char *)&plane)) {
|
||||
while (nxtitem(&ni, &plane)) {
|
||||
if (plane.pln_own == 0)
|
||||
continue;
|
||||
if (plane.pln_x != sp->sct_x || plane.pln_y != sp->sct_y)
|
||||
|
|
|
@ -62,7 +62,7 @@ has_units(coord x, coord y, natid cn, struct lndstr *lp)
|
|||
int n;
|
||||
struct lndstr land;
|
||||
|
||||
for (n = 0; ef_read(EF_LAND, n, (s_char *)&land); n++) {
|
||||
for (n = 0; ef_read(EF_LAND, n, &land); n++) {
|
||||
if (land.lnd_x != x || land.lnd_y != y)
|
||||
continue;
|
||||
if (lp) {
|
||||
|
@ -85,7 +85,7 @@ has_units_with_mob(coord x, coord y, natid cn)
|
|||
struct lndstr land;
|
||||
|
||||
snxtitem_xy(&ni, EF_LAND, x, y);
|
||||
while (nxtitem(&ni, (s_char *)&land)) {
|
||||
while (nxtitem(&ni, &land)) {
|
||||
if (land.lnd_own != cn)
|
||||
continue;
|
||||
if (land.lnd_mobil > 0)
|
||||
|
@ -105,7 +105,7 @@ has_helpful_engineer(coord x, coord y, natid cn)
|
|||
struct lndstr land;
|
||||
|
||||
snxtitem_xy(&ni, EF_LAND, x, y);
|
||||
while (nxtitem(&ni, (s_char *)&land)) {
|
||||
while (nxtitem(&ni, &land)) {
|
||||
if (land.lnd_own != cn && getrel(getnatp(land.lnd_own), cn) != ALLIED)
|
||||
continue;
|
||||
if (lchr[(int)land.lnd_type].l_flags & L_ENGINEER)
|
||||
|
|
|
@ -70,20 +70,19 @@ draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp,
|
|||
static s_char **wmap = (s_char **)0;
|
||||
|
||||
if (!wmapbuf)
|
||||
wmapbuf =
|
||||
(s_char *)malloc((WORLD_Y * MAPWIDTH(1)) * sizeof(s_char));
|
||||
wmapbuf = malloc((WORLD_Y * MAPWIDTH(1)) * sizeof(s_char));
|
||||
if (!wmap) {
|
||||
wmap = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
|
||||
wmap = malloc(WORLD_Y * sizeof(s_char *));
|
||||
if (wmap && wmapbuf) {
|
||||
for (i = 0; i < WORLD_Y; i++)
|
||||
wmap[i] = &wmapbuf[MAPWIDTH(1) * i];
|
||||
} else if (wmap) {
|
||||
free((s_char *)wmap);
|
||||
free(wmap);
|
||||
wmap = (s_char **)0;
|
||||
}
|
||||
}
|
||||
if (!bitmap)
|
||||
bitmap = (u_char *)malloc((WORLD_X * WORLD_Y) / 8);
|
||||
bitmap = malloc((WORLD_X * WORLD_Y) / 8);
|
||||
if (!wmapbuf || !wmap || !bitmap) {
|
||||
pr("Memory error, tell the deity.\n");
|
||||
logerror("malloc failed in draw_map\n");
|
||||
|
|
|
@ -81,7 +81,7 @@ bp_init(void)
|
|||
|
||||
ep = &empfile[EF_SECTOR];
|
||||
|
||||
bp = (struct bestp *)malloc(sizeof(*bp));
|
||||
bp = malloc(sizeof(*bp));
|
||||
memset(bp, 0, sizeof(*bp));
|
||||
bp->adp = as_init(BP_NEIGHBORS, BP_ASHASHSIZE, bp_coord_hash,
|
||||
bp_neighbors, bp_lbcost, bp_realcost,
|
||||
|
@ -91,9 +91,8 @@ bp_init(void)
|
|||
return NULL;
|
||||
|
||||
if (neighsects == (struct sctstr **)0)
|
||||
neighsects = (struct sctstr **)calloc(1, (sizeof(struct sctstr *) *
|
||||
((WORLD_X * WORLD_Y) /
|
||||
2) * 6));
|
||||
neighsects = calloc(((WORLD_X * WORLD_Y) / 2) * 6,
|
||||
sizeof(struct sctstr *));
|
||||
|
||||
return (s_char *)bp;
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ sectdamage(struct sctstr *sp, int dam, struct emp_qelem *list)
|
|||
return eff;
|
||||
|
||||
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
|
||||
while (nxtitem(&ni, (s_char *)&land)) {
|
||||
while (nxtitem(&ni, &land)) {
|
||||
if (!land.lnd_own)
|
||||
continue;
|
||||
landdamage(&land, dam);
|
||||
|
@ -119,7 +119,7 @@ sectdamage(struct sctstr *sp, int dam, struct emp_qelem *list)
|
|||
if (dam <= 0)
|
||||
return eff;
|
||||
snxtitem_xy(&ni, EF_PLANE, sp->sct_x, sp->sct_y);
|
||||
while (nxtitem(&ni, (s_char *)&plane)) {
|
||||
while (nxtitem(&ni, &plane)) {
|
||||
if (!plane.pln_own)
|
||||
continue;
|
||||
if (plane.pln_flags & PLN_LAUNCHED)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue