Remove some redundant parenthesis; no functional change.

This commit is contained in:
Markus Armbruster 2005-07-23 19:48:35 +00:00
parent 4861f837fb
commit 380b063f9c
41 changed files with 134 additions and 134 deletions

View file

@ -135,7 +135,7 @@ bestownedpath(s_char *bpath,
mapbuf = malloc((WORLD_X * WORLD_Y) *
sizeof(unsigned int));
if (!mapbuf)
return ((s_char *)0);
return NULL;
if (!mapindex) {
mapindex = malloc(WORLD_X * sizeof(unsigned int *));
if (mapindex) {
@ -145,7 +145,7 @@ bestownedpath(s_char *bpath,
}
}
if (!mapindex)
return ((s_char *)0);
return NULL;
bpath[0] = 0;
if (0 != (restr2 = (*terrain == 'R')))
@ -163,11 +163,11 @@ bestownedpath(s_char *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++)
@ -232,7 +232,7 @@ bestownedpath(s_char *bpath,
} while (markedsectors);
bpath[0] = 0;
return ((s_char *)0); /* no route possible */
return NULL; /* no route possible */
}
/* return TRUE if sector is passable */
@ -249,7 +249,7 @@ owned_and_navigable(s_char *map, int x, int y, s_char *terrain, int own)
/* 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) {
@ -257,14 +257,14 @@ owned_and_navigable(s_char *map, int x, int y, s_char *terrain, int own)
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
@ -283,10 +283,10 @@ owned_and_navigable(s_char *map, int x, int y, s_char *terrain, int own)
}
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. */
@ -301,16 +301,16 @@ owned_and_navigable(s_char *map, int x, int y, s_char *terrain, int own)
/* 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;
}

View file

@ -175,7 +175,7 @@ ef_ptr(int type, int id)
logerror("ef_ptr: (%s) only valid for EFF_MEM entries", ep->file);
return NULL;
}
return (ep->cache + ep->size * id);
return ep->cache + ep->size * id;
}
/*

View file

@ -231,7 +231,7 @@ bp_neighbors(struct as_coord c, struct as_coord *cp, s_char *pp)
cp[n].y = sy;
n++;
}
return (n);
return n;
}
/*
@ -253,7 +253,7 @@ bp_lbcost(struct as_coord from, struct as_coord to, s_char *pp)
offset = (sy * WORLD_X + sx) / 2;
ts = (struct sctstr *)(ep->cache + ep->size * offset);
cost = sector_mcost(ts, bp->bp_mobtype);
return (cost);
return cost;
}
/*
@ -262,7 +262,7 @@ bp_lbcost(struct as_coord from, struct as_coord to, s_char *pp)
static double
bp_realcost(struct as_coord from, struct as_coord to, s_char *pp)
{
return (bp_lbcost(from, to, pp));
return bp_lbcost(from, to, pp);
}
/*
@ -369,12 +369,12 @@ BestShipPath(s_char *path, int fx, int fy, int tx, int ty, int owner)
/* need to make sector database available to bestpath */
map = ef_ptr(EF_BMAP, owner);
return (bestownedpath(path, map, fx, fy, tx, ty, ".=h", owner));
return bestownedpath(path, map, fx, fy, tx, ty, ".=h", owner);
}
s_char *
BestAirPath(s_char *path, int fx, int fy, int tx, int ty)
{
return (bestownedpath(path, 0, fx, fy, tx, ty, "", -1));
return bestownedpath(path, 0, fx, fy, tx, ty, "", -1);
/* return (bestpath(path, fx, fy, tx, ty, "")); */
}

View file

@ -139,7 +139,7 @@ demand_update_want(int *want, int *pop, int which)
}
*want = totwant;
*pop = totpop;
return (whichwants);
return whichwants;
}
static int
@ -154,20 +154,20 @@ demand_check(void)
if (0 == update_wantmin) {
logerror("no demand update allowed, wantmin = 0");
return (0);
return 0;
}
demand_update_want(&want, &pop, 0);
if (want < update_wantmin) {
logerror("no demand update, want = %d, min = %d",
want, update_wantmin);
return (0);
return 0;
}
time(&now);
if (!demand_update_time(&now)) {
logerror("no demand update, not within hours allowed.");
return (0);
return 0;
}
@ -183,10 +183,10 @@ demand_check(void)
if (veto) {
logerror("no demand update, %d has missed more than %d updates",
veto - 1, update_missed);
return (0);
return 0;
}
return (1);
return 1;
}
/* Check if enough countries want an update,
@ -197,10 +197,10 @@ demandupdatecheck(void)
{
if (UDDEM_COMSET != update_demandpolicy) {
logerror("no demand update, not policy.");
return (0);
return 0;
}
return (demand_check());
return demand_check();
}
/* Is it time for a regular or scheduled update?
@ -212,27 +212,27 @@ updatetime(time_t *now)
{
if (opt_BLITZ && update_policy == UDP_BLITZ) {
logerror("BLITZ Update.");
return (1);
return 1;
}
if (UDP_NORMAL == update_policy) {
logerror("Regular update, etu type.");
return (1);
return 1;
}
if (UDP_TIMES == update_policy) {
if (scheduled_update_time(now)) {
logerror("Scheduled update.");
return (1);
return 1;
}
}
if (opt_DEMANDUPDATE) {
if (demand_check()) {
logerror("Demand update, at check time.");
return (1);
return 1;
}
}
return (0);
return 0;
}
/* Return the time, and delta seconds, of the next update.