diff --git a/include/ship.h b/include/ship.h index 32e25064..f04a6acc 100644 --- a/include/ship.h +++ b/include/ship.h @@ -209,10 +209,10 @@ struct mlist { #define SHP_BLD_WORK(lcm, hcm) (20 + (lcm) + 2 * (hcm)) /* return codes from shp_check_nav */ -#define CN_NAVIGABLE (0) -#define CN_LANDLOCKED (1) -#define CN_CONSTRUCTION (2) -#define CN_ERROR (-1) +#define CN_NAVIGABLE 0 +#define CN_LANDLOCKED 1 +#define CN_CONSTRUCTION 2 +#define CN_ERROR -1 enum { SHP_AIROPS_EFF = 50, /* min. efficiency for air ops */ diff --git a/src/lib/as/as_cache.c b/src/lib/as/as_cache.c index ca9b62ca..4c87f618 100644 --- a/src/lib/as/as_cache.c +++ b/src/lib/as/as_cache.c @@ -176,20 +176,20 @@ as_find_cachepath(coord fx, coord fy, coord tx, coord ty) /* Is the cache on? if not, return NULL */ if (as_cachepath_on == 0) - return (NULL); + return NULL; /* Do we have any cached? */ if (fromhead == (struct as_frompath **)0) - return (NULL); + return NULL; /* Yes! */ for (from = fromhead[fy]; from; from = from->next) { if (from->x == fx) { for (to = from->tolist[ty]; to; to = to->next) { if (to->x == tx) - return (to->path); + return to->path; } } } - return (NULL); + return NULL; } diff --git a/src/lib/as/as_costcomp.c b/src/lib/as/as_costcomp.c index c4149017..424b761c 100644 --- a/src/lib/as/as_costcomp.c +++ b/src/lib/as/as_costcomp.c @@ -33,15 +33,15 @@ as_costcomp(const void *p1, const void *p2) diff = (*n1)->lbcost - (*n2)->lbcost; if (diff < -0.0001) - return (-1); + return -1; if (diff > 0.0001) - return (1); + return 1; /* equal, check secondary cost */ diff = (*n1)->seccost - (*n2)->seccost; if (diff < -0.0001) - return (-1); + return -1; if (diff > 0.0001) - return (1); - return (0); + return 1; + return 0; } diff --git a/src/lib/as/as_extend.c b/src/lib/as/as_extend.c index 0f257e11..a40edfee 100644 --- a/src/lib/as/as_extend.c +++ b/src/lib/as/as_extend.c @@ -40,14 +40,14 @@ as_extend(struct as_data *adp) i = (*adp->neighbor) (head->np->c, adp->neighbor_coords, adp->userdata); if (i == 0) - return (NULL); + return NULL; /* * Get rid of neighbors that are more costly than ones we already have, * and sort the rest into an array of as_nodes. */ i = as_winnow(adp, adp->neighbor_coords, i); if (i < 0) - return (NULL); + return NULL; if (i > 1) qsort(adp->neighbor_nodes, i, sizeof(*adp->neighbor_nodes), as_costcomp); @@ -66,5 +66,5 @@ as_extend(struct as_data *adp) adp->tried->np->flags |= AS_TRIED; head = as_merge(adp, head, adp->neighbor_nodes); - return (head); + return head; } diff --git a/src/lib/as/as_hash.c b/src/lib/as/as_hash.c index 9311dfc4..0c767042 100644 --- a/src/lib/as/as_hash.c +++ b/src/lib/as/as_hash.c @@ -35,9 +35,9 @@ as_iscinq(struct as_data *adp, struct as_coord c) for (hp = adp->hashtab[hashval]; hp; hp = hp->next) if (hp->c.x == c.x && hp->c.y == c.y) - return (hp->qp); + return hp->qp; - return (NULL); + return NULL; } /* diff --git a/src/lib/as/as_init.c b/src/lib/as/as_init.c index a31fc85f..0ff8a9c9 100644 --- a/src/lib/as/as_init.c +++ b/src/lib/as/as_init.c @@ -54,5 +54,5 @@ as_init(int maxneighbors, adp->seccost = seccostfunc; adp->userdata = userdata; - return (adp); + return adp; } diff --git a/src/lib/as/as_merge.c b/src/lib/as/as_merge.c index 1f7a361c..bccbc0ca 100644 --- a/src/lib/as/as_merge.c +++ b/src/lib/as/as_merge.c @@ -77,5 +77,5 @@ as_merge(struct as_data *adp, struct as_queue *head, np->step++; } - return (head); + return head; } diff --git a/src/lib/as/as_search.c b/src/lib/as/as_search.c index f59e025a..9b737e9c 100644 --- a/src/lib/as/as_search.c +++ b/src/lib/as/as_search.c @@ -99,7 +99,7 @@ as_search(struct as_data *adp) #ifdef DEBUG fprintf(stderr, "Failed\n"); #endif /* DEBUG */ - return (-1); + return -1; } as_makepath(adp); @@ -121,7 +121,7 @@ as_search(struct as_data *adp) } #endif /* DEBUG */ - return (0); + return 0; } /* diff --git a/src/lib/as/as_winnow.c b/src/lib/as/as_winnow.c index 2fd79122..f2a4b2e9 100644 --- a/src/lib/as/as_winnow.c +++ b/src/lib/as/as_winnow.c @@ -91,7 +91,7 @@ as_winnow(struct as_data *adp, struct as_coord *coords, int ncoords) #endif /* DEBUG */ if (qp->np->flags & AS_TRIED) { /* should "never happen" */ - return (0); + return 0; } /* * The neighbor is better than a previously visited coordinate; @@ -135,7 +135,7 @@ as_winnow(struct as_data *adp, struct as_coord *coords, int ncoords) np = as_newnode(adp->head->np, *cp, inclbcost, lbcost, knowncost, seccost); if (np == NULL) - return (0); + return 0; if (fix_pointer) { #ifdef DEBUG fprintf(stderr, "Fixing pointer for %d, %d\n", @@ -148,7 +148,7 @@ as_winnow(struct as_data *adp, struct as_coord *coords, int ncoords) } adp->neighbor_nodes[i] = NULL; - return (i); + return i; } @@ -170,5 +170,5 @@ as_newnode(struct as_node *backp, struct as_coord c, np->step = backp->step; np->back = backp; - return (np); + return np; } diff --git a/src/lib/commands/coas.c b/src/lib/commands/coas.c index 814e8b02..12ad0d99 100644 --- a/src/lib/commands/coas.c +++ b/src/lib/commands/coas.c @@ -174,5 +174,5 @@ showship(struct coast **cpp, int x, int y) /* check that last one! */ if (todelete) free(todelete); - return (nship); + return nship; } diff --git a/src/lib/commands/desi.c b/src/lib/commands/desi.c index 523d9681..62eb7e5b 100644 --- a/src/lib/commands/desi.c +++ b/src/lib/commands/desi.c @@ -57,7 +57,7 @@ desi(void) if (player->argp[2]) { cost = do_desi(natp, player->argp[1], player->argp[2], cash, 0); if (cost < 0) - return (int)(-cost); + return (int)-cost; if (chkmoney(cost, cash, player->argp[3])) return RET_SYN; } diff --git a/src/lib/commands/edit.c b/src/lib/commands/edit.c index 7d7af219..f7757250 100644 --- a/src/lib/commands/edit.c +++ b/src/lib/commands/edit.c @@ -450,10 +450,10 @@ static int errcheck(int num, int min, int max) { if (num < min) - return (min); + return min; else if (num > max) - return (max); - return (num); + return max; + return num; } static int diff --git a/src/lib/commands/load.c b/src/lib/commands/load.c index 4f7d71b3..fee70f9a 100644 --- a/src/lib/commands/load.c +++ b/src/lib/commands/load.c @@ -618,7 +618,7 @@ load_land_ship(struct sctstr *sectp, struct shpstr *sp, int noisy, load_spy = 1; } } - if ((!load_spy) && + if (!load_spy && (sp->shp_nland >= mchr[(int)sp->shp_type].m_nland)) { if (noisy) { if (mchr[(int)sp->shp_type].m_nland) @@ -678,7 +678,7 @@ load_land_ship(struct sctstr *sectp, struct shpstr *sp, int noisy, land.lnd_x, land.lnd_y); } - land.lnd_ship = (-1); + land.lnd_ship = -1; sp->shp_nland--; putland(land.lnd_uid, &land); putship(sp->shp_uid, sp); @@ -1153,7 +1153,7 @@ load_land_land(struct sctstr *sectp, struct lndstr *lp, int noisy, land.lnd_own = sectp->sct_own; makenotlost(EF_LAND, land.lnd_own, land.lnd_uid, land.lnd_x, land.lnd_y); - land.lnd_land = (-1); + land.lnd_land = -1; lp->lnd_nland--; putland(land.lnd_uid, &land); putland(lp->lnd_uid, lp); diff --git a/src/lib/commands/mfir.c b/src/lib/commands/mfir.c index 8fbcba82..e4f23059 100644 --- a/src/lib/commands/mfir.c +++ b/src/lib/commands/mfir.c @@ -125,7 +125,7 @@ multifire(void) emp_initque(&fired); emp_initque(&defended); - type = (-1); + type = -1; while ((type != EF_SECTOR) && (type != EF_SHIP) && (type != EF_LAND)) { if (!(p = getstarg(player->argp[1], "Firing from ship(s), sect(s), or land unit(s)? ", @@ -692,7 +692,7 @@ defend(struct emp_qelem *al, struct emp_qelem *dl, enum targ_type target, emp_insque(&fp->queue, al); } - return (dam); + return dam; } static void @@ -963,7 +963,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown, } } - return ((*nfiring) == 0 ? 0 : (dam / (*nfiring))); + return *nfiring == 0 ? 0 : dam / *nfiring; } static void diff --git a/src/lib/commands/retr.c b/src/lib/commands/retr.c index 6b6d3b9a..e6837393 100644 --- a/src/lib/commands/retr.c +++ b/src/lib/commands/retr.c @@ -50,7 +50,9 @@ retr(void) int nships; struct nstr_item ni; struct shpstr ship; - int isfleet = 0, rflags = (-2), zero; + int isfleet = 0; + int rflags = -2; + int zero; unsigned int x; s_char buf1[1024]; s_char buf2[1024]; @@ -200,7 +202,9 @@ lretr(void) int nunits; struct nstr_item ni; struct lndstr land; - int isarmy = 0, rflags = (-2), zero; + int isarmy = 0; + int rflags = -2; + int zero; s_char buf1[1024]; s_char buf2[1024]; unsigned int x; diff --git a/src/lib/commands/sail.c b/src/lib/commands/sail.c index 3c50f853..23b5ed87 100644 --- a/src/lib/commands/sail.c +++ b/src/lib/commands/sail.c @@ -166,10 +166,10 @@ sail(void) return RET_SYN; cp = player->argp[2]; if ((*player->argp[0] == 'q') /*qsail command */ ||(cp && *cp == 'q')) { - return (show_sail(&nstr)); + return show_sail(&nstr); } else if (*player->argp[0] == 'u' /*unsail command */ || (cp && *cp == '-')) { - return (cmd_unsail_ship(&nstr)); + return cmd_unsail_ship(&nstr); } else - return (cmd_sail_ship(&nstr)); + return cmd_sail_ship(&nstr); } diff --git a/src/lib/commands/skyw.c b/src/lib/commands/skyw.c index af58cb37..31cab8e4 100644 --- a/src/lib/commands/skyw.c +++ b/src/lib/commands/skyw.c @@ -171,5 +171,5 @@ showsat(struct sky **skypp, int x, int y) /* check that last one! */ if (todelete) free(todelete); - return (nsat); + return nsat; } diff --git a/src/lib/commands/upda.c b/src/lib/commands/upda.c index 755fd4fb..bb3cebf5 100644 --- a/src/lib/commands/upda.c +++ b/src/lib/commands/upda.c @@ -145,7 +145,7 @@ upda(void) if (*game_hours != 0) pr("Game hours are: %s\n", game_hours); - return (0); + return 0; } else { time_t now; time_t upd_time; diff --git a/src/lib/common/bestpath.c b/src/lib/common/bestpath.c index aa840884..6043fb66 100644 --- a/src/lib/common/bestpath.c +++ b/src/lib/common/bestpath.c @@ -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; } diff --git a/src/lib/common/file.c b/src/lib/common/file.c index 55358358..271e00ae 100644 --- a/src/lib/common/file.c +++ b/src/lib/common/file.c @@ -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; } /* diff --git a/src/lib/common/path.c b/src/lib/common/path.c index 3122e426..98d55b2b 100644 --- a/src/lib/common/path.c +++ b/src/lib/common/path.c @@ -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, "")); */ } diff --git a/src/lib/common/wantupd.c b/src/lib/common/wantupd.c index ea2d8e6d..d76468aa 100644 --- a/src/lib/common/wantupd.c +++ b/src/lib/common/wantupd.c @@ -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. diff --git a/src/lib/gen/io.c b/src/lib/gen/io.c index 95fc032b..389cfc88 100644 --- a/src/lib/gen/io.c +++ b/src/lib/gen/io.c @@ -405,19 +405,19 @@ io_noblocking(struct iop *iop, int value) int io_conn(struct iop *iop) { - return (iop->flags & IO_CONN); + return iop->flags & IO_CONN; } int io_error(struct iop *iop) { - return (iop->flags & IO_ERROR); + return iop->flags & IO_ERROR; } int io_eof(struct iop *iop) { - return (iop->flags & IO_EOF); + return iop->flags & IO_EOF; } int diff --git a/src/lib/gen/plur.c b/src/lib/gen/plur.c index ecb0e713..06da17a4 100644 --- a/src/lib/gen/plur.c +++ b/src/lib/gen/plur.c @@ -37,23 +37,23 @@ s_char * plur(int n, s_char *no, s_char *yes) { - return (n == 1 ? no : yes); + return n == 1 ? no : yes; } s_char * splur(int n) { - return (n == 1 ? "" : "s"); + return n == 1 ? "" : "s"; } s_char * esplur(int n) { - return (n == 1 ? "" : "es"); + return n == 1 ? "" : "es"; } s_char * iesplur(int n) { - return (n == 1 ? "y" : "ies"); + return n == 1 ? "y" : "ies"; } diff --git a/src/lib/gen/round.c b/src/lib/gen/round.c index 68cb1726..15906cf8 100644 --- a/src/lib/gen/round.c +++ b/src/lib/gen/round.c @@ -39,7 +39,7 @@ roundintby(int n, int m) register int r11; r11 = (m >> 1) + n; - return (r11 / m * m); + return r11 / m * m; } int @@ -48,5 +48,5 @@ ldround(double a4, int ac) int f4; f4 = ac / 2.0 + a4; - return (f4 / ac * ac); + return f4 / ac * ac; } diff --git a/src/lib/gen/scthash.c b/src/lib/gen/scthash.c index 526ec9fe..08dc2566 100644 --- a/src/lib/gen/scthash.c +++ b/src/lib/gen/scthash.c @@ -40,5 +40,5 @@ scthash(int x, int y, int tsize) x = -x; if (y < 0) y = -y; - return ((x * 10 + y) % tsize); + return (x * 10 + y) % tsize; } diff --git a/src/lib/lwp/lwp.c b/src/lib/lwp/lwp.c index 6d7e0e90..558e3375 100644 --- a/src/lib/lwp/lwp.c +++ b/src/lib/lwp/lwp.c @@ -216,7 +216,7 @@ lwpCreate(int priority, void (*entry)(void *), int size, int flags, char *name, unsigned long stackp; if (!(newp = malloc(sizeof(struct lwpProc)))) - return (0); + return 0; if (flags & LWP_STACKCHECK) { /* Add a 1K buffer on each side of the stack */ size += 2 * LWP_REDZONE; @@ -224,7 +224,7 @@ lwpCreate(int priority, void (*entry)(void *), int size, int flags, char *name, size += LWP_EXTRASTACK; size += sizeof(stkalign_t); if (!(s = malloc(size))) - return (0); + return 0; newp->flags = flags; newp->name = strdup(name); newp->desc = strdup(desc); @@ -290,7 +290,7 @@ lwpCreate(int priority, void (*entry)(void *), int size, int flags, char *name, lwpInitContext(newp, sp); /* architecture-dependent: from arch.c */ #endif /* UCONTEXT */ lwpReschedule(); - return (newp); + return newp; } void @@ -335,7 +335,7 @@ lwpGetUD(struct lwpProc *p) { if (!p) p = LwpCurrent; - return (p->ud); + return p->ud; } /* @@ -415,7 +415,7 @@ lwpSetPriority(int new) lwpStatus(LwpCurrent, "resetting priority (%d -> %d)", old, new); if (new < old) lwpYield(); - return (old); + return old; } /* @@ -433,9 +433,9 @@ lwpInitSystem(int pri, char **ctxptr, int flags) pri = 1; /* *LwpContextPtr = 0; */ if (!(LwpCurrent = calloc(1, sizeof(struct lwpProc)))) - return (0); + return 0; if (!(stack = malloc(64))) - return (0); + return 0; if (LWP_MAX_PRIO <= pri) pri = LWP_MAX_PRIO - 1; if (LwpMaxpri < pri) @@ -453,7 +453,7 @@ lwpInitSystem(int pri, char **ctxptr, int flags) sel = lwpCreate(0, lwpSelect, 16384, flags, "EventHandler", "Select (main loop) Event Handler", 0, 0, 0); lwpInitSelect(sel); - return (LwpCurrent); + return LwpCurrent; } /* lwpStackCheckInit diff --git a/src/lib/lwp/queue.c b/src/lib/lwp/queue.c index 73e0695d..61e8ea66 100644 --- a/src/lib/lwp/queue.c +++ b/src/lib/lwp/queue.c @@ -33,7 +33,7 @@ lwpGetFirst(struct lwpQueue *q) if ((head = q->head) && !(q->head = head->next)) q->tail = 0; - return (head); + return head; } void diff --git a/src/lib/lwp/sem.c b/src/lib/lwp/sem.c index 05572221..2ede9821 100644 --- a/src/lib/lwp/sem.c +++ b/src/lib/lwp/sem.c @@ -43,11 +43,11 @@ lwpCreateSem(char *name, int count) struct lwpSem *new; if (!(new = malloc(sizeof(struct lwpSem)))) - return (0); + return 0; new->name = strdup(name); new->count = count; new->q.head = new->q.tail = 0; - return (new); + return new; } /* diff --git a/src/lib/subs/attsub.c b/src/lib/subs/attsub.c index 57c22dc8..5758c9b6 100644 --- a/src/lib/subs/attsub.c +++ b/src/lib/subs/attsub.c @@ -2181,7 +2181,7 @@ take_casualty(int combat_mode, struct combat *off, struct emp_qelem *olist) } if (QEMPTY(olist)) - return (CASUALTY_LUMP - to_take); + return CASUALTY_LUMP - to_take; /* * Need to take some casualties from attacking units @@ -2199,11 +2199,11 @@ take_casualty(int combat_mode, struct combat *off, struct emp_qelem *olist) } } if (biggest == (struct emp_qelem *)0) - return (CASUALTY_LUMP - to_take); + return CASUALTY_LUMP - to_take; llp = (struct llist *)biggest; cas = lnd_take_casualty(combat_mode, llp, to_take); - return (CASUALTY_LUMP - (to_take - cas)); + return CASUALTY_LUMP - (to_take - cas); } /* Send reacting defense units back to where they came from (at no mob cost) */ @@ -2594,16 +2594,14 @@ take_move_in_mob(int combat_mode, struct llist *llp, struct combat *off, if (off->shp_mcp->m_flags & M_LAND) { if (llp->lcp->l_flags & L_MARINE) llp->land.lnd_mobil -= - ((float)etu_per_update * land_mob_scale * 0.5); + (float)etu_per_update * land_mob_scale * 0.5; else - llp->land.lnd_mobil -= ((float)etu_per_update - * land_mob_scale); + llp->land.lnd_mobil -= (float)etu_per_update * land_mob_scale; } else { if (llp->lcp->l_flags & L_MARINE) llp->land.lnd_mobil = 0; else - llp->land.lnd_mobil = (((float)etu_per_update - * land_mob_scale) * (-1)); + llp->land.lnd_mobil = -(float)etu_per_update * land_mob_scale; } break; case A_BOARD: diff --git a/src/lib/subs/fortdef.c b/src/lib/subs/fortdef.c index 562a3544..c8c74901 100644 --- a/src/lib/subs/fortdef.c +++ b/src/lib/subs/fortdef.c @@ -141,7 +141,7 @@ sd(natid att, natid own, coord x, coord y, int noisy, int defending, } } } - return (int)100 - (eff * 100); + return (int)100 - eff * 100; } int diff --git a/src/lib/subs/landgun.c b/src/lib/subs/landgun.c index 9ada9e5d..750184fc 100644 --- a/src/lib/subs/landgun.c +++ b/src/lib/subs/landgun.c @@ -79,7 +79,7 @@ roundrange(double r) f = r - ((int)r); if (chance(f)) - return (((int)r) + 1); + return ((int)r) + 1; else - return ((int)r); + return (int)r; } diff --git a/src/lib/subs/lndsub.c b/src/lib/subs/lndsub.c index 8ce218cf..19aa0167 100644 --- a/src/lib/subs/lndsub.c +++ b/src/lib/subs/lndsub.c @@ -130,7 +130,7 @@ defense_val(struct lndstr *lp) if (value < 1.0 && men > 0 && !(lcp->l_flags & L_SPY)) return 1; - return (int)(value); + return (int)value; } int @@ -188,8 +188,6 @@ lnd_take_casualty(int combat_mode, struct llist *llp, int cas) s_char orig; int mob; - - taken = lnd_getmil(&(llp->land)); /* Spies always die */ if (llp->lcp->l_flags & L_SPY) { @@ -274,7 +272,7 @@ lnd_take_casualty(int combat_mode, struct llist *llp, int cas) orig = llp->land.lnd_mobil; llp->land.lnd_mobil = (s_char)mob; if (llp->land.lnd_mobil > orig) - llp->land.lnd_mobil = (-127); + llp->land.lnd_mobil = -127; sprintf(buf, "retreats at %d%% efficiency to %s!", llp->land.lnd_effic, xyas(bx, by, llp->land.lnd_own)); @@ -346,9 +344,9 @@ int lnd_spyval(struct lndstr *lp) { if (lchr[(int)lp->lnd_type].l_flags & L_RECON) - return (lp->lnd_spy * (lp->lnd_effic / 100.0)) + 2; + return lp->lnd_spy * (lp->lnd_effic / 100.0) + 2; else - return (lp->lnd_spy * (lp->lnd_effic / 100.0)); + return lp->lnd_spy * (lp->lnd_effic / 100.0); } int diff --git a/src/lib/subs/mslsub.c b/src/lib/subs/mslsub.c index 9153f61d..da3387e5 100644 --- a/src/lib/subs/mslsub.c +++ b/src/lib/subs/mslsub.c @@ -306,7 +306,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget, if (icount == 0) { if (sect.sct_own != 0) mpr(sect.sct_own, "No %ss launched to intercept.\n", def_name); - return (destroyed); + return destroyed; } /* attempt to destroy incoming missile */ @@ -359,7 +359,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget, free(qp); } if (destroyed) - return (destroyed); + return destroyed; if (icount) { mpr(bombown, "%s made it through %s defenses!\n", att_name, def_name); @@ -367,7 +367,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget, mpr(sect.sct_own, "%s made it through %s defenses!\n", att_name, def_name); } - return (destroyed); + return destroyed; } /* Keep launching missiles on list until mindam damage has been done */ diff --git a/src/lib/subs/retreat.c b/src/lib/subs/retreat.c index 141860f7..f8f3f6bb 100644 --- a/src/lib/subs/retreat.c +++ b/src/lib/subs/retreat.c @@ -347,11 +347,11 @@ findcondition(s_char code) x = 0; while (conditions[x].code) { if (conditions[x].code == code) - return (x); + return x; x++; } - return (x); + return x; } int diff --git a/src/lib/update/mobility.c b/src/lib/update/mobility.c index 4f7e5709..05d5300e 100644 --- a/src/lib/update/mobility.c +++ b/src/lib/update/mobility.c @@ -91,7 +91,7 @@ increase_mob(time_t *counter, float mult) *counter = *counter - left; if (updating_mob) - return (newetus); + return newetus; return 0; } diff --git a/src/lib/update/nat.c b/src/lib/update/nat.c index 35726bed..d213e5e0 100644 --- a/src/lib/update/nat.c +++ b/src/lib/update/nat.c @@ -115,7 +115,7 @@ limit_level(double level, int type, int flag) above = logx(above_easy + 1.0, logbase); if (above > 250) above = 250; - return ((above) < 0) ? easy : (easy + above); + return above < 0 ? easy : easy + above; } else return level; } diff --git a/src/lib/update/nxtsctp.c b/src/lib/update/nxtsctp.c index 40a7829b..c05501a6 100644 --- a/src/lib/update/nxtsctp.c +++ b/src/lib/update/nxtsctp.c @@ -69,7 +69,7 @@ nxtsctp(struct nstr_sect *np) if (np->curdist > np->dist) continue; } - return (getsectp(np->x, np->y)); + return getsectp(np->x, np->y); } /*NOTREACHED*/ } diff --git a/src/lib/update/prepare.c b/src/lib/update/prepare.c index da8b193a..d4785491 100644 --- a/src/lib/update/prepare.c +++ b/src/lib/update/prepare.c @@ -157,7 +157,7 @@ upd_slmilcosts(natid n, int etu) totalmil += mil; } mil_pay = totalmil * etu * money_mil; - return (mil_pay); + return mil_pay; } int diff --git a/src/lib/update/sail.c b/src/lib/update/sail.c index a16931ae..6045e5d8 100644 --- a/src/lib/update/sail.c +++ b/src/lib/update/sail.c @@ -99,7 +99,7 @@ sail_find_fleet(struct fltheadstr **head, struct shpstr *sp) s_char *cp; if (sp->shp_own == 0) - return (0); + return 0; @@ -111,7 +111,7 @@ sail_find_fleet(struct fltheadstr **head, struct shpstr *sp) wu(0, sp->shp_own, "Ship #%d, following #%d, which you don't own.\n", sp->shp_uid, ap->shp_uid); - return (0); + return 0; } /* Not a follower. */ if (ap->shp_path[0] != 'f') @@ -124,7 +124,7 @@ sail_find_fleet(struct fltheadstr **head, struct shpstr *sp) wu(0, sp->shp_own, "Ship #%d, following #%d, which you don't own.\n", sp->shp_uid, follow); - return (0); + return 0; } /* This should prevent infinite loops. */ @@ -132,7 +132,7 @@ sail_find_fleet(struct fltheadstr **head, struct shpstr *sp) wu(0, sp->shp_own, "Ship #%d, too many follows (circular follow?).\n", sp->shp_uid); - return (0); + return 0; } for (stop = 0, cp = ap->shp_path; (!stop) && (*cp); cp++) { @@ -160,7 +160,7 @@ sail_find_fleet(struct fltheadstr **head, struct shpstr *sp) /* if this ship is not sailing anywhere then ignore it. */ if (!*ap->shp_path) - return (0); + return 0; /* Find the fleet structure we belong to. */ for (fltp = (*head); (fltp && fltp->leader != follow); @@ -189,7 +189,7 @@ sail_find_fleet(struct fltheadstr **head, struct shpstr *sp) "Ship %d not in same sector as its sailing fleet\n", sp->shp_uid); fltp->real_q = LEADER_WRONGSECT; - return (0); + return 0; } this = malloc(sizeof(*this)); @@ -245,7 +245,7 @@ sail_nav_fleet(struct fltheadstr *fltp) default: wu(0, fltp->own, "Your fleet lead by %d is trapped by land.\n", fltp->leader); - return (0); + return 0; } for (fe = fltp->head; fe; fe = fe->next) { sp = getshipp(fe->num); @@ -257,7 +257,7 @@ sail_nav_fleet(struct fltheadstr *fltp) } } if (error) - return (0); + return 0; sp = getshipp(fltp->leader); own = sp->shp_own; fltp_to_list(fltp, &ship_list); /* hack -KHS 1995 */ diff --git a/src/util/fairland.c b/src/util/fairland.c index b6f0d7a1..c22228fe 100644 --- a/src/util/fairland.c +++ b/src/util/fairland.c @@ -154,7 +154,7 @@ FILE *sect_fptr; /* the file we write everything to */ struct sctstr **sects; struct sctstr *sectsbuf; int fl_status; /* is anything wrong? */ -#define STATUS_NO_ROOM (1) /* there was no room to grow */ +#define STATUS_NO_ROOM 1 /* there was no room to grow */ #define NUMTRIES 10 /* keep trying to grow this many times */ const char *numletter =