Remove some redundant parenthesis; no functional change.
This commit is contained in:
parent
4861f837fb
commit
380b063f9c
41 changed files with 134 additions and 134 deletions
|
@ -209,10 +209,10 @@ struct mlist {
|
||||||
#define SHP_BLD_WORK(lcm, hcm) (20 + (lcm) + 2 * (hcm))
|
#define SHP_BLD_WORK(lcm, hcm) (20 + (lcm) + 2 * (hcm))
|
||||||
|
|
||||||
/* return codes from shp_check_nav */
|
/* return codes from shp_check_nav */
|
||||||
#define CN_NAVIGABLE (0)
|
#define CN_NAVIGABLE 0
|
||||||
#define CN_LANDLOCKED (1)
|
#define CN_LANDLOCKED 1
|
||||||
#define CN_CONSTRUCTION (2)
|
#define CN_CONSTRUCTION 2
|
||||||
#define CN_ERROR (-1)
|
#define CN_ERROR -1
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
SHP_AIROPS_EFF = 50, /* min. efficiency for air ops */
|
SHP_AIROPS_EFF = 50, /* min. efficiency for air ops */
|
||||||
|
|
|
@ -176,20 +176,20 @@ as_find_cachepath(coord fx, coord fy, coord tx, coord ty)
|
||||||
|
|
||||||
/* Is the cache on? if not, return NULL */
|
/* Is the cache on? if not, return NULL */
|
||||||
if (as_cachepath_on == 0)
|
if (as_cachepath_on == 0)
|
||||||
return (NULL);
|
return NULL;
|
||||||
|
|
||||||
/* Do we have any cached? */
|
/* Do we have any cached? */
|
||||||
if (fromhead == (struct as_frompath **)0)
|
if (fromhead == (struct as_frompath **)0)
|
||||||
return (NULL);
|
return NULL;
|
||||||
|
|
||||||
/* Yes! */
|
/* Yes! */
|
||||||
for (from = fromhead[fy]; from; from = from->next) {
|
for (from = fromhead[fy]; from; from = from->next) {
|
||||||
if (from->x == fx) {
|
if (from->x == fx) {
|
||||||
for (to = from->tolist[ty]; to; to = to->next) {
|
for (to = from->tolist[ty]; to; to = to->next) {
|
||||||
if (to->x == tx)
|
if (to->x == tx)
|
||||||
return (to->path);
|
return to->path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,15 +33,15 @@ as_costcomp(const void *p1, const void *p2)
|
||||||
|
|
||||||
diff = (*n1)->lbcost - (*n2)->lbcost;
|
diff = (*n1)->lbcost - (*n2)->lbcost;
|
||||||
if (diff < -0.0001)
|
if (diff < -0.0001)
|
||||||
return (-1);
|
return -1;
|
||||||
if (diff > 0.0001)
|
if (diff > 0.0001)
|
||||||
return (1);
|
return 1;
|
||||||
|
|
||||||
/* equal, check secondary cost */
|
/* equal, check secondary cost */
|
||||||
diff = (*n1)->seccost - (*n2)->seccost;
|
diff = (*n1)->seccost - (*n2)->seccost;
|
||||||
if (diff < -0.0001)
|
if (diff < -0.0001)
|
||||||
return (-1);
|
return -1;
|
||||||
if (diff > 0.0001)
|
if (diff > 0.0001)
|
||||||
return (1);
|
return 1;
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,14 +40,14 @@ as_extend(struct as_data *adp)
|
||||||
i = (*adp->neighbor) (head->np->c, adp->neighbor_coords,
|
i = (*adp->neighbor) (head->np->c, adp->neighbor_coords,
|
||||||
adp->userdata);
|
adp->userdata);
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
return (NULL);
|
return NULL;
|
||||||
/*
|
/*
|
||||||
* Get rid of neighbors that are more costly than ones we already have,
|
* Get rid of neighbors that are more costly than ones we already have,
|
||||||
* and sort the rest into an array of as_nodes.
|
* and sort the rest into an array of as_nodes.
|
||||||
*/
|
*/
|
||||||
i = as_winnow(adp, adp->neighbor_coords, i);
|
i = as_winnow(adp, adp->neighbor_coords, i);
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
return (NULL);
|
return NULL;
|
||||||
if (i > 1)
|
if (i > 1)
|
||||||
qsort(adp->neighbor_nodes, i,
|
qsort(adp->neighbor_nodes, i,
|
||||||
sizeof(*adp->neighbor_nodes), as_costcomp);
|
sizeof(*adp->neighbor_nodes), as_costcomp);
|
||||||
|
@ -66,5 +66,5 @@ as_extend(struct as_data *adp)
|
||||||
adp->tried->np->flags |= AS_TRIED;
|
adp->tried->np->flags |= AS_TRIED;
|
||||||
|
|
||||||
head = as_merge(adp, head, adp->neighbor_nodes);
|
head = as_merge(adp, head, adp->neighbor_nodes);
|
||||||
return (head);
|
return head;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,9 @@ as_iscinq(struct as_data *adp, struct as_coord c)
|
||||||
|
|
||||||
for (hp = adp->hashtab[hashval]; hp; hp = hp->next)
|
for (hp = adp->hashtab[hashval]; hp; hp = hp->next)
|
||||||
if (hp->c.x == c.x && hp->c.y == c.y)
|
if (hp->c.x == c.x && hp->c.y == c.y)
|
||||||
return (hp->qp);
|
return hp->qp;
|
||||||
|
|
||||||
return (NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -54,5 +54,5 @@ as_init(int maxneighbors,
|
||||||
adp->seccost = seccostfunc;
|
adp->seccost = seccostfunc;
|
||||||
adp->userdata = userdata;
|
adp->userdata = userdata;
|
||||||
|
|
||||||
return (adp);
|
return adp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,5 +77,5 @@ as_merge(struct as_data *adp, struct as_queue *head,
|
||||||
np->step++;
|
np->step++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (head);
|
return head;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ as_search(struct as_data *adp)
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "Failed\n");
|
fprintf(stderr, "Failed\n");
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
return (-1);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
as_makepath(adp);
|
as_makepath(adp);
|
||||||
|
@ -121,7 +121,7 @@ as_search(struct as_data *adp)
|
||||||
}
|
}
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -91,7 +91,7 @@ as_winnow(struct as_data *adp, struct as_coord *coords, int ncoords)
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
if (qp->np->flags & AS_TRIED) {
|
if (qp->np->flags & AS_TRIED) {
|
||||||
/* should "never happen" */
|
/* should "never happen" */
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* The neighbor is better than a previously visited coordinate;
|
* 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,
|
np = as_newnode(adp->head->np, *cp, inclbcost, lbcost,
|
||||||
knowncost, seccost);
|
knowncost, seccost);
|
||||||
if (np == NULL)
|
if (np == NULL)
|
||||||
return (0);
|
return 0;
|
||||||
if (fix_pointer) {
|
if (fix_pointer) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "Fixing pointer for %d, %d\n",
|
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;
|
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->step = backp->step;
|
||||||
np->back = backp;
|
np->back = backp;
|
||||||
|
|
||||||
return (np);
|
return np;
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,5 +174,5 @@ showship(struct coast **cpp, int x, int y)
|
||||||
/* check that last one! */
|
/* check that last one! */
|
||||||
if (todelete)
|
if (todelete)
|
||||||
free(todelete);
|
free(todelete);
|
||||||
return (nship);
|
return nship;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ desi(void)
|
||||||
if (player->argp[2]) {
|
if (player->argp[2]) {
|
||||||
cost = do_desi(natp, player->argp[1], player->argp[2], cash, 0);
|
cost = do_desi(natp, player->argp[1], player->argp[2], cash, 0);
|
||||||
if (cost < 0)
|
if (cost < 0)
|
||||||
return (int)(-cost);
|
return (int)-cost;
|
||||||
if (chkmoney(cost, cash, player->argp[3]))
|
if (chkmoney(cost, cash, player->argp[3]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
}
|
}
|
||||||
|
|
|
@ -450,10 +450,10 @@ static int
|
||||||
errcheck(int num, int min, int max)
|
errcheck(int num, int min, int max)
|
||||||
{
|
{
|
||||||
if (num < min)
|
if (num < min)
|
||||||
return (min);
|
return min;
|
||||||
else if (num > max)
|
else if (num > max)
|
||||||
return (max);
|
return max;
|
||||||
return (num);
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -618,7 +618,7 @@ load_land_ship(struct sctstr *sectp, struct shpstr *sp, int noisy,
|
||||||
load_spy = 1;
|
load_spy = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((!load_spy) &&
|
if (!load_spy &&
|
||||||
(sp->shp_nland >= mchr[(int)sp->shp_type].m_nland)) {
|
(sp->shp_nland >= mchr[(int)sp->shp_type].m_nland)) {
|
||||||
if (noisy) {
|
if (noisy) {
|
||||||
if (mchr[(int)sp->shp_type].m_nland)
|
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_x, land.lnd_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
land.lnd_ship = (-1);
|
land.lnd_ship = -1;
|
||||||
sp->shp_nland--;
|
sp->shp_nland--;
|
||||||
putland(land.lnd_uid, &land);
|
putland(land.lnd_uid, &land);
|
||||||
putship(sp->shp_uid, sp);
|
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;
|
land.lnd_own = sectp->sct_own;
|
||||||
makenotlost(EF_LAND, land.lnd_own, land.lnd_uid, land.lnd_x,
|
makenotlost(EF_LAND, land.lnd_own, land.lnd_uid, land.lnd_x,
|
||||||
land.lnd_y);
|
land.lnd_y);
|
||||||
land.lnd_land = (-1);
|
land.lnd_land = -1;
|
||||||
lp->lnd_nland--;
|
lp->lnd_nland--;
|
||||||
putland(land.lnd_uid, &land);
|
putland(land.lnd_uid, &land);
|
||||||
putland(lp->lnd_uid, lp);
|
putland(lp->lnd_uid, lp);
|
||||||
|
|
|
@ -125,7 +125,7 @@ multifire(void)
|
||||||
|
|
||||||
emp_initque(&fired);
|
emp_initque(&fired);
|
||||||
emp_initque(&defended);
|
emp_initque(&defended);
|
||||||
type = (-1);
|
type = -1;
|
||||||
while ((type != EF_SECTOR) && (type != EF_SHIP) && (type != EF_LAND)) {
|
while ((type != EF_SECTOR) && (type != EF_SHIP) && (type != EF_LAND)) {
|
||||||
if (!(p = getstarg(player->argp[1],
|
if (!(p = getstarg(player->argp[1],
|
||||||
"Firing from ship(s), sect(s), or land unit(s)? ",
|
"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);
|
emp_insque(&fp->queue, al);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (dam);
|
return dam;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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
|
static void
|
||||||
|
|
|
@ -50,7 +50,9 @@ retr(void)
|
||||||
int nships;
|
int nships;
|
||||||
struct nstr_item ni;
|
struct nstr_item ni;
|
||||||
struct shpstr ship;
|
struct shpstr ship;
|
||||||
int isfleet = 0, rflags = (-2), zero;
|
int isfleet = 0;
|
||||||
|
int rflags = -2;
|
||||||
|
int zero;
|
||||||
unsigned int x;
|
unsigned int x;
|
||||||
s_char buf1[1024];
|
s_char buf1[1024];
|
||||||
s_char buf2[1024];
|
s_char buf2[1024];
|
||||||
|
@ -200,7 +202,9 @@ lretr(void)
|
||||||
int nunits;
|
int nunits;
|
||||||
struct nstr_item ni;
|
struct nstr_item ni;
|
||||||
struct lndstr land;
|
struct lndstr land;
|
||||||
int isarmy = 0, rflags = (-2), zero;
|
int isarmy = 0;
|
||||||
|
int rflags = -2;
|
||||||
|
int zero;
|
||||||
s_char buf1[1024];
|
s_char buf1[1024];
|
||||||
s_char buf2[1024];
|
s_char buf2[1024];
|
||||||
unsigned int x;
|
unsigned int x;
|
||||||
|
|
|
@ -166,10 +166,10 @@ sail(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
cp = player->argp[2];
|
cp = player->argp[2];
|
||||||
if ((*player->argp[0] == 'q') /*qsail command */ ||(cp && *cp == 'q')) {
|
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 */
|
} else if (*player->argp[0] == 'u' /*unsail command */
|
||||||
|| (cp && *cp == '-')) {
|
|| (cp && *cp == '-')) {
|
||||||
return (cmd_unsail_ship(&nstr));
|
return cmd_unsail_ship(&nstr);
|
||||||
} else
|
} else
|
||||||
return (cmd_sail_ship(&nstr));
|
return cmd_sail_ship(&nstr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,5 +171,5 @@ showsat(struct sky **skypp, int x, int y)
|
||||||
/* check that last one! */
|
/* check that last one! */
|
||||||
if (todelete)
|
if (todelete)
|
||||||
free(todelete);
|
free(todelete);
|
||||||
return (nsat);
|
return nsat;
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,7 @@ upda(void)
|
||||||
if (*game_hours != 0)
|
if (*game_hours != 0)
|
||||||
pr("Game hours are: %s\n", game_hours);
|
pr("Game hours are: %s\n", game_hours);
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
time_t now;
|
time_t now;
|
||||||
time_t upd_time;
|
time_t upd_time;
|
||||||
|
|
|
@ -135,7 +135,7 @@ bestownedpath(s_char *bpath,
|
||||||
mapbuf = malloc((WORLD_X * WORLD_Y) *
|
mapbuf = malloc((WORLD_X * WORLD_Y) *
|
||||||
sizeof(unsigned int));
|
sizeof(unsigned int));
|
||||||
if (!mapbuf)
|
if (!mapbuf)
|
||||||
return ((s_char *)0);
|
return NULL;
|
||||||
if (!mapindex) {
|
if (!mapindex) {
|
||||||
mapindex = malloc(WORLD_X * sizeof(unsigned int *));
|
mapindex = malloc(WORLD_X * sizeof(unsigned int *));
|
||||||
if (mapindex) {
|
if (mapindex) {
|
||||||
|
@ -145,7 +145,7 @@ bestownedpath(s_char *bpath,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!mapindex)
|
if (!mapindex)
|
||||||
return ((s_char *)0);
|
return NULL;
|
||||||
|
|
||||||
bpath[0] = 0;
|
bpath[0] = 0;
|
||||||
if (0 != (restr2 = (*terrain == 'R')))
|
if (0 != (restr2 = (*terrain == 'R')))
|
||||||
|
@ -163,11 +163,11 @@ bestownedpath(s_char *bpath,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!valid(x, y) || !valid(ex, ey))
|
if (!valid(x, y) || !valid(ex, ey))
|
||||||
return ((s_char *)0);
|
return NULL;
|
||||||
|
|
||||||
if (restr2 && (!owned_and_navigable(bigmap, x, y, terrain, own) ||
|
if (restr2 && (!owned_and_navigable(bigmap, x, y, terrain, own) ||
|
||||||
!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 (i = 0; i < WORLD_X; i++)
|
||||||
for (j = 0; j < WORLD_Y; j++)
|
for (j = 0; j < WORLD_Y; j++)
|
||||||
|
@ -232,7 +232,7 @@ bestownedpath(s_char *bpath,
|
||||||
} while (markedsectors);
|
} while (markedsectors);
|
||||||
|
|
||||||
bpath[0] = 0;
|
bpath[0] = 0;
|
||||||
return ((s_char *)0); /* no route possible */
|
return NULL; /* no route possible */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return TRUE if sector is passable */
|
/* 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
|
/* No terrain to check? Everything is navigable! (this
|
||||||
probably means we are flying) */
|
probably means we are flying) */
|
||||||
if (!(*terrain))
|
if (!(*terrain))
|
||||||
return (1);
|
return 1;
|
||||||
|
|
||||||
/* Are we checking this map? */
|
/* Are we checking this map? */
|
||||||
if (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 */
|
since otherwise we'll never venture anywhere */
|
||||||
mapspot = map[sctoff(x, y)];
|
mapspot = map[sctoff(x, y)];
|
||||||
if (mapspot == ' ' || mapspot == 0)
|
if (mapspot == ' ' || mapspot == 0)
|
||||||
return (1);
|
return 1;
|
||||||
|
|
||||||
/* Now, is it marked with a 'x' or 'X'? If so, avoid it! */
|
/* Now, is it marked with a 'x' or 'X'? If so, avoid it! */
|
||||||
if (mapspot == 'x' || mapspot == 'X')
|
if (mapspot == 'x' || mapspot == 'X')
|
||||||
return (0);
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
/* We don't know what it is since we have no map, so return ok! */
|
/* 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
|
/* 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) {
|
if (negate && *t) {
|
||||||
/* We found it, so we say it's bad since we are negating */
|
/* We found it, so we say it's bad since we are negating */
|
||||||
return (0);
|
return 0;
|
||||||
} else if (!negate && !*t) {
|
} else if (!negate && !*t) {
|
||||||
/* We didn't find it, so we say it's bad since we aren't negating */
|
/* 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. */
|
/* 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
|
/* We can't sail through deity sectors, but we can sail
|
||||||
through any ocean */
|
through any ocean */
|
||||||
if (rel < FRIENDLY && sect->sct_type != SCT_WATER)
|
if (rel < FRIENDLY && sect->sct_type != SCT_WATER)
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Ok, now, check these two sector types */
|
/* Ok, now, check these two sector types */
|
||||||
/* check for bad harbors. */
|
/* check for bad harbors. */
|
||||||
if (c == 'h' && sect->sct_effic < 2)
|
if (c == 'h' && sect->sct_effic < 2)
|
||||||
return (0);
|
return 0;
|
||||||
/* check for bad bridges */
|
/* check for bad bridges */
|
||||||
if (c == '=' && sect->sct_effic < 60)
|
if (c == '=' && sect->sct_effic < 60)
|
||||||
return (0);
|
return 0;
|
||||||
/* Woo-hoo, it's ok! */
|
/* Woo-hoo, it's ok! */
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ ef_ptr(int type, int id)
|
||||||
logerror("ef_ptr: (%s) only valid for EFF_MEM entries", ep->file);
|
logerror("ef_ptr: (%s) only valid for EFF_MEM entries", ep->file);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return (ep->cache + ep->size * id);
|
return ep->cache + ep->size * id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -231,7 +231,7 @@ bp_neighbors(struct as_coord c, struct as_coord *cp, s_char *pp)
|
||||||
cp[n].y = sy;
|
cp[n].y = sy;
|
||||||
n++;
|
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;
|
offset = (sy * WORLD_X + sx) / 2;
|
||||||
ts = (struct sctstr *)(ep->cache + ep->size * offset);
|
ts = (struct sctstr *)(ep->cache + ep->size * offset);
|
||||||
cost = sector_mcost(ts, bp->bp_mobtype);
|
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
|
static double
|
||||||
bp_realcost(struct as_coord from, struct as_coord to, s_char *pp)
|
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 */
|
/* need to make sector database available to bestpath */
|
||||||
map = ef_ptr(EF_BMAP, owner);
|
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 *
|
s_char *
|
||||||
BestAirPath(s_char *path, int fx, int fy, int tx, int ty)
|
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, "")); */
|
/* return (bestpath(path, fx, fy, tx, ty, "")); */
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ demand_update_want(int *want, int *pop, int which)
|
||||||
}
|
}
|
||||||
*want = totwant;
|
*want = totwant;
|
||||||
*pop = totpop;
|
*pop = totpop;
|
||||||
return (whichwants);
|
return whichwants;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -154,20 +154,20 @@ demand_check(void)
|
||||||
|
|
||||||
if (0 == update_wantmin) {
|
if (0 == update_wantmin) {
|
||||||
logerror("no demand update allowed, wantmin = 0");
|
logerror("no demand update allowed, wantmin = 0");
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
demand_update_want(&want, &pop, 0);
|
demand_update_want(&want, &pop, 0);
|
||||||
if (want < update_wantmin) {
|
if (want < update_wantmin) {
|
||||||
logerror("no demand update, want = %d, min = %d",
|
logerror("no demand update, want = %d, min = %d",
|
||||||
want, update_wantmin);
|
want, update_wantmin);
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
time(&now);
|
time(&now);
|
||||||
if (!demand_update_time(&now)) {
|
if (!demand_update_time(&now)) {
|
||||||
logerror("no demand update, not within hours allowed.");
|
logerror("no demand update, not within hours allowed.");
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -183,10 +183,10 @@ demand_check(void)
|
||||||
if (veto) {
|
if (veto) {
|
||||||
logerror("no demand update, %d has missed more than %d updates",
|
logerror("no demand update, %d has missed more than %d updates",
|
||||||
veto - 1, update_missed);
|
veto - 1, update_missed);
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if enough countries want an update,
|
/* Check if enough countries want an update,
|
||||||
|
@ -197,10 +197,10 @@ demandupdatecheck(void)
|
||||||
{
|
{
|
||||||
if (UDDEM_COMSET != update_demandpolicy) {
|
if (UDDEM_COMSET != update_demandpolicy) {
|
||||||
logerror("no demand update, not policy.");
|
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?
|
/* Is it time for a regular or scheduled update?
|
||||||
|
@ -212,27 +212,27 @@ updatetime(time_t *now)
|
||||||
{
|
{
|
||||||
if (opt_BLITZ && update_policy == UDP_BLITZ) {
|
if (opt_BLITZ && update_policy == UDP_BLITZ) {
|
||||||
logerror("BLITZ Update.");
|
logerror("BLITZ Update.");
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UDP_NORMAL == update_policy) {
|
if (UDP_NORMAL == update_policy) {
|
||||||
logerror("Regular update, etu type.");
|
logerror("Regular update, etu type.");
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UDP_TIMES == update_policy) {
|
if (UDP_TIMES == update_policy) {
|
||||||
if (scheduled_update_time(now)) {
|
if (scheduled_update_time(now)) {
|
||||||
logerror("Scheduled update.");
|
logerror("Scheduled update.");
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (opt_DEMANDUPDATE) {
|
if (opt_DEMANDUPDATE) {
|
||||||
if (demand_check()) {
|
if (demand_check()) {
|
||||||
logerror("Demand update, at check time.");
|
logerror("Demand update, at check time.");
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the time, and delta seconds, of the next update.
|
/* Return the time, and delta seconds, of the next update.
|
||||||
|
|
|
@ -405,19 +405,19 @@ io_noblocking(struct iop *iop, int value)
|
||||||
int
|
int
|
||||||
io_conn(struct iop *iop)
|
io_conn(struct iop *iop)
|
||||||
{
|
{
|
||||||
return (iop->flags & IO_CONN);
|
return iop->flags & IO_CONN;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
io_error(struct iop *iop)
|
io_error(struct iop *iop)
|
||||||
{
|
{
|
||||||
return (iop->flags & IO_ERROR);
|
return iop->flags & IO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
io_eof(struct iop *iop)
|
io_eof(struct iop *iop)
|
||||||
{
|
{
|
||||||
return (iop->flags & IO_EOF);
|
return iop->flags & IO_EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -37,23 +37,23 @@
|
||||||
s_char *
|
s_char *
|
||||||
plur(int n, s_char *no, s_char *yes)
|
plur(int n, s_char *no, s_char *yes)
|
||||||
{
|
{
|
||||||
return (n == 1 ? no : yes);
|
return n == 1 ? no : yes;
|
||||||
}
|
}
|
||||||
|
|
||||||
s_char *
|
s_char *
|
||||||
splur(int n)
|
splur(int n)
|
||||||
{
|
{
|
||||||
return (n == 1 ? "" : "s");
|
return n == 1 ? "" : "s";
|
||||||
}
|
}
|
||||||
|
|
||||||
s_char *
|
s_char *
|
||||||
esplur(int n)
|
esplur(int n)
|
||||||
{
|
{
|
||||||
return (n == 1 ? "" : "es");
|
return n == 1 ? "" : "es";
|
||||||
}
|
}
|
||||||
|
|
||||||
s_char *
|
s_char *
|
||||||
iesplur(int n)
|
iesplur(int n)
|
||||||
{
|
{
|
||||||
return (n == 1 ? "y" : "ies");
|
return n == 1 ? "y" : "ies";
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ roundintby(int n, int m)
|
||||||
register int r11;
|
register int r11;
|
||||||
|
|
||||||
r11 = (m >> 1) + n;
|
r11 = (m >> 1) + n;
|
||||||
return (r11 / m * m);
|
return r11 / m * m;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -48,5 +48,5 @@ ldround(double a4, int ac)
|
||||||
int f4;
|
int f4;
|
||||||
|
|
||||||
f4 = ac / 2.0 + a4;
|
f4 = ac / 2.0 + a4;
|
||||||
return (f4 / ac * ac);
|
return f4 / ac * ac;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,5 +40,5 @@ scthash(int x, int y, int tsize)
|
||||||
x = -x;
|
x = -x;
|
||||||
if (y < 0)
|
if (y < 0)
|
||||||
y = -y;
|
y = -y;
|
||||||
return ((x * 10 + y) % tsize);
|
return (x * 10 + y) % tsize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,7 +216,7 @@ lwpCreate(int priority, void (*entry)(void *), int size, int flags, char *name,
|
||||||
unsigned long stackp;
|
unsigned long stackp;
|
||||||
|
|
||||||
if (!(newp = malloc(sizeof(struct lwpProc))))
|
if (!(newp = malloc(sizeof(struct lwpProc))))
|
||||||
return (0);
|
return 0;
|
||||||
if (flags & LWP_STACKCHECK) {
|
if (flags & LWP_STACKCHECK) {
|
||||||
/* Add a 1K buffer on each side of the stack */
|
/* Add a 1K buffer on each side of the stack */
|
||||||
size += 2 * LWP_REDZONE;
|
size += 2 * LWP_REDZONE;
|
||||||
|
@ -224,7 +224,7 @@ lwpCreate(int priority, void (*entry)(void *), int size, int flags, char *name,
|
||||||
size += LWP_EXTRASTACK;
|
size += LWP_EXTRASTACK;
|
||||||
size += sizeof(stkalign_t);
|
size += sizeof(stkalign_t);
|
||||||
if (!(s = malloc(size)))
|
if (!(s = malloc(size)))
|
||||||
return (0);
|
return 0;
|
||||||
newp->flags = flags;
|
newp->flags = flags;
|
||||||
newp->name = strdup(name);
|
newp->name = strdup(name);
|
||||||
newp->desc = strdup(desc);
|
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 */
|
lwpInitContext(newp, sp); /* architecture-dependent: from arch.c */
|
||||||
#endif /* UCONTEXT */
|
#endif /* UCONTEXT */
|
||||||
lwpReschedule();
|
lwpReschedule();
|
||||||
return (newp);
|
return newp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -335,7 +335,7 @@ lwpGetUD(struct lwpProc *p)
|
||||||
{
|
{
|
||||||
if (!p)
|
if (!p)
|
||||||
p = LwpCurrent;
|
p = LwpCurrent;
|
||||||
return (p->ud);
|
return p->ud;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -415,7 +415,7 @@ lwpSetPriority(int new)
|
||||||
lwpStatus(LwpCurrent, "resetting priority (%d -> %d)", old, new);
|
lwpStatus(LwpCurrent, "resetting priority (%d -> %d)", old, new);
|
||||||
if (new < old)
|
if (new < old)
|
||||||
lwpYield();
|
lwpYield();
|
||||||
return (old);
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -433,9 +433,9 @@ lwpInitSystem(int pri, char **ctxptr, int flags)
|
||||||
pri = 1;
|
pri = 1;
|
||||||
/* *LwpContextPtr = 0; */
|
/* *LwpContextPtr = 0; */
|
||||||
if (!(LwpCurrent = calloc(1, sizeof(struct lwpProc))))
|
if (!(LwpCurrent = calloc(1, sizeof(struct lwpProc))))
|
||||||
return (0);
|
return 0;
|
||||||
if (!(stack = malloc(64)))
|
if (!(stack = malloc(64)))
|
||||||
return (0);
|
return 0;
|
||||||
if (LWP_MAX_PRIO <= pri)
|
if (LWP_MAX_PRIO <= pri)
|
||||||
pri = LWP_MAX_PRIO - 1;
|
pri = LWP_MAX_PRIO - 1;
|
||||||
if (LwpMaxpri < pri)
|
if (LwpMaxpri < pri)
|
||||||
|
@ -453,7 +453,7 @@ lwpInitSystem(int pri, char **ctxptr, int flags)
|
||||||
sel = lwpCreate(0, lwpSelect, 16384, flags, "EventHandler",
|
sel = lwpCreate(0, lwpSelect, 16384, flags, "EventHandler",
|
||||||
"Select (main loop) Event Handler", 0, 0, 0);
|
"Select (main loop) Event Handler", 0, 0, 0);
|
||||||
lwpInitSelect(sel);
|
lwpInitSelect(sel);
|
||||||
return (LwpCurrent);
|
return LwpCurrent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* lwpStackCheckInit
|
/* lwpStackCheckInit
|
||||||
|
|
|
@ -33,7 +33,7 @@ lwpGetFirst(struct lwpQueue *q)
|
||||||
|
|
||||||
if ((head = q->head) && !(q->head = head->next))
|
if ((head = q->head) && !(q->head = head->next))
|
||||||
q->tail = 0;
|
q->tail = 0;
|
||||||
return (head);
|
return head;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -43,11 +43,11 @@ lwpCreateSem(char *name, int count)
|
||||||
struct lwpSem *new;
|
struct lwpSem *new;
|
||||||
|
|
||||||
if (!(new = malloc(sizeof(struct lwpSem))))
|
if (!(new = malloc(sizeof(struct lwpSem))))
|
||||||
return (0);
|
return 0;
|
||||||
new->name = strdup(name);
|
new->name = strdup(name);
|
||||||
new->count = count;
|
new->count = count;
|
||||||
new->q.head = new->q.tail = 0;
|
new->q.head = new->q.tail = 0;
|
||||||
return (new);
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -2181,7 +2181,7 @@ take_casualty(int combat_mode, struct combat *off, struct emp_qelem *olist)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QEMPTY(olist))
|
if (QEMPTY(olist))
|
||||||
return (CASUALTY_LUMP - to_take);
|
return CASUALTY_LUMP - to_take;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Need to take some casualties from attacking units
|
* 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)
|
if (biggest == (struct emp_qelem *)0)
|
||||||
return (CASUALTY_LUMP - to_take);
|
return CASUALTY_LUMP - to_take;
|
||||||
|
|
||||||
llp = (struct llist *)biggest;
|
llp = (struct llist *)biggest;
|
||||||
cas = lnd_take_casualty(combat_mode, llp, to_take);
|
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) */
|
/* 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 (off->shp_mcp->m_flags & M_LAND) {
|
||||||
if (llp->lcp->l_flags & L_MARINE)
|
if (llp->lcp->l_flags & L_MARINE)
|
||||||
llp->land.lnd_mobil -=
|
llp->land.lnd_mobil -=
|
||||||
((float)etu_per_update * land_mob_scale * 0.5);
|
(float)etu_per_update * land_mob_scale * 0.5;
|
||||||
else
|
else
|
||||||
llp->land.lnd_mobil -= ((float)etu_per_update
|
llp->land.lnd_mobil -= (float)etu_per_update * land_mob_scale;
|
||||||
* land_mob_scale);
|
|
||||||
} else {
|
} else {
|
||||||
if (llp->lcp->l_flags & L_MARINE)
|
if (llp->lcp->l_flags & L_MARINE)
|
||||||
llp->land.lnd_mobil = 0;
|
llp->land.lnd_mobil = 0;
|
||||||
else
|
else
|
||||||
llp->land.lnd_mobil = (((float)etu_per_update
|
llp->land.lnd_mobil = -(float)etu_per_update * land_mob_scale;
|
||||||
* land_mob_scale) * (-1));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case A_BOARD:
|
case A_BOARD:
|
||||||
|
|
|
@ -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
|
int
|
||||||
|
|
|
@ -79,7 +79,7 @@ roundrange(double r)
|
||||||
|
|
||||||
f = r - ((int)r);
|
f = r - ((int)r);
|
||||||
if (chance(f))
|
if (chance(f))
|
||||||
return (((int)r) + 1);
|
return ((int)r) + 1;
|
||||||
else
|
else
|
||||||
return ((int)r);
|
return (int)r;
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ defense_val(struct lndstr *lp)
|
||||||
if (value < 1.0 && men > 0 && !(lcp->l_flags & L_SPY))
|
if (value < 1.0 && men > 0 && !(lcp->l_flags & L_SPY))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return (int)(value);
|
return (int)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -188,8 +188,6 @@ lnd_take_casualty(int combat_mode, struct llist *llp, int cas)
|
||||||
s_char orig;
|
s_char orig;
|
||||||
int mob;
|
int mob;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
taken = lnd_getmil(&(llp->land));
|
taken = lnd_getmil(&(llp->land));
|
||||||
/* Spies always die */
|
/* Spies always die */
|
||||||
if (llp->lcp->l_flags & L_SPY) {
|
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;
|
orig = llp->land.lnd_mobil;
|
||||||
llp->land.lnd_mobil = (s_char)mob;
|
llp->land.lnd_mobil = (s_char)mob;
|
||||||
if (llp->land.lnd_mobil > orig)
|
if (llp->land.lnd_mobil > orig)
|
||||||
llp->land.lnd_mobil = (-127);
|
llp->land.lnd_mobil = -127;
|
||||||
sprintf(buf, "retreats at %d%% efficiency to %s!",
|
sprintf(buf, "retreats at %d%% efficiency to %s!",
|
||||||
llp->land.lnd_effic,
|
llp->land.lnd_effic,
|
||||||
xyas(bx, by, llp->land.lnd_own));
|
xyas(bx, by, llp->land.lnd_own));
|
||||||
|
@ -346,9 +344,9 @@ int
|
||||||
lnd_spyval(struct lndstr *lp)
|
lnd_spyval(struct lndstr *lp)
|
||||||
{
|
{
|
||||||
if (lchr[(int)lp->lnd_type].l_flags & L_RECON)
|
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
|
else
|
||||||
return (lp->lnd_spy * (lp->lnd_effic / 100.0));
|
return lp->lnd_spy * (lp->lnd_effic / 100.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -306,7 +306,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
|
||||||
if (icount == 0) {
|
if (icount == 0) {
|
||||||
if (sect.sct_own != 0)
|
if (sect.sct_own != 0)
|
||||||
mpr(sect.sct_own, "No %ss launched to intercept.\n", def_name);
|
mpr(sect.sct_own, "No %ss launched to intercept.\n", def_name);
|
||||||
return (destroyed);
|
return destroyed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attempt to destroy incoming missile */
|
/* attempt to destroy incoming missile */
|
||||||
|
@ -359,7 +359,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
|
||||||
free(qp);
|
free(qp);
|
||||||
}
|
}
|
||||||
if (destroyed)
|
if (destroyed)
|
||||||
return (destroyed);
|
return destroyed;
|
||||||
if (icount) {
|
if (icount) {
|
||||||
mpr(bombown, "%s made it through %s defenses!\n", att_name,
|
mpr(bombown, "%s made it through %s defenses!\n", att_name,
|
||||||
def_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",
|
mpr(sect.sct_own, "%s made it through %s defenses!\n",
|
||||||
att_name, def_name);
|
att_name, def_name);
|
||||||
}
|
}
|
||||||
return (destroyed);
|
return destroyed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keep launching missiles on list until mindam damage has been done */
|
/* Keep launching missiles on list until mindam damage has been done */
|
||||||
|
|
|
@ -347,11 +347,11 @@ findcondition(s_char code)
|
||||||
x = 0;
|
x = 0;
|
||||||
while (conditions[x].code) {
|
while (conditions[x].code) {
|
||||||
if (conditions[x].code == code)
|
if (conditions[x].code == code)
|
||||||
return (x);
|
return x;
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (x);
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -91,7 +91,7 @@ increase_mob(time_t *counter, float mult)
|
||||||
*counter = *counter - left;
|
*counter = *counter - left;
|
||||||
|
|
||||||
if (updating_mob)
|
if (updating_mob)
|
||||||
return (newetus);
|
return newetus;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ limit_level(double level, int type, int flag)
|
||||||
above = logx(above_easy + 1.0, logbase);
|
above = logx(above_easy + 1.0, logbase);
|
||||||
if (above > 250)
|
if (above > 250)
|
||||||
above = 250;
|
above = 250;
|
||||||
return ((above) < 0) ? easy : (easy + above);
|
return above < 0 ? easy : easy + above;
|
||||||
} else
|
} else
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ nxtsctp(struct nstr_sect *np)
|
||||||
if (np->curdist > np->dist)
|
if (np->curdist > np->dist)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
return (getsectp(np->x, np->y));
|
return getsectp(np->x, np->y);
|
||||||
}
|
}
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ upd_slmilcosts(natid n, int etu)
|
||||||
totalmil += mil;
|
totalmil += mil;
|
||||||
}
|
}
|
||||||
mil_pay = totalmil * etu * money_mil;
|
mil_pay = totalmil * etu * money_mil;
|
||||||
return (mil_pay);
|
return mil_pay;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -99,7 +99,7 @@ sail_find_fleet(struct fltheadstr **head, struct shpstr *sp)
|
||||||
s_char *cp;
|
s_char *cp;
|
||||||
|
|
||||||
if (sp->shp_own == 0)
|
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,
|
wu(0, sp->shp_own,
|
||||||
"Ship #%d, following #%d, which you don't own.\n",
|
"Ship #%d, following #%d, which you don't own.\n",
|
||||||
sp->shp_uid, ap->shp_uid);
|
sp->shp_uid, ap->shp_uid);
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
/* Not a follower. */
|
/* Not a follower. */
|
||||||
if (ap->shp_path[0] != 'f')
|
if (ap->shp_path[0] != 'f')
|
||||||
|
@ -124,7 +124,7 @@ sail_find_fleet(struct fltheadstr **head, struct shpstr *sp)
|
||||||
wu(0, sp->shp_own,
|
wu(0, sp->shp_own,
|
||||||
"Ship #%d, following #%d, which you don't own.\n",
|
"Ship #%d, following #%d, which you don't own.\n",
|
||||||
sp->shp_uid, follow);
|
sp->shp_uid, follow);
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This should prevent infinite loops. */
|
/* This should prevent infinite loops. */
|
||||||
|
@ -132,7 +132,7 @@ sail_find_fleet(struct fltheadstr **head, struct shpstr *sp)
|
||||||
wu(0, sp->shp_own,
|
wu(0, sp->shp_own,
|
||||||
"Ship #%d, too many follows (circular follow?).\n",
|
"Ship #%d, too many follows (circular follow?).\n",
|
||||||
sp->shp_uid);
|
sp->shp_uid);
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (stop = 0, cp = ap->shp_path; (!stop) && (*cp); cp++) {
|
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 this ship is not sailing anywhere then ignore it. */
|
||||||
if (!*ap->shp_path)
|
if (!*ap->shp_path)
|
||||||
return (0);
|
return 0;
|
||||||
|
|
||||||
/* Find the fleet structure we belong to. */
|
/* Find the fleet structure we belong to. */
|
||||||
for (fltp = (*head); (fltp && fltp->leader != follow);
|
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",
|
"Ship %d not in same sector as its sailing fleet\n",
|
||||||
sp->shp_uid);
|
sp->shp_uid);
|
||||||
fltp->real_q = LEADER_WRONGSECT;
|
fltp->real_q = LEADER_WRONGSECT;
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
this = malloc(sizeof(*this));
|
this = malloc(sizeof(*this));
|
||||||
|
@ -245,7 +245,7 @@ sail_nav_fleet(struct fltheadstr *fltp)
|
||||||
default:
|
default:
|
||||||
wu(0, fltp->own, "Your fleet lead by %d is trapped by land.\n",
|
wu(0, fltp->own, "Your fleet lead by %d is trapped by land.\n",
|
||||||
fltp->leader);
|
fltp->leader);
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
for (fe = fltp->head; fe; fe = fe->next) {
|
for (fe = fltp->head; fe; fe = fe->next) {
|
||||||
sp = getshipp(fe->num);
|
sp = getshipp(fe->num);
|
||||||
|
@ -257,7 +257,7 @@ sail_nav_fleet(struct fltheadstr *fltp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (error)
|
if (error)
|
||||||
return (0);
|
return 0;
|
||||||
sp = getshipp(fltp->leader);
|
sp = getshipp(fltp->leader);
|
||||||
own = sp->shp_own;
|
own = sp->shp_own;
|
||||||
fltp_to_list(fltp, &ship_list); /* hack -KHS 1995 */
|
fltp_to_list(fltp, &ship_list); /* hack -KHS 1995 */
|
||||||
|
|
|
@ -154,7 +154,7 @@ FILE *sect_fptr; /* the file we write everything to */
|
||||||
struct sctstr **sects;
|
struct sctstr **sects;
|
||||||
struct sctstr *sectsbuf;
|
struct sctstr *sectsbuf;
|
||||||
int fl_status; /* is anything wrong? */
|
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 */
|
#define NUMTRIES 10 /* keep trying to grow this many times */
|
||||||
|
|
||||||
const char *numletter =
|
const char *numletter =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue