Remove a bunch of redundant casts.
This commit is contained in:
parent
ee6d72f3b8
commit
4f59fc9967
125 changed files with 417 additions and 432 deletions
|
@ -178,7 +178,7 @@ enqueuecc(struct ioqueue *ioq, char *buf, int cc)
|
||||||
{
|
{
|
||||||
struct io *io;
|
struct io *io;
|
||||||
|
|
||||||
io = (struct io *)malloc(sizeof(*io));
|
io = malloc(sizeof(*io));
|
||||||
io->nbytes = cc;
|
io->nbytes = cc;
|
||||||
io->offset = 0;
|
io->offset = 0;
|
||||||
io->data = buf;
|
io->data = buf;
|
||||||
|
|
|
@ -68,7 +68,7 @@ makeqt(int nelem)
|
||||||
struct qelem *qp;
|
struct qelem *qp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
table = (struct qelem *)malloc(sizeof(*table) * nelem);
|
table = malloc(sizeof(*table) * nelem);
|
||||||
for (i = 0, qp = table; i < nelem; i++, qp++)
|
for (i = 0, qp = table; i < nelem; i++, qp++)
|
||||||
initque(qp);
|
initque(qp);
|
||||||
return table;
|
return table;
|
||||||
|
|
|
@ -133,8 +133,8 @@ termio(int fd, int sock, FILE *auxfi)
|
||||||
while (p < buf + n && q < out + 4000) {
|
while (p < buf + n && q < out + 4000) {
|
||||||
if (*p == '\n') {
|
if (*p == '\n') {
|
||||||
if (tagging) {
|
if (tagging) {
|
||||||
tag = (struct tagstruct *)malloc(sizeof(struct tagstruct));
|
tag = malloc(sizeof(struct tagstruct));
|
||||||
tag->item = (char *)malloc((1 + p - s) * sizeof(char));
|
tag->item = malloc((1 + p - s) * sizeof(char));
|
||||||
tag->next = taglist;
|
tag->next = taglist;
|
||||||
taglist = tag;
|
taglist = tag;
|
||||||
t = tag->item;
|
t = tag->item;
|
||||||
|
|
|
@ -102,7 +102,7 @@ as_add_cachepath(struct as_data *adp)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* We must make a new one of these */
|
/* We must make a new one of these */
|
||||||
from = (struct as_frompath *)malloc(sizeof(struct as_frompath));
|
from = malloc(sizeof(struct as_frompath));
|
||||||
if (from == NULL)
|
if (from == NULL)
|
||||||
return;
|
return;
|
||||||
/* And set some stuff */
|
/* And set some stuff */
|
||||||
|
@ -115,7 +115,7 @@ as_add_cachepath(struct as_data *adp)
|
||||||
}
|
}
|
||||||
if (!to) {
|
if (!to) {
|
||||||
/* We must make a new one */
|
/* We must make a new one */
|
||||||
to = (struct as_topath *)malloc(sizeof(struct as_topath));
|
to = malloc(sizeof(struct as_topath));
|
||||||
/* We can't, sorry */
|
/* We can't, sorry */
|
||||||
if (to == NULL)
|
if (to == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -152,15 +152,15 @@ as_clear_cachepath(void)
|
||||||
/* Free this path */
|
/* Free this path */
|
||||||
as_free_path(to->path);
|
as_free_path(to->path);
|
||||||
/* Free this node */
|
/* Free this node */
|
||||||
free((s_char *)to);
|
free(to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Now, free the list of lists */
|
/* Now, free the list of lists */
|
||||||
free((s_char *)from->tolist);
|
free(from->tolist);
|
||||||
/* Save the next pointer */
|
/* Save the next pointer */
|
||||||
from2 = from->next;
|
from2 = from->next;
|
||||||
/* now, free this from node */
|
/* now, free this from node */
|
||||||
free((s_char *)from);
|
free(from);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Note we don't free the fromhead here, we just zero it. That way,
|
/* Note we don't free the fromhead here, we just zero it. That way,
|
||||||
|
|
|
@ -50,9 +50,9 @@ as_free_queue(struct as_queue *queue)
|
||||||
struct as_queue *qp, *qp2;
|
struct as_queue *qp, *qp2;
|
||||||
|
|
||||||
for (qp = queue; qp; qp = qp2) {
|
for (qp = queue; qp; qp = qp2) {
|
||||||
free((s_char *)qp->np);
|
free(qp->np);
|
||||||
qp2 = qp->next;
|
qp2 = qp->next;
|
||||||
free((s_char *)qp);
|
free(qp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ as_free_path(struct as_path *pp)
|
||||||
|
|
||||||
for (; pp; pp = pp2) {
|
for (; pp; pp = pp2) {
|
||||||
pp2 = pp->next;
|
pp2 = pp->next;
|
||||||
free((s_char *)pp);
|
free(pp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,8 +77,8 @@ void
|
||||||
as_delete(struct as_data *adp)
|
as_delete(struct as_data *adp)
|
||||||
{
|
{
|
||||||
as_reset(adp);
|
as_reset(adp);
|
||||||
free((s_char *)adp->neighbor_coords);
|
free(adp->neighbor_coords);
|
||||||
free((s_char *)adp->neighbor_nodes);
|
free(adp->neighbor_nodes);
|
||||||
free((s_char *)adp->hashtab);
|
free(adp->hashtab);
|
||||||
free((s_char *)adp);
|
free(adp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ as_free_hashtab(struct as_data *adp)
|
||||||
for (i = 0; i < adp->hashsize; i++) {
|
for (i = 0; i < adp->hashsize; i++) {
|
||||||
for (hp = adp->hashtab[i]; hp; hp = hp2) {
|
for (hp = adp->hashtab[i]; hp; hp = hp2) {
|
||||||
hp2 = hp->next;
|
hp2 = hp->next;
|
||||||
free((char *)hp);
|
free(hp);
|
||||||
}
|
}
|
||||||
adp->hashtab[i] = NULL;
|
adp->hashtab[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,7 @@ as_makepath(struct as_data *adp)
|
||||||
struct as_node *np;
|
struct as_node *np;
|
||||||
|
|
||||||
for (np = adp->head->np; np; np = np->back) {
|
for (np = adp->head->np; np; np = np->back) {
|
||||||
pp = (struct as_path *)malloc(sizeof(struct as_path));
|
pp = malloc(sizeof(struct as_path));
|
||||||
pp->c = np->c;
|
pp->c = np->c;
|
||||||
pp->next = adp->path;
|
pp->next = adp->path;
|
||||||
adp->path = pp;
|
adp->path = pp;
|
||||||
|
|
|
@ -143,7 +143,7 @@ add(void)
|
||||||
if (p == 0)
|
if (p == 0)
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
snxtitem_all(&ni, EF_LAND);
|
snxtitem_all(&ni, EF_LAND);
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (land.lnd_own == coun) {
|
if (land.lnd_own == coun) {
|
||||||
makelost(EF_LAND, land.lnd_own, land.lnd_uid, land.lnd_x,
|
makelost(EF_LAND, land.lnd_own, land.lnd_uid, land.lnd_x,
|
||||||
land.lnd_y);
|
land.lnd_y);
|
||||||
|
|
|
@ -101,7 +101,7 @@ arm(void)
|
||||||
nuketype = i;
|
nuketype = i;
|
||||||
nukenum = -1;
|
nukenum = -1;
|
||||||
snxtitem_all(&ni, EF_NUKE);
|
snxtitem_all(&ni, EF_NUKE);
|
||||||
while (nxtitem(&ni, (s_char *)&nuke)) {
|
while (nxtitem(&ni, &nuke)) {
|
||||||
if (nuke.nuk_own != player->cnum)
|
if (nuke.nuk_own != player->cnum)
|
||||||
continue;
|
continue;
|
||||||
if (nuke.nuk_x != pl.pln_x || nuke.nuk_y != pl.pln_y)
|
if (nuke.nuk_x != pl.pln_x || nuke.nuk_y != pl.pln_y)
|
||||||
|
|
|
@ -94,7 +94,7 @@ boar(void)
|
||||||
/* Look for land units with mobility */
|
/* Look for land units with mobility */
|
||||||
snxtitem_xy(&ni, EF_LAND, off->x, off->y);
|
snxtitem_xy(&ni, EF_LAND, off->x, off->y);
|
||||||
foundland = 0;
|
foundland = 0;
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (land.lnd_own != player->cnum)
|
if (land.lnd_own != player->cnum)
|
||||||
continue;
|
continue;
|
||||||
if (land.lnd_ship >= 0)
|
if (land.lnd_ship >= 0)
|
||||||
|
|
|
@ -241,7 +241,7 @@ calc_all(long p_sect[][2],
|
||||||
*planes = *pbuild = *npbuild = *pmaint = 0;
|
*planes = *pbuild = *npbuild = *pmaint = 0;
|
||||||
|
|
||||||
np = getnatp(player->cnum);
|
np = getnatp(player->cnum);
|
||||||
bp = (int *)calloc(WORLD_X * WORLD_Y * 8, sizeof(int));
|
bp = calloc(WORLD_X * WORLD_Y * 8, sizeof(int));
|
||||||
for (n = 0; NULL != (sp = getsectid(n)); n++) {
|
for (n = 0; NULL != (sp = getsectid(n)); n++) {
|
||||||
fill_update_array(bp, sp);
|
fill_update_array(bp, sp);
|
||||||
if (sp->sct_own == player->cnum) {
|
if (sp->sct_own == player->cnum) {
|
||||||
|
|
|
@ -387,7 +387,7 @@ build_ship(struct sctstr *sp, struct mchrstr *mp,
|
||||||
player->dolcost += cost;
|
player->dolcost += cost;
|
||||||
cash -= cost;
|
cash -= cost;
|
||||||
snxtitem_all(&nstr, EF_SHIP);
|
snxtitem_all(&nstr, EF_SHIP);
|
||||||
while (nxtitem(&nstr, (s_char *)&ship)) {
|
while (nxtitem(&nstr, &ship)) {
|
||||||
if (ship.shp_own == 0) {
|
if (ship.shp_own == 0) {
|
||||||
freeship++;
|
freeship++;
|
||||||
break;
|
break;
|
||||||
|
@ -527,7 +527,7 @@ build_land(struct sctstr *sp, struct lchrstr *lp,
|
||||||
player->dolcost += cost;
|
player->dolcost += cost;
|
||||||
cash -= cost;
|
cash -= cost;
|
||||||
snxtitem_all(&nstr, EF_LAND);
|
snxtitem_all(&nstr, EF_LAND);
|
||||||
while (nxtitem(&nstr, (s_char *)&land)) {
|
while (nxtitem(&nstr, &land)) {
|
||||||
if (land.lnd_own == 0) {
|
if (land.lnd_own == 0) {
|
||||||
freeland++;
|
freeland++;
|
||||||
break;
|
break;
|
||||||
|
@ -848,7 +848,7 @@ build_plane(struct sctstr *sp, struct plchrstr *pp,
|
||||||
cash -= cost;
|
cash -= cost;
|
||||||
snxtitem_all(&nstr, EF_PLANE);
|
snxtitem_all(&nstr, EF_PLANE);
|
||||||
freeplane = 0;
|
freeplane = 0;
|
||||||
while (nxtitem(&nstr, (s_char *)&plane)) {
|
while (nxtitem(&nstr, &plane)) {
|
||||||
if (plane.pln_own == 0) {
|
if (plane.pln_own == 0) {
|
||||||
freeplane++;
|
freeplane++;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -51,7 +51,7 @@ carg(void)
|
||||||
if (!snxtitem(&ni, EF_SHIP, player->argp[1]))
|
if (!snxtitem(&ni, EF_SHIP, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
nships = 0;
|
nships = 0;
|
||||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
while (nxtitem(&ni, &ship)) {
|
||||||
if (ship.shp_own == 0)
|
if (ship.shp_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if ((player->cnum != ship.shp_own) && !player->god)
|
if ((player->cnum != ship.shp_own) && !player->god)
|
||||||
|
@ -104,7 +104,7 @@ lcarg(void)
|
||||||
if (!snxtitem(&ni, EF_LAND, player->argp[1]))
|
if (!snxtitem(&ni, EF_LAND, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
nunits = 0;
|
nunits = 0;
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (!land.lnd_own)
|
if (!land.lnd_own)
|
||||||
continue;
|
continue;
|
||||||
if ((player->cnum != land.lnd_own) && !player->god)
|
if ((player->cnum != land.lnd_own) && !player->god)
|
||||||
|
|
|
@ -158,7 +158,7 @@ cede_sect(struct nstr_sect *ns, natid to)
|
||||||
bad = 0;
|
bad = 0;
|
||||||
}
|
}
|
||||||
snxtitem_all(&ni, EF_SHIP);
|
snxtitem_all(&ni, EF_SHIP);
|
||||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
while (nxtitem(&ni, &ship)) {
|
||||||
if ((ship.shp_own == to) &&
|
if ((ship.shp_own == to) &&
|
||||||
((ship.shp_x == sect.sct_x) && (ship.shp_y == sect.sct_y)))
|
((ship.shp_x == sect.sct_x) && (ship.shp_y == sect.sct_y)))
|
||||||
bad = 0;
|
bad = 0;
|
||||||
|
@ -300,14 +300,14 @@ cede_ship(struct nstr_item *ni, natid to)
|
||||||
int nships = 0;
|
int nships = 0;
|
||||||
int bad = 0;
|
int bad = 0;
|
||||||
|
|
||||||
while (nxtitem(ni, (s_char *)&ship)) {
|
while (nxtitem(ni, &ship)) {
|
||||||
|
|
||||||
if (!player->owner || ship.shp_own == 0)
|
if (!player->owner || ship.shp_own == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bad = 1;
|
bad = 1;
|
||||||
snxtitem_xy(&tni, EF_SHIP, ship.shp_x, ship.shp_y);
|
snxtitem_xy(&tni, EF_SHIP, ship.shp_x, ship.shp_y);
|
||||||
while (nxtitem(&tni, (s_char *)&tship) && bad)
|
while (nxtitem(&tni, &tship) && bad)
|
||||||
if (tship.shp_own == to)
|
if (tship.shp_own == to)
|
||||||
bad = 0;
|
bad = 0;
|
||||||
|
|
||||||
|
|
|
@ -76,9 +76,9 @@ coas(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
for (i = 0; i < TSIZE; i++)
|
for (i = 0; i < TSIZE; i++)
|
||||||
list[i] = 0;
|
list[i] = 0;
|
||||||
cp = (struct coast *)malloc(sizeof(*cp));
|
cp = malloc(sizeof(*cp));
|
||||||
snxtitem_all(&ni, EF_SHIP);
|
snxtitem_all(&ni, EF_SHIP);
|
||||||
while (nxtitem(&ni, (s_char *)&cp->c_shp)) {
|
while (nxtitem(&ni, &cp->c_shp)) {
|
||||||
if (cp->c_shp.shp_own == 0 || cp->c_shp.shp_own == player->cnum)
|
if (cp->c_shp.shp_own == 0 || cp->c_shp.shp_own == player->cnum)
|
||||||
continue;
|
continue;
|
||||||
/*
|
/*
|
||||||
|
@ -94,11 +94,11 @@ coas(void)
|
||||||
cp->c_number = i;
|
cp->c_number = i;
|
||||||
cp->c_next = list[n];
|
cp->c_next = list[n];
|
||||||
list[n] = cp;
|
list[n] = cp;
|
||||||
cp = (struct coast *)malloc(sizeof(*cp));
|
cp = malloc(sizeof(*cp));
|
||||||
nship++;
|
nship++;
|
||||||
}
|
}
|
||||||
/* get that last one! */
|
/* get that last one! */
|
||||||
free((s_char *)cp);
|
free(cp);
|
||||||
pr("- = [ Coastwatch report for %s ] = -\n", cname(player->cnum));
|
pr("- = [ Coastwatch report for %s ] = -\n", cname(player->cnum));
|
||||||
pr(" Country Ship Location\n");
|
pr(" Country Ship Location\n");
|
||||||
tech = tfact(player->cnum, 1.0);
|
tech = tfact(player->cnum, 1.0);
|
||||||
|
@ -134,7 +134,7 @@ coas(void)
|
||||||
for (i = 0; i < TSIZE; i++) {
|
for (i = 0; i < TSIZE; i++) {
|
||||||
while (NULL != (cp = list[i])) {
|
while (NULL != (cp = list[i])) {
|
||||||
list[i] = cp->c_next;
|
list[i] = cp->c_next;
|
||||||
free((s_char *)cp);
|
free(cp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
|
@ -154,7 +154,7 @@ showship(struct coast **cpp, int x, int y)
|
||||||
do {
|
do {
|
||||||
/* we delete it, we free it. */
|
/* we delete it, we free it. */
|
||||||
if (todelete) {
|
if (todelete) {
|
||||||
free((s_char *)todelete);
|
free(todelete);
|
||||||
todelete = 0;
|
todelete = 0;
|
||||||
}
|
}
|
||||||
if (cp->c_shp.shp_x != x || cp->c_shp.shp_y != y) {
|
if (cp->c_shp.shp_x != x || cp->c_shp.shp_y != y) {
|
||||||
|
@ -173,6 +173,6 @@ showship(struct coast **cpp, int x, int y)
|
||||||
} while (NULL != (cp = cp->c_next));
|
} while (NULL != (cp = cp->c_next));
|
||||||
/* check that last one! */
|
/* check that last one! */
|
||||||
if (todelete)
|
if (todelete)
|
||||||
free((s_char *)todelete);
|
free(todelete);
|
||||||
return (nship);
|
return (nship);
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,7 +218,7 @@ loan_accept(struct ltcomstr *ltcp)
|
||||||
}
|
}
|
||||||
/* check to see if a loan already exists */
|
/* check to see if a loan already exists */
|
||||||
snxtitem_all(&nstr, EF_LOAN);
|
snxtitem_all(&nstr, EF_LOAN);
|
||||||
while (nxtitem(&nstr, (s_char *)&loan)) {
|
while (nxtitem(&nstr, &loan)) {
|
||||||
if (loan.l_status == LS_SIGNED && loan.l_lonee == lp->l_loner
|
if (loan.l_status == LS_SIGNED && loan.l_lonee == lp->l_loner
|
||||||
&& (loan.l_loner == lp->l_lonee)) {
|
&& (loan.l_loner == lp->l_lonee)) {
|
||||||
pr("He already owes you money - make him repay his loan!\n");
|
pr("He already owes you money - make him repay his loan!\n");
|
||||||
|
@ -240,7 +240,7 @@ loan_accept(struct ltcomstr *ltcp)
|
||||||
(void)time(&lp->l_lastpay);
|
(void)time(&lp->l_lastpay);
|
||||||
lp->l_duedate = lp->l_ldur * 86400 + lp->l_lastpay;
|
lp->l_duedate = lp->l_ldur * 86400 + lp->l_lastpay;
|
||||||
lp->l_status = LS_SIGNED;
|
lp->l_status = LS_SIGNED;
|
||||||
if (!putloan(ltcp->num, (s_char *)lp)) {
|
if (!putloan(ltcp->num, lp)) {
|
||||||
pr("Problem writing lp->to disk; get help!\n");
|
pr("Problem writing lp->to disk; get help!\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ do_conv(struct nstr_sect nstr, int uwtoconvert, int for_real)
|
||||||
* count.
|
* count.
|
||||||
*/
|
*/
|
||||||
snxtitem_xy(&ni, EF_LAND, sect.sct_x, sect.sct_y);
|
snxtitem_xy(&ni, EF_LAND, sect.sct_x, sect.sct_y);
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
mil += lnd_getmil(&land);
|
mil += lnd_getmil(&land);
|
||||||
/* mil += (lnd_getmil(&land) *
|
/* mil += (lnd_getmil(&land) *
|
||||||
((double)land.lnd_effic/100.0));*/
|
((double)land.lnd_effic/100.0));*/
|
||||||
|
|
|
@ -57,7 +57,7 @@ coun(void)
|
||||||
if (!snxtitem(&ni, EF_NATION, player->argp[1]))
|
if (!snxtitem(&ni, EF_NATION, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
first = 1;
|
first = 1;
|
||||||
while (nxtitem(&ni, (s_char *)&nat)) {
|
while (nxtitem(&ni, &nat)) {
|
||||||
if ((nat.nat_stat & STAT_INUSE) == 0)
|
if ((nat.nat_stat & STAT_INUSE) == 0)
|
||||||
continue;
|
continue;
|
||||||
if (((nat.nat_stat & GOD) != GOD) && !player->god)
|
if (((nat.nat_stat & GOD) != GOD) && !player->god)
|
||||||
|
|
|
@ -99,7 +99,7 @@ decl(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
natp = getnatp(who);
|
natp = getnatp(who);
|
||||||
while (nxtitem(&ni, (s_char *)&nat)) {
|
while (nxtitem(&ni, &nat)) {
|
||||||
if (!(nat.nat_stat & STAT_INUSE))
|
if (!(nat.nat_stat & STAT_INUSE))
|
||||||
continue;
|
continue;
|
||||||
if (player->cnum == (natid)ni.cur)
|
if (player->cnum == (natid)ni.cur)
|
||||||
|
|
|
@ -148,7 +148,7 @@ drop(void)
|
||||||
&& ip->i_vtype == I_SHELL)
|
&& ip->i_vtype == I_SHELL)
|
||||||
pln_mine(&bomb_list, &target);
|
pln_mine(&bomb_list, &target);
|
||||||
else
|
else
|
||||||
pln_dropoff(&bomb_list, ip, tx, ty, (s_char *)&target, EF_SECTOR);
|
pln_dropoff(&bomb_list, ip, tx, ty, &target, EF_SECTOR);
|
||||||
}
|
}
|
||||||
pln_put(&bomb_list);
|
pln_put(&bomb_list);
|
||||||
pln_put(&esc_list);
|
pln_put(&esc_list);
|
||||||
|
|
|
@ -72,7 +72,7 @@ foll(void)
|
||||||
}
|
}
|
||||||
x = ship.shp_x;
|
x = ship.shp_x;
|
||||||
y = ship.shp_y;
|
y = ship.shp_y;
|
||||||
while (nxtitem(&nstr, (s_char *)&ship)) {
|
while (nxtitem(&nstr, &ship)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
if (ship.shp_x != x || ship.shp_y != y) {
|
if (ship.shp_x != x || ship.shp_y != y) {
|
||||||
|
|
|
@ -59,7 +59,7 @@ fort(void)
|
||||||
if (fort_amt > land_mob_max)
|
if (fort_amt > land_mob_max)
|
||||||
fort_amt = land_mob_max;
|
fort_amt = land_mob_max;
|
||||||
nunits = 0;
|
nunits = 0;
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (!player->owner || land.lnd_own == 0)
|
if (!player->owner || land.lnd_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (land.lnd_type < 0 || land.lnd_type > lnd_maxno) {
|
if (land.lnd_type < 0 || land.lnd_type > lnd_maxno) {
|
||||||
|
|
|
@ -102,7 +102,7 @@ fuel(void)
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (nxtitem(&ni, (s_char *)&item)) {
|
while (nxtitem(&ni, &item)) {
|
||||||
fueled = 0;
|
fueled = 0;
|
||||||
if (type == EF_SHIP) {
|
if (type == EF_SHIP) {
|
||||||
if (item.ship.shp_own != player->cnum) {
|
if (item.ship.shp_own != player->cnum) {
|
||||||
|
@ -222,7 +222,7 @@ fuel(void)
|
||||||
if (!check_ship_ok(&item.ship))
|
if (!check_ship_ok(&item.ship))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!nxtitem(&tender, (s_char *)&item2))
|
if (!nxtitem(&tender, &item2))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!(mchr[(int)item2.ship.shp_type].m_flags & M_OILER)) {
|
if (!(mchr[(int)item2.ship.shp_type].m_flags & M_OILER)) {
|
||||||
|
@ -384,7 +384,7 @@ fuel(void)
|
||||||
if (!check_land_ok(&item.land))
|
if (!check_land_ok(&item.land))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!nxtitem(<ender, (s_char *)&item2))
|
if (!nxtitem(<ender, &item2))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!(lchr[(int)item2.land.lnd_type].l_flags & L_SUPPLY)) {
|
if (!(lchr[(int)item2.land.lnd_type].l_flags & L_SUPPLY)) {
|
||||||
|
|
|
@ -71,7 +71,7 @@ hard(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
natp = getnatp(player->cnum);
|
natp = getnatp(player->cnum);
|
||||||
cash = natp->nat_money;
|
cash = natp->nat_money;
|
||||||
while (nxtitem(&ni, (s_char *)&pln)) {
|
while (nxtitem(&ni, &pln)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
pcp = &plchr[(int)pln.pln_type];
|
pcp = &plchr[(int)pln.pln_type];
|
||||||
|
|
|
@ -93,7 +93,7 @@ head(void)
|
||||||
memset(hist, 0, sizeof(hist));
|
memset(hist, 0, sizeof(hist));
|
||||||
snxtitem_all(&nstr, EF_NEWS);
|
snxtitem_all(&nstr, EF_NEWS);
|
||||||
maxcnum = 0;
|
maxcnum = 0;
|
||||||
while (nxtitem(&nstr, (s_char *)&news)) {
|
while (nxtitem(&nstr, &news)) {
|
||||||
news_age = now - news.nws_when;
|
news_age = now - news.nws_when;
|
||||||
if (news_age > news_per)
|
if (news_age > news_per)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -199,9 +199,9 @@ apro(void)
|
||||||
return RET_SYS;
|
return RET_SYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
fbuf = (s_char *)malloc(256);
|
fbuf = malloc(256);
|
||||||
lbuf = (s_char *)malloc(256);
|
lbuf = malloc(256);
|
||||||
lbp = (s_char *)malloc(256);
|
lbp = malloc(256);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* lower case search string into lbp
|
* lower case search string into lbp
|
||||||
|
@ -434,9 +434,9 @@ apro(void)
|
||||||
return RET_SYS;
|
return RET_SYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
fbuf = (s_char *)malloc(256);
|
fbuf = malloc(256);
|
||||||
lbuf = (s_char *)malloc(256);
|
lbuf = malloc(256);
|
||||||
lbp = (s_char *)malloc(256);
|
lbp = malloc(256);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* lower case search string into lbp
|
* lower case search string into lbp
|
||||||
|
|
|
@ -51,7 +51,7 @@ land(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
||||||
nunits = 0;
|
nunits = 0;
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (land.lnd_own == 0)
|
if (land.lnd_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (!player->owner && !player->god)
|
if (!player->owner && !player->god)
|
||||||
|
|
|
@ -70,7 +70,7 @@ laun(void)
|
||||||
|
|
||||||
if (!snxtitem(&nstr, EF_PLANE, player->argp[1]))
|
if (!snxtitem(&nstr, EF_PLANE, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
while (nxtitem(&nstr, (s_char *)&plane)) {
|
while (nxtitem(&nstr, &plane)) {
|
||||||
if (plane.pln_own != player->cnum)
|
if (plane.pln_own != player->cnum)
|
||||||
continue;
|
continue;
|
||||||
pcp = &plchr[(int)plane.pln_type];
|
pcp = &plchr[(int)plane.pln_type];
|
||||||
|
|
|
@ -289,7 +289,7 @@ ldump(void)
|
||||||
pr("\n");
|
pr("\n");
|
||||||
|
|
||||||
np = getnatp(player->cnum);
|
np = getnatp(player->cnum);
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (land.lnd_own == 0)
|
if (land.lnd_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (!player->owner && !player->god)
|
if (!player->owner && !player->god)
|
||||||
|
|
|
@ -56,7 +56,7 @@ ledg(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
pr("\n... %s Ledger ...\n", cname(player->cnum));
|
pr("\n... %s Ledger ...\n", cname(player->cnum));
|
||||||
nloan = 0;
|
nloan = 0;
|
||||||
while (nxtitem(&nstr, (s_char *)&loan)) {
|
while (nxtitem(&nstr, &loan)) {
|
||||||
if (disloan(nstr.cur, &loan) > 0)
|
if (disloan(nstr.cur, &loan) > 0)
|
||||||
nloan++;
|
nloan++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ load(void)
|
||||||
load_unload = **player->argp == 'l' ? LOAD : UNLOAD;
|
load_unload = **player->argp == 'l' ? LOAD : UNLOAD;
|
||||||
|
|
||||||
nships = 0;
|
nships = 0;
|
||||||
while (nxtitem(&nbst, (s_char *)&ship)) {
|
while (nxtitem(&nbst, &ship)) {
|
||||||
if (!ship.shp_own)
|
if (!ship.shp_own)
|
||||||
continue;
|
continue;
|
||||||
if (!player->owner && (load_unload == UNLOAD)) {
|
if (!player->owner && (load_unload == UNLOAD)) {
|
||||||
|
@ -250,7 +250,7 @@ lload(void)
|
||||||
load_unload = *(*player->argp + 1) == 'l' ? LOAD : UNLOAD;
|
load_unload = *(*player->argp + 1) == 'l' ? LOAD : UNLOAD;
|
||||||
|
|
||||||
nunits = 0;
|
nunits = 0;
|
||||||
while (nxtitem(&nbst, (s_char *)&land)) {
|
while (nxtitem(&nbst, &land)) {
|
||||||
if (land.lnd_own == 0)
|
if (land.lnd_own == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ load_plane_ship(struct sctstr *sectp, struct shpstr *sp, int noisy,
|
||||||
if (p && *p)
|
if (p && *p)
|
||||||
noisy &= isdigit(*p);
|
noisy &= isdigit(*p);
|
||||||
|
|
||||||
while (nxtitem(&ni, (s_char *)&pln)) {
|
while (nxtitem(&ni, &pln)) {
|
||||||
if (pln.pln_own != player->cnum)
|
if (pln.pln_own != player->cnum)
|
||||||
continue;
|
continue;
|
||||||
if (!(plchr[(int)pln.pln_type].pl_flags & P_L)
|
if (!(plchr[(int)pln.pln_type].pl_flags & P_L)
|
||||||
|
@ -547,7 +547,7 @@ load_land_ship(struct sctstr *sectp, struct shpstr *sp, int noisy,
|
||||||
if (p && *p)
|
if (p && *p)
|
||||||
noisy &= isdigit(*p);
|
noisy &= isdigit(*p);
|
||||||
|
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (land.lnd_own != player->cnum)
|
if (land.lnd_own != player->cnum)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -656,7 +656,7 @@ load_land_ship(struct sctstr *sectp, struct shpstr *sp, int noisy,
|
||||||
pr("WARNING: %s is out of supply!\n", prland(&land));
|
pr("WARNING: %s is out of supply!\n", prland(&land));
|
||||||
putship(sp->shp_uid, sp);
|
putship(sp->shp_uid, sp);
|
||||||
snxtitem_xy(&pni, EF_PLANE, land.lnd_x, land.lnd_y);
|
snxtitem_xy(&pni, EF_PLANE, land.lnd_x, land.lnd_y);
|
||||||
while (nxtitem(&pni, (s_char *)&plane)) {
|
while (nxtitem(&pni, &plane)) {
|
||||||
if (plane.pln_flags & PLN_LAUNCHED)
|
if (plane.pln_flags & PLN_LAUNCHED)
|
||||||
continue;
|
continue;
|
||||||
if (plane.pln_land != land.lnd_uid)
|
if (plane.pln_land != land.lnd_uid)
|
||||||
|
@ -698,7 +698,7 @@ load_land_ship(struct sctstr *sectp, struct shpstr *sp, int noisy,
|
||||||
they are quietly unloaded too. */
|
they are quietly unloaded too. */
|
||||||
if (!(lchr[(int)land.lnd_type].l_flags & L_SPY)) {
|
if (!(lchr[(int)land.lnd_type].l_flags & L_SPY)) {
|
||||||
snxtitem_xy(&pni, EF_PLANE, land.lnd_x, land.lnd_y);
|
snxtitem_xy(&pni, EF_PLANE, land.lnd_x, land.lnd_y);
|
||||||
while (nxtitem(&pni, (s_char *)&plane)) {
|
while (nxtitem(&pni, &plane)) {
|
||||||
if (plane.pln_flags & PLN_LAUNCHED)
|
if (plane.pln_flags & PLN_LAUNCHED)
|
||||||
continue;
|
continue;
|
||||||
if (plane.pln_land != land.lnd_uid)
|
if (plane.pln_land != land.lnd_uid)
|
||||||
|
@ -857,7 +857,7 @@ load_plane_land(struct sctstr *sectp, struct lndstr *lp, int noisy,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (nxtitem(&ni, (s_char *)&pln)) {
|
while (nxtitem(&ni, &pln)) {
|
||||||
if (pln.pln_own != player->cnum)
|
if (pln.pln_own != player->cnum)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1059,7 +1059,7 @@ load_land_land(struct sctstr *sectp, struct lndstr *lp, int noisy,
|
||||||
if (p && *p)
|
if (p && *p)
|
||||||
noisy &= isdigit(*p);
|
noisy &= isdigit(*p);
|
||||||
|
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
|
|
||||||
if (land.lnd_own != player->cnum)
|
if (land.lnd_own != player->cnum)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1136,7 +1136,7 @@ load_land_land(struct sctstr *sectp, struct lndstr *lp, int noisy,
|
||||||
pr("WARNING: %s is out of supply!\n", prland(&land));
|
pr("WARNING: %s is out of supply!\n", prland(&land));
|
||||||
putland(lp->lnd_uid, lp);
|
putland(lp->lnd_uid, lp);
|
||||||
snxtitem_xy(&pni, EF_PLANE, land.lnd_x, land.lnd_y);
|
snxtitem_xy(&pni, EF_PLANE, land.lnd_x, land.lnd_y);
|
||||||
while (nxtitem(&pni, (s_char *)&plane)) {
|
while (nxtitem(&pni, &plane)) {
|
||||||
if (plane.pln_flags & PLN_LAUNCHED)
|
if (plane.pln_flags & PLN_LAUNCHED)
|
||||||
continue;
|
continue;
|
||||||
if (plane.pln_land != land.lnd_uid)
|
if (plane.pln_land != land.lnd_uid)
|
||||||
|
@ -1168,7 +1168,7 @@ load_land_land(struct sctstr *sectp, struct lndstr *lp, int noisy,
|
||||||
putland(land.lnd_uid, &land);
|
putland(land.lnd_uid, &land);
|
||||||
putland(lp->lnd_uid, lp);
|
putland(lp->lnd_uid, lp);
|
||||||
snxtitem_xy(&pni, EF_PLANE, land.lnd_x, land.lnd_y);
|
snxtitem_xy(&pni, EF_PLANE, land.lnd_x, land.lnd_y);
|
||||||
while (nxtitem(&pni, (s_char *)&plane)) {
|
while (nxtitem(&pni, &plane)) {
|
||||||
if (plane.pln_flags & PLN_LAUNCHED)
|
if (plane.pln_flags & PLN_LAUNCHED)
|
||||||
continue;
|
continue;
|
||||||
if (plane.pln_land != land.lnd_uid)
|
if (plane.pln_land != land.lnd_uid)
|
||||||
|
|
|
@ -63,13 +63,13 @@ look(void)
|
||||||
|
|
||||||
if (!snxtitem(&ni, EF_SHIP, player->argp[1]))
|
if (!snxtitem(&ni, EF_SHIP, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if ((bitmap = (u_char *)malloc((WORLD_X * WORLD_Y) / 8)) == 0) {
|
if ((bitmap = malloc((WORLD_X * WORLD_Y) / 8)) == 0) {
|
||||||
logerror("malloc failed in look\n");
|
logerror("malloc failed in look\n");
|
||||||
pr("Memory error. Tell the deity.\n");
|
pr("Memory error. Tell the deity.\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
|
memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
|
||||||
while (nxtitem(&ni, (s_char *)&myship)) {
|
while (nxtitem(&ni, &myship)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
look_ship(&myship);
|
look_ship(&myship);
|
||||||
|
@ -107,7 +107,7 @@ look(void)
|
||||||
}
|
}
|
||||||
if (changed)
|
if (changed)
|
||||||
writemap(player->cnum);
|
writemap(player->cnum);
|
||||||
free((s_char *)bitmap);
|
free(bitmap);
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,13 +188,13 @@ llook(void)
|
||||||
|
|
||||||
if (!snxtitem(&ni, EF_LAND, player->argp[1]))
|
if (!snxtitem(&ni, EF_LAND, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if ((bitmap = (u_char *)malloc((WORLD_X * WORLD_Y) / 8)) == 0) {
|
if ((bitmap = malloc((WORLD_X * WORLD_Y) / 8)) == 0) {
|
||||||
logerror("malloc failed in llook\n");
|
logerror("malloc failed in llook\n");
|
||||||
pr("Memory error. Tell the deity.\n");
|
pr("Memory error. Tell the deity.\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
|
memset(bitmap, 0, (WORLD_X * WORLD_Y) / 8);
|
||||||
while (nxtitem(&ni, (s_char *)&myland)) {
|
while (nxtitem(&ni, &myland)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
if (myland.lnd_ship >= 0)
|
if (myland.lnd_ship >= 0)
|
||||||
|
@ -241,7 +241,7 @@ llook(void)
|
||||||
}
|
}
|
||||||
if (changed)
|
if (changed)
|
||||||
writemap(player->cnum);
|
writemap(player->cnum);
|
||||||
free((s_char *)bitmap);
|
free(bitmap);
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ lost(void)
|
||||||
if (player->god)
|
if (player->god)
|
||||||
pr("owner ");
|
pr("owner ");
|
||||||
pr("type id x y timestamp\n");
|
pr("type id x y timestamp\n");
|
||||||
while (nxtitem(&ni, (s_char *)&lost)) {
|
while (nxtitem(&ni, &lost)) {
|
||||||
if (lost.lost_owner == 0)
|
if (lost.lost_owner == 0)
|
||||||
continue;
|
continue;
|
||||||
if (lost.lost_owner != player->cnum && !player->god)
|
if (lost.lost_owner != player->cnum && !player->god)
|
||||||
|
|
|
@ -49,7 +49,7 @@ lsta(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
||||||
nunits = 0;
|
nunits = 0;
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (!player->owner || land.lnd_own == 0)
|
if (!player->owner || land.lnd_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (land.lnd_type < 0 || land.lnd_type > lnd_maxno) {
|
if (land.lnd_type < 0 || land.lnd_type > lnd_maxno) {
|
||||||
|
|
|
@ -74,7 +74,7 @@ ltend(void)
|
||||||
if (!snxtitem(&tenders, EF_SHIP,
|
if (!snxtitem(&tenders, EF_SHIP,
|
||||||
getstarg(player->argp[2], "Tender(s)? ", buf)))
|
getstarg(player->argp[2], "Tender(s)? ", buf)))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
while (nxtitem(&tenders, (s_char *)&tender)) {
|
while (nxtitem(&tenders, &tender)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
if ((p =
|
if ((p =
|
||||||
|
@ -103,7 +103,7 @@ ltend(void)
|
||||||
if (!check_ship_ok(&tender))
|
if (!check_ship_ok(&tender))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
total = 0;
|
total = 0;
|
||||||
while (nxtitem(&targets, (s_char *)&target)) {
|
while (nxtitem(&targets, &target)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ multifire(void)
|
||||||
pr("Fire aborted.\n");
|
pr("Fire aborted.\n");
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
while (nxtitem(&nbst, (s_char *)&item)) {
|
while (nxtitem(&nbst, &item)) {
|
||||||
attacker = orig_attacker;
|
attacker = orig_attacker;
|
||||||
if (attacker == targ_unit) {
|
if (attacker == targ_unit) {
|
||||||
if (!getland(item.land.lnd_uid, &fland))
|
if (!getland(item.land.lnd_uid, &fland))
|
||||||
|
@ -674,7 +674,7 @@ defend(struct emp_qelem *al, struct emp_qelem *dl, enum targ_type target,
|
||||||
(dam = quiet_bigdef(attacker, dl, vict, aown, fx, fy, &nfiring))) {
|
(dam = quiet_bigdef(attacker, dl, vict, aown, fx, fy, &nfiring))) {
|
||||||
if (nfiring > *nd)
|
if (nfiring > *nd)
|
||||||
*nd = nfiring;
|
*nd = nfiring;
|
||||||
fp = (struct flist *)malloc(sizeof(struct flist));
|
fp = malloc(sizeof(struct flist));
|
||||||
memset(fp, 0, sizeof(struct flist));
|
memset(fp, 0, sizeof(struct flist));
|
||||||
fp->defdam = dam;
|
fp->defdam = dam;
|
||||||
fp->victim = vict;
|
fp->victim = vict;
|
||||||
|
@ -742,7 +742,7 @@ do_defdam(struct emp_qelem *list, double odds)
|
||||||
xyas(fp->x, fp->y, vict), dam);
|
xyas(fp->x, fp->y, vict), dam);
|
||||||
}
|
}
|
||||||
emp_remque(&fp->queue);
|
emp_remque(&fp->queue);
|
||||||
free((s_char *)fp);
|
free(fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -813,7 +813,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
(*nfiring)++;
|
(*nfiring)++;
|
||||||
fp = (struct flist *)malloc(sizeof(struct flist));
|
fp = malloc(sizeof(struct flist));
|
||||||
memset(fp, 0, sizeof(struct flist));
|
memset(fp, 0, sizeof(struct flist));
|
||||||
fp->type = targ_ship;
|
fp->type = targ_ship;
|
||||||
fp->uid = ship.shp_uid;
|
fp->uid = ship.shp_uid;
|
||||||
|
@ -844,7 +844,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
|
||||||
if (nshot == 0)
|
if (nshot == 0)
|
||||||
continue;
|
continue;
|
||||||
(*nfiring)++;
|
(*nfiring)++;
|
||||||
fp = (struct flist *)malloc(sizeof(struct flist));
|
fp = malloc(sizeof(struct flist));
|
||||||
memset(fp, 0, sizeof(struct flist));
|
memset(fp, 0, sizeof(struct flist));
|
||||||
fp->type = targ_ship;
|
fp->type = targ_ship;
|
||||||
fp->uid = ship.shp_uid;
|
fp->uid = ship.shp_uid;
|
||||||
|
@ -897,7 +897,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
|
||||||
land.lnd_ammo, shell);
|
land.lnd_ammo, shell);
|
||||||
|
|
||||||
(*nfiring)++;
|
(*nfiring)++;
|
||||||
fp = (struct flist *)malloc(sizeof(struct flist));
|
fp = malloc(sizeof(struct flist));
|
||||||
memset(fp, 0, sizeof(struct flist));
|
memset(fp, 0, sizeof(struct flist));
|
||||||
fp->type = targ_unit;
|
fp->type = targ_unit;
|
||||||
fp->uid = land.lnd_uid;
|
fp->uid = land.lnd_uid;
|
||||||
|
@ -950,7 +950,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
|
||||||
if (gun == 0 || firing.sct_item[I_MILIT] < 5 || shell == 0)
|
if (gun == 0 || firing.sct_item[I_MILIT] < 5 || shell == 0)
|
||||||
continue;
|
continue;
|
||||||
(*nfiring)++;
|
(*nfiring)++;
|
||||||
fp = (struct flist *)malloc(sizeof(struct flist));
|
fp = malloc(sizeof(struct flist));
|
||||||
memset(fp, 0, sizeof(struct flist));
|
memset(fp, 0, sizeof(struct flist));
|
||||||
fp->x = firing.sct_x;
|
fp->x = firing.sct_x;
|
||||||
fp->y = firing.sct_y;
|
fp->y = firing.sct_y;
|
||||||
|
@ -1021,7 +1021,7 @@ use_ammo(struct emp_qelem *list)
|
||||||
putland(land.lnd_uid, &land);
|
putland(land.lnd_uid, &land);
|
||||||
|
|
||||||
emp_remque(&fp->queue);
|
emp_remque(&fp->queue);
|
||||||
free((s_char *)fp);
|
free(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ mine(void)
|
||||||
"Drop how many mines from each ship? ");
|
"Drop how many mines from each ship? ");
|
||||||
if (mines <= 0)
|
if (mines <= 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
while (nxtitem(&ni, &ship)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
mp = &mchr[(int)ship.shp_type];
|
mp = &mchr[(int)ship.shp_type];
|
||||||
|
@ -107,7 +107,7 @@ landmine(void)
|
||||||
|
|
||||||
if (!snxtitem(&ni, EF_LAND, player->argp[1]))
|
if (!snxtitem(&ni, EF_LAND, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
lp = &lchr[(int)land.lnd_type];
|
lp = &lchr[(int)land.lnd_type];
|
||||||
|
|
|
@ -190,7 +190,7 @@ mission(void)
|
||||||
|
|
||||||
size = max(sizeof(struct lndstr), sizeof(struct plnstr));
|
size = max(sizeof(struct lndstr), sizeof(struct plnstr));
|
||||||
size = max(size, sizeof(struct shpstr));
|
size = max(size, sizeof(struct shpstr));
|
||||||
block = (s_char *)malloc(size);
|
block = malloc(size);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EF_SHIP:
|
case EF_SHIP:
|
||||||
mobmax = ship_mob_max;
|
mobmax = ship_mob_max;
|
||||||
|
|
|
@ -72,7 +72,7 @@ mobq(void)
|
||||||
pr("warning: %d less than optimal\n", mobquota);
|
pr("warning: %d less than optimal\n", mobquota);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (nxtitem(&nstr, (s_char *)&ship)) {
|
while (nxtitem(&nstr, &ship)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
if (!oldmq)
|
if (!oldmq)
|
||||||
|
|
|
@ -54,7 +54,7 @@ morale(void)
|
||||||
|
|
||||||
if (!snxtitem(&np, EF_LAND, player->argp[1]))
|
if (!snxtitem(&np, EF_LAND, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
while (!player->aborted && nxtitem(&np, (s_char *)&land)) {
|
while (!player->aborted && nxtitem(&np, &land)) {
|
||||||
if (!player->owner || land.lnd_own == 0)
|
if (!player->owner || land.lnd_own == 0)
|
||||||
continue;
|
continue;
|
||||||
natp = getnatp(land.lnd_own);
|
natp = getnatp(land.lnd_own);
|
||||||
|
|
|
@ -57,7 +57,7 @@ name(void)
|
||||||
}
|
}
|
||||||
if (!snxtitem(&nb, EF_SHIP, player->argp[1]))
|
if (!snxtitem(&nb, EF_SHIP, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
while (nxtitem(&nb, (s_char *)&ship)) {
|
while (nxtitem(&nb, &ship)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
p = getstarg(player->argp[2], "Name? ", buf);
|
p = getstarg(player->argp[2], "Name? ", buf);
|
||||||
|
|
|
@ -237,20 +237,19 @@ nav_map(int x, int y, int show_designations)
|
||||||
if (!snxtsct(&ns, what))
|
if (!snxtsct(&ns, what))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if (!wmapbuf)
|
if (!wmapbuf)
|
||||||
wmapbuf =
|
wmapbuf = malloc((WORLD_Y * MAPWIDTH(1)) * sizeof(s_char));
|
||||||
(s_char *)malloc((WORLD_Y * MAPWIDTH(1)) * sizeof(s_char));
|
|
||||||
if (!wmap) {
|
if (!wmap) {
|
||||||
wmap = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
|
wmap = malloc(WORLD_Y * sizeof(s_char *));
|
||||||
if (wmap && wmapbuf) {
|
if (wmap && wmapbuf) {
|
||||||
for (i = 0; i < WORLD_Y; i++)
|
for (i = 0; i < WORLD_Y; i++)
|
||||||
wmap[i] = &wmapbuf[MAPWIDTH(1) * i];
|
wmap[i] = &wmapbuf[MAPWIDTH(1) * i];
|
||||||
} else if (wmap) {
|
} else if (wmap) {
|
||||||
free((s_char *)wmap);
|
free(wmap);
|
||||||
wmap = (s_char **)0;
|
wmap = (s_char **)0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!bitmap)
|
if (!bitmap)
|
||||||
bitmap = (u_char *)malloc((WORLD_X * WORLD_Y) / 8);
|
bitmap = malloc((WORLD_X * WORLD_Y) / 8);
|
||||||
if (!wmapbuf || !wmap || !bitmap) {
|
if (!wmapbuf || !wmap || !bitmap) {
|
||||||
pr("Memory error, tell the deity.\n");
|
pr("Memory error, tell the deity.\n");
|
||||||
logerror("malloc failed in navi\n");
|
logerror("malloc failed in navi\n");
|
||||||
|
|
|
@ -59,7 +59,7 @@ ndump(void)
|
||||||
pr("own ");
|
pr("own ");
|
||||||
pr("id x y num type\n");
|
pr("id x y num type\n");
|
||||||
nnukes = 0;
|
nnukes = 0;
|
||||||
while (nxtitem(&nstr, (s_char *)&nuk)) {
|
while (nxtitem(&nstr, &nuk)) {
|
||||||
if (!player->god && !player->owner)
|
if (!player->god && !player->owner)
|
||||||
continue;
|
continue;
|
||||||
if (nuk.nuk_own == 0)
|
if (nuk.nuk_own == 0)
|
||||||
|
|
|
@ -229,14 +229,14 @@ isok(int x, int y)
|
||||||
|
|
||||||
nmin = ngold = noil = nur = 0;
|
nmin = ngold = noil = nur = 0;
|
||||||
navail = nfree = nowned = 0;
|
navail = nfree = nowned = 0;
|
||||||
if ((map = (s_char *)malloc((WORLD_X * WORLD_Y) / 2)) == 0) {
|
if ((map = malloc((WORLD_X * WORLD_Y) / 2)) == 0) {
|
||||||
logerror("malloc failed in isok\n");
|
logerror("malloc failed in isok\n");
|
||||||
pr("Memory error. Tell the deity.\n");
|
pr("Memory error. Tell the deity.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
memset(map, 0, (WORLD_X * WORLD_Y) / 2);
|
memset(map, 0, (WORLD_X * WORLD_Y) / 2);
|
||||||
ok(map, x, y);
|
ok(map, x, y);
|
||||||
free((s_char *)map);
|
free(map);
|
||||||
if (nfree < 5)
|
if (nfree < 5)
|
||||||
return 0;
|
return 0;
|
||||||
pr("Cap at %s; owned sectors: %d, free sectors: %d, avail: %d\n",
|
pr("Cap at %s; owned sectors: %d, free sectors: %d, avail: %d\n",
|
||||||
|
@ -261,7 +261,7 @@ ok(s_char *map, int x, int y)
|
||||||
id = sctoff(x, y);
|
id = sctoff(x, y);
|
||||||
if (map[id])
|
if (map[id])
|
||||||
return;
|
return;
|
||||||
if (!ef_read(EF_SECTOR, id, (s_char *)§))
|
if (!ef_read(EF_SECTOR, id, §))
|
||||||
return;
|
return;
|
||||||
if (sect.sct_type == SCT_WATER || sect.sct_type == SCT_BSPAN)
|
if (sect.sct_type == SCT_WATER || sect.sct_type == SCT_BSPAN)
|
||||||
return;
|
return;
|
||||||
|
@ -302,7 +302,7 @@ deity_build_land(int type, coord x, coord y, natid own, int tlev)
|
||||||
natp = getnatp(own);
|
natp = getnatp(own);
|
||||||
|
|
||||||
snxtitem_all(&nstr, EF_LAND);
|
snxtitem_all(&nstr, EF_LAND);
|
||||||
while (nxtitem(&nstr, (s_char *)&land)) {
|
while (nxtitem(&nstr, &land)) {
|
||||||
if (land.lnd_own == 0) {
|
if (land.lnd_own == 0) {
|
||||||
extend = 0;
|
extend = 0;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -89,7 +89,7 @@ news(void)
|
||||||
then = now - days(3);
|
then = now - days(3);
|
||||||
*/
|
*/
|
||||||
pr("\nThe details of Empire news since %s", ctime(&then));
|
pr("\nThe details of Empire news since %s", ctime(&then));
|
||||||
while (nxtitem(&nstr, (s_char *)&nws)) {
|
while (nxtitem(&nstr, &nws)) {
|
||||||
if (nws.nws_when < then)
|
if (nws.nws_when < then)
|
||||||
continue;
|
continue;
|
||||||
if (opt_HIDDEN) {
|
if (opt_HIDDEN) {
|
||||||
|
@ -106,7 +106,7 @@ news(void)
|
||||||
continue;
|
continue;
|
||||||
pr("\n\t === %s ===\n", page_headings[page]);
|
pr("\n\t === %s ===\n", page_headings[page]);
|
||||||
snxtitem_rewind(&nstr);
|
snxtitem_rewind(&nstr);
|
||||||
while (nxtitem(&nstr, (s_char *)&nws)) {
|
while (nxtitem(&nstr, &nws)) {
|
||||||
if (rpt[(int)nws.nws_vrb].r_newspage != page)
|
if (rpt[(int)nws.nws_vrb].r_newspage != page)
|
||||||
continue;
|
continue;
|
||||||
if (nws.nws_when < then)
|
if (nws.nws_when < then)
|
||||||
|
|
|
@ -55,7 +55,7 @@ nuke(void)
|
||||||
if (!snxtitem(&nstr, EF_NUKE, player->argp[1]))
|
if (!snxtitem(&nstr, EF_NUKE, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
||||||
while (nxtitem(&nstr, (s_char *)&nuk)) {
|
while (nxtitem(&nstr, &nuk)) {
|
||||||
if (!player->god && !player->owner)
|
if (!player->god && !player->owner)
|
||||||
continue;
|
continue;
|
||||||
if (nuk.nuk_own == 0)
|
if (nuk.nuk_own == 0)
|
||||||
|
|
|
@ -135,7 +135,7 @@ do_treaty(void)
|
||||||
}
|
}
|
||||||
(void)time(&now);
|
(void)time(&now);
|
||||||
snxtitem_all(&nstr, EF_TREATY);
|
snxtitem_all(&nstr, EF_TREATY);
|
||||||
while (nxtitem(&nstr, (s_char *)&trty)) {
|
while (nxtitem(&nstr, &trty)) {
|
||||||
if (trty.trt_status == TS_FREE) {
|
if (trty.trt_status == TS_FREE) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ do_loan(void)
|
||||||
if (irate < 5)
|
if (irate < 5)
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
snxtitem_all(&nstr, EF_LOAN);
|
snxtitem_all(&nstr, EF_LOAN);
|
||||||
while (nxtitem(&nstr, (s_char *)&loan)) {
|
while (nxtitem(&nstr, &loan)) {
|
||||||
if ((loan.l_status == LS_SIGNED) && (loan.l_lonee == player->cnum)
|
if ((loan.l_status == LS_SIGNED) && (loan.l_lonee == player->cnum)
|
||||||
&& (loan.l_loner == recipient)) {
|
&& (loan.l_loner == recipient)) {
|
||||||
pr("You already owe HIM money - how about repaying your loan?\n");
|
pr("You already owe HIM money - how about repaying your loan?\n");
|
||||||
|
@ -220,7 +220,7 @@ do_loan(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
snxtitem_all(&nstr, EF_LOAN);
|
snxtitem_all(&nstr, EF_LOAN);
|
||||||
while (nxtitem(&nstr, (s_char *)&loan)) {
|
while (nxtitem(&nstr, &loan)) {
|
||||||
if (loan.l_status == LS_FREE)
|
if (loan.l_status == LS_FREE)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ orde(void)
|
||||||
|
|
||||||
if (!snxtitem(&nb, EF_SHIP, player->argp[1]))
|
if (!snxtitem(&nb, EF_SHIP, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
while (!player->aborted && nxtitem(&nb, (s_char *)(&ship))) {
|
while (!player->aborted && nxtitem(&nb, (&ship))) {
|
||||||
if (!player->owner || ship.shp_own == 0)
|
if (!player->owner || ship.shp_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
||||||
|
@ -370,7 +370,7 @@ qorde(void)
|
||||||
|
|
||||||
if (!snxtitem(&nb, EF_SHIP, player->argp[1]))
|
if (!snxtitem(&nb, EF_SHIP, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
while (nxtitem(&nb, (s_char *)(&ship))) {
|
while (nxtitem(&nb, (&ship))) {
|
||||||
if (!player->owner || ship.shp_own == 0)
|
if (!player->owner || ship.shp_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
||||||
|
@ -444,7 +444,7 @@ sorde(void)
|
||||||
|
|
||||||
if (!snxtitem(&nb, EF_SHIP, player->argp[1]))
|
if (!snxtitem(&nb, EF_SHIP, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
while (nxtitem(&nb, (s_char *)(&ship))) {
|
while (nxtitem(&nb, (&ship))) {
|
||||||
if (!player->owner || ship.shp_own == 0)
|
if (!player->owner || ship.shp_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
||||||
|
|
|
@ -80,15 +80,14 @@ path(void)
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
if (!mapbuf)
|
if (!mapbuf)
|
||||||
mapbuf =
|
mapbuf = malloc((WORLD_Y * MAPWIDTH(3)) * sizeof(s_char));
|
||||||
(s_char *)malloc((WORLD_Y * MAPWIDTH(3)) * sizeof(s_char));
|
|
||||||
if (!map) {
|
if (!map) {
|
||||||
map = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
|
map = malloc(WORLD_Y * sizeof(s_char *));
|
||||||
if (map && mapbuf) {
|
if (map && mapbuf) {
|
||||||
for (i = 0; i < WORLD_Y; i++)
|
for (i = 0; i < WORLD_Y; i++)
|
||||||
map[i] = &mapbuf[MAPWIDTH(3) * i];
|
map[i] = &mapbuf[MAPWIDTH(3) * i];
|
||||||
} else if (map) {
|
} else if (map) {
|
||||||
free((s_char *)map);
|
free(map);
|
||||||
map = (s_char **)0;
|
map = (s_char **)0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ payo(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
||||||
nships = 0;
|
nships = 0;
|
||||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
while (nxtitem(&ni, &ship)) {
|
||||||
if (!player->owner || ship.shp_own == 0)
|
if (!player->owner || ship.shp_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ pboa(void)
|
||||||
|
|
||||||
if (!snxtitem(&np, EF_PLANE, player->argp[1]))
|
if (!snxtitem(&np, EF_PLANE, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
while (nxtitem(&np, (s_char *)&plane)) {
|
while (nxtitem(&np, &plane)) {
|
||||||
getsect(plane.pln_x, plane.pln_y, §);
|
getsect(plane.pln_x, plane.pln_y, §);
|
||||||
if (sect.sct_own != player->cnum)
|
if (sect.sct_own != player->cnum)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -200,7 +200,7 @@ pdump(void)
|
||||||
|
|
||||||
nplanes = 0;
|
nplanes = 0;
|
||||||
natp = getnatp(player->cnum);
|
natp = getnatp(player->cnum);
|
||||||
while (nxtitem(&np, (s_char *)&plane)) {
|
while (nxtitem(&np, &plane)) {
|
||||||
if (!player->owner || plane.pln_own == 0)
|
if (!player->owner || plane.pln_own == 0)
|
||||||
continue;
|
continue;
|
||||||
nplanes++;
|
nplanes++;
|
||||||
|
|
|
@ -51,7 +51,7 @@ plan(void)
|
||||||
if (!snxtitem(&np, EF_PLANE, player->argp[1]))
|
if (!snxtitem(&np, EF_PLANE, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
nplanes = 0;
|
nplanes = 0;
|
||||||
while (nxtitem(&np, (s_char *)&plane)) {
|
while (nxtitem(&np, &plane)) {
|
||||||
if (!player->owner || plane.pln_own == 0)
|
if (!player->owner || plane.pln_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (nplanes++ == 0) {
|
if (nplanes++ == 0) {
|
||||||
|
|
|
@ -124,7 +124,7 @@ powe(void)
|
||||||
|
|
||||||
if (!power_generated) {
|
if (!power_generated) {
|
||||||
snxtitem_all(&ni, EF_POWER);
|
snxtitem_all(&ni, EF_POWER);
|
||||||
if (!nxtitem(&ni, (s_char *)&pow)) {
|
if (!nxtitem(&ni, &pow)) {
|
||||||
pr("Power for this game has not been built yet. Type 'power new' to build it.\n");
|
pr("Power for this game has not been built yet. Type 'power new' to build it.\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ powe(void)
|
||||||
pr(" as of %s\n sects eff civ", ctime(&pow_time));
|
pr(" as of %s\n sects eff civ", ctime(&pow_time));
|
||||||
pr(" mil shell gun pet iron dust oil pln ship unit money\n");
|
pr(" mil shell gun pet iron dust oil pln ship unit money\n");
|
||||||
snxtitem_all(&ni, EF_POWER);
|
snxtitem_all(&ni, EF_POWER);
|
||||||
while ((nxtitem(&ni, (s_char *)&pow)) && num > 0) {
|
while ((nxtitem(&ni, &pow)) && num > 0) {
|
||||||
if (pow.p_nation == 0 || pow.p_power <= 0.0)
|
if (pow.p_nation == 0 || pow.p_power <= 0.0)
|
||||||
continue;
|
continue;
|
||||||
if (opt_HIDDEN) {
|
if (opt_HIDDEN) {
|
||||||
|
@ -251,7 +251,7 @@ gen_power(void)
|
||||||
addtopow(sect.sct_item, pow);
|
addtopow(sect.sct_item, pow);
|
||||||
}
|
}
|
||||||
snxtitem_all(&ni, EF_LAND);
|
snxtitem_all(&ni, EF_LAND);
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (land.lnd_own == 0)
|
if (land.lnd_own == 0)
|
||||||
continue;
|
continue;
|
||||||
pow = &powbuf[land.lnd_own];
|
pow = &powbuf[land.lnd_own];
|
||||||
|
@ -262,7 +262,7 @@ gen_power(void)
|
||||||
pow->p_units += 1.0;
|
pow->p_units += 1.0;
|
||||||
}
|
}
|
||||||
snxtitem_all(&ni, EF_SHIP);
|
snxtitem_all(&ni, EF_SHIP);
|
||||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
while (nxtitem(&ni, &ship)) {
|
||||||
if (ship.shp_own == 0)
|
if (ship.shp_own == 0)
|
||||||
continue;
|
continue;
|
||||||
pow = &powbuf[ship.shp_own];
|
pow = &powbuf[ship.shp_own];
|
||||||
|
@ -273,7 +273,7 @@ gen_power(void)
|
||||||
pow->p_ships += 1.0;
|
pow->p_ships += 1.0;
|
||||||
}
|
}
|
||||||
snxtitem_all(&ni, EF_PLANE);
|
snxtitem_all(&ni, EF_PLANE);
|
||||||
while (nxtitem(&ni, (s_char *)&plane)) {
|
while (nxtitem(&ni, &plane)) {
|
||||||
if (plane.pln_own == 0)
|
if (plane.pln_own == 0)
|
||||||
continue;
|
continue;
|
||||||
pow = &powbuf[plane.pln_own];
|
pow = &powbuf[plane.pln_own];
|
||||||
|
|
|
@ -49,7 +49,7 @@ pstat(void)
|
||||||
if (!snxtitem(&np, EF_PLANE, player->argp[1]))
|
if (!snxtitem(&np, EF_PLANE, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
nplanes = 0;
|
nplanes = 0;
|
||||||
while (nxtitem(&np, (s_char *)&plane)) {
|
while (nxtitem(&np, &plane)) {
|
||||||
if (!player->owner || plane.pln_own == 0)
|
if (!player->owner || plane.pln_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (plane.pln_type < 0 || plane.pln_type > pln_maxno) {
|
if (plane.pln_type < 0 || plane.pln_type > pln_maxno) {
|
||||||
|
|
|
@ -94,7 +94,7 @@ rada(void)
|
||||||
pr("Specify at least one ship\n");
|
pr("Specify at least one ship\n");
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
}
|
}
|
||||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
while (nxtitem(&ni, &ship)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
if (mchr[(int)ship.shp_type].m_flags & M_SONAR)
|
if (mchr[(int)ship.shp_type].m_flags & M_SONAR)
|
||||||
|
@ -117,7 +117,7 @@ rada(void)
|
||||||
pr("Specify at least one unit\n");
|
pr("Specify at least one unit\n");
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
}
|
}
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
if (!(lchr[(int)land.lnd_type].l_flags & L_RADAR)) {
|
if (!(lchr[(int)land.lnd_type].l_flags & L_RADAR)) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ range(void)
|
||||||
|
|
||||||
if (!snxtitem(&np, EF_PLANE, player->argp[1]))
|
if (!snxtitem(&np, EF_PLANE, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
while (nxtitem(&np, (s_char *)&plane)) {
|
while (nxtitem(&np, &plane)) {
|
||||||
if (!player->owner || plane.pln_own == 0)
|
if (!player->owner || plane.pln_own == 0)
|
||||||
continue;
|
continue;
|
||||||
p = getstarg(player->argp[2], "New range? ", buf);
|
p = getstarg(player->argp[2], "New range? ", buf);
|
||||||
|
@ -82,7 +82,7 @@ lrange(void)
|
||||||
|
|
||||||
if (!snxtitem(&np, EF_LAND, player->argp[1]))
|
if (!snxtitem(&np, EF_LAND, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
while (nxtitem(&np, (s_char *)&land)) {
|
while (nxtitem(&np, &land)) {
|
||||||
if (!player->owner || land.lnd_own == 0)
|
if (!player->owner || land.lnd_own == 0)
|
||||||
continue;
|
continue;
|
||||||
lcp = &lchr[(int)land.lnd_type];
|
lcp = &lchr[(int)land.lnd_type];
|
||||||
|
|
|
@ -117,7 +117,7 @@ rea(void)
|
||||||
lastdate = 0;
|
lastdate = 0;
|
||||||
lastcnum = -1;
|
lastcnum = -1;
|
||||||
lasttype = -1;
|
lasttype = -1;
|
||||||
while (fread((s_char *)&tgm, sizeof(tgm), 1, telfp) == 1) {
|
while (fread(&tgm, sizeof(tgm), 1, telfp) == 1) {
|
||||||
readit = 1;
|
readit = 1;
|
||||||
if (tgm.tel_length < 0) {
|
if (tgm.tel_length < 0) {
|
||||||
logerror("bad telegram file header in %s", mbox);
|
logerror("bad telegram file header in %s", mbox);
|
||||||
|
|
|
@ -86,7 +86,7 @@ reje(void)
|
||||||
}
|
}
|
||||||
if (!snxtitem(&ni, EF_NATION, player->argp[3]))
|
if (!snxtitem(&ni, EF_NATION, player->argp[3]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
while (nxtitem(&ni, (s_char *)&nat)) {
|
while (nxtitem(&ni, &nat)) {
|
||||||
#if 0
|
#if 0
|
||||||
if ((nat.nat_stat & STAT_NORM) == 0) {
|
if ((nat.nat_stat & STAT_NORM) == 0) {
|
||||||
pr("You may not reject/accept stuff from %s\nbecause they are not a normal country.\n", nat.nat_cnam);
|
pr("You may not reject/accept stuff from %s\nbecause they are not a normal country.\n", nat.nat_cnam);
|
||||||
|
|
|
@ -88,7 +88,7 @@ repo(void)
|
||||||
} else {
|
} else {
|
||||||
first = 1;
|
first = 1;
|
||||||
}
|
}
|
||||||
while (nxtitem(&ni, (s_char *)&nat)) {
|
while (nxtitem(&ni, &nat)) {
|
||||||
if (!(nat.nat_stat & STAT_INUSE))
|
if (!(nat.nat_stat & STAT_INUSE))
|
||||||
continue;
|
continue;
|
||||||
if (opt_HIDDEN) {
|
if (opt_HIDDEN) {
|
||||||
|
|
|
@ -132,7 +132,7 @@ retr(void)
|
||||||
if (zero)
|
if (zero)
|
||||||
rflags = 0;
|
rflags = 0;
|
||||||
|
|
||||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
while (nxtitem(&ni, &ship)) {
|
||||||
if (!player->owner || ship.shp_own == 0)
|
if (!player->owner || ship.shp_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
||||||
|
@ -261,7 +261,7 @@ lretr(void)
|
||||||
if (zero)
|
if (zero)
|
||||||
rflags = 0;
|
rflags = 0;
|
||||||
|
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (!player->owner || land.lnd_own == 0)
|
if (!player->owner || land.lnd_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (land.lnd_type < 0 || land.lnd_type > lnd_maxno) {
|
if (land.lnd_type < 0 || land.lnd_type > lnd_maxno) {
|
||||||
|
|
|
@ -88,20 +88,19 @@ rout(void)
|
||||||
} else if (!snxtsct(&ns, str))
|
} else if (!snxtsct(&ns, str))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if (!mapbuf)
|
if (!mapbuf)
|
||||||
mapbuf =
|
mapbuf = malloc((WORLD_Y * MAPWIDTH(3)) * sizeof(s_char));
|
||||||
(s_char *)malloc((WORLD_Y * MAPWIDTH(3)) * sizeof(s_char));
|
|
||||||
if (!map) {
|
if (!map) {
|
||||||
map = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
|
map = malloc(WORLD_Y * sizeof(s_char *));
|
||||||
if (map && mapbuf) {
|
if (map && mapbuf) {
|
||||||
for (i = 0; i < WORLD_Y; i++)
|
for (i = 0; i < WORLD_Y; i++)
|
||||||
map[i] = &mapbuf[MAPWIDTH(3) * i];
|
map[i] = &mapbuf[MAPWIDTH(3) * i];
|
||||||
} else if (map) {
|
} else if (map) {
|
||||||
free((s_char *)map);
|
free(map);
|
||||||
map = (s_char **)0;
|
map = (s_char **)0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!buf)
|
if (!buf)
|
||||||
buf = (s_char *)malloc((MAPWIDTH(3) + 12) * sizeof(s_char));
|
buf = malloc((MAPWIDTH(3) + 12) * sizeof(s_char));
|
||||||
if (!mapbuf || !map || !buf) {
|
if (!mapbuf || !map || !buf) {
|
||||||
pr("Memory error, tell the deity.\n");
|
pr("Memory error, tell the deity.\n");
|
||||||
logerror("malloc failed in rout\n");
|
logerror("malloc failed in rout\n");
|
||||||
|
|
|
@ -49,7 +49,7 @@ sabo(void)
|
||||||
if (!snxtitem(&ni, EF_LAND, player->argp[1]))
|
if (!snxtitem(&ni, EF_LAND, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
if (!(lchr[(int)land.lnd_type].l_flags & L_SPY)) {
|
if (!(lchr[(int)land.lnd_type].l_flags & L_SPY)) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ show_sail(struct nstr_item *nstr)
|
||||||
int count = 0;
|
int count = 0;
|
||||||
struct shpstr ship;
|
struct shpstr ship;
|
||||||
|
|
||||||
while (nxtitem(nstr, (s_char *)&ship)) {
|
while (nxtitem(nstr, &ship)) {
|
||||||
if (!player->owner || ship.shp_own == 0)
|
if (!player->owner || ship.shp_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
||||||
|
@ -100,7 +100,7 @@ cmd_unsail_ship(struct nstr_item *nstr)
|
||||||
struct shpstr ship;
|
struct shpstr ship;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
while (nxtitem(nstr, (s_char *)&ship)) {
|
while (nxtitem(nstr, &ship)) {
|
||||||
if (!player->owner || ship.shp_own == 0)
|
if (!player->owner || ship.shp_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
||||||
|
@ -124,7 +124,7 @@ cmd_sail_ship(struct nstr_item *nstr)
|
||||||
struct shpstr ship;
|
struct shpstr ship;
|
||||||
char navpath[MAX_PATH_LEN];
|
char navpath[MAX_PATH_LEN];
|
||||||
|
|
||||||
while (!player->aborted && nxtitem(nstr, (s_char *)&ship)) {
|
while (!player->aborted && nxtitem(nstr, &ship)) {
|
||||||
if (!player->owner || ship.shp_own == 0)
|
if (!player->owner || ship.shp_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
||||||
|
|
|
@ -136,7 +136,7 @@ scra(void)
|
||||||
if (!confirm(y_or_n))
|
if (!confirm(y_or_n))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
while (nxtitem(&ni, (s_char *)&item)) {
|
while (nxtitem(&ni, &item)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ scra(void)
|
||||||
sect.sct_item[I_HCM] += mp->m_hcm * 2 / 3 * eff;
|
sect.sct_item[I_HCM] += mp->m_hcm * 2 / 3 * eff;
|
||||||
getsect(item.ship.shp_x, item.ship.shp_y, §2);
|
getsect(item.ship.shp_x, item.ship.shp_y, §2);
|
||||||
snxtitem_all(&ni2, EF_PLANE);
|
snxtitem_all(&ni2, EF_PLANE);
|
||||||
while (nxtitem(&ni2, (s_char *)&plane)) {
|
while (nxtitem(&ni2, &plane)) {
|
||||||
if (plane.pln_own == 0)
|
if (plane.pln_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (plane.pln_ship == item.ship.shp_uid) {
|
if (plane.pln_ship == item.ship.shp_uid) {
|
||||||
|
@ -214,11 +214,11 @@ scra(void)
|
||||||
plane.pln_own = sect2.sct_own;
|
plane.pln_own = sect2.sct_own;
|
||||||
makenotlost(EF_PLANE, plane.pln_own, plane.pln_uid,
|
makenotlost(EF_PLANE, plane.pln_own, plane.pln_uid,
|
||||||
plane.pln_x, plane.pln_y);
|
plane.pln_x, plane.pln_y);
|
||||||
putplane(plane.pln_uid, (s_char *)&plane);
|
putplane(plane.pln_uid, &plane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
snxtitem_all(&ni2, EF_LAND);
|
snxtitem_all(&ni2, EF_LAND);
|
||||||
while (nxtitem(&ni2, (s_char *)&land)) {
|
while (nxtitem(&ni2, &land)) {
|
||||||
if (land.lnd_own == 0)
|
if (land.lnd_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (land.lnd_ship == item.ship.shp_uid) {
|
if (land.lnd_ship == item.ship.shp_uid) {
|
||||||
|
@ -240,13 +240,13 @@ scra(void)
|
||||||
land.lnd_own = sect2.sct_own;
|
land.lnd_own = sect2.sct_own;
|
||||||
makenotlost(EF_LAND, land.lnd_own, land.lnd_uid,
|
makenotlost(EF_LAND, land.lnd_own, land.lnd_uid,
|
||||||
land.lnd_x, land.lnd_y);
|
land.lnd_x, land.lnd_y);
|
||||||
putland(land.lnd_uid, (s_char *)&land);
|
putland(land.lnd_uid, &land);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
makelost(EF_SHIP, item.ship.shp_own, item.ship.shp_uid,
|
makelost(EF_SHIP, item.ship.shp_own, item.ship.shp_uid,
|
||||||
item.ship.shp_x, item.ship.shp_y);
|
item.ship.shp_x, item.ship.shp_y);
|
||||||
item.ship.shp_own = 0;
|
item.ship.shp_own = 0;
|
||||||
putship(item.ship.shp_uid, (s_char *)&item.ship);
|
putship(item.ship.shp_uid, &item.ship);
|
||||||
} else if (type == EF_LAND) {
|
} else if (type == EF_LAND) {
|
||||||
eff = ((float)item.land.lnd_effic / 100.0);
|
eff = ((float)item.land.lnd_effic / 100.0);
|
||||||
lp = &lchr[(int)item.land.lnd_type];
|
lp = &lchr[(int)item.land.lnd_type];
|
||||||
|
@ -259,7 +259,7 @@ scra(void)
|
||||||
getsect(item.land.lnd_x, item.land.lnd_y, §2);
|
getsect(item.land.lnd_x, item.land.lnd_y, §2);
|
||||||
|
|
||||||
snxtitem_all(&ni2, EF_LAND);
|
snxtitem_all(&ni2, EF_LAND);
|
||||||
while (nxtitem(&ni2, (s_char *)&land)) {
|
while (nxtitem(&ni2, &land)) {
|
||||||
if (land.lnd_own == 0)
|
if (land.lnd_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (land.lnd_land == item.land.lnd_uid) {
|
if (land.lnd_land == item.land.lnd_uid) {
|
||||||
|
@ -281,12 +281,12 @@ scra(void)
|
||||||
land.lnd_own = sect2.sct_own;
|
land.lnd_own = sect2.sct_own;
|
||||||
makenotlost(EF_LAND, land.lnd_own, land.lnd_uid,
|
makenotlost(EF_LAND, land.lnd_own, land.lnd_uid,
|
||||||
land.lnd_x, land.lnd_y);
|
land.lnd_x, land.lnd_y);
|
||||||
putland(land.lnd_uid, (s_char *)&land);
|
putland(land.lnd_uid, &land);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
snxtitem_all(&ni2, EF_PLANE);
|
snxtitem_all(&ni2, EF_PLANE);
|
||||||
while (nxtitem(&ni2, (s_char *)&plane)) {
|
while (nxtitem(&ni2, &plane)) {
|
||||||
if (plane.pln_own == 0)
|
if (plane.pln_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (plane.pln_land == item.land.lnd_uid) {
|
if (plane.pln_land == item.land.lnd_uid) {
|
||||||
|
@ -308,13 +308,13 @@ scra(void)
|
||||||
plane.pln_own = sect2.sct_own;
|
plane.pln_own = sect2.sct_own;
|
||||||
makenotlost(EF_PLANE, plane.pln_own, plane.pln_uid,
|
makenotlost(EF_PLANE, plane.pln_own, plane.pln_uid,
|
||||||
plane.pln_x, plane.pln_y);
|
plane.pln_x, plane.pln_y);
|
||||||
putplane(plane.pln_uid, (s_char *)&plane);
|
putplane(plane.pln_uid, &plane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
makelost(EF_LAND, item.land.lnd_own, item.land.lnd_uid,
|
makelost(EF_LAND, item.land.lnd_own, item.land.lnd_uid,
|
||||||
item.land.lnd_x, item.land.lnd_y);
|
item.land.lnd_x, item.land.lnd_y);
|
||||||
item.land.lnd_own = 0;
|
item.land.lnd_own = 0;
|
||||||
putland(item.land.lnd_uid, (s_char *)&item.land);
|
putland(item.land.lnd_uid, &item.land);
|
||||||
} else {
|
} else {
|
||||||
eff = ((float)item.land.lnd_effic / 100.0);
|
eff = ((float)item.land.lnd_effic / 100.0);
|
||||||
pp = &plchr[(int)item.plane.pln_type];
|
pp = &plchr[(int)item.plane.pln_type];
|
||||||
|
@ -325,7 +325,7 @@ scra(void)
|
||||||
makelost(EF_PLANE, item.plane.pln_own, item.plane.pln_uid,
|
makelost(EF_PLANE, item.plane.pln_own, item.plane.pln_uid,
|
||||||
item.plane.pln_x, item.plane.pln_y);
|
item.plane.pln_x, item.plane.pln_y);
|
||||||
item.plane.pln_own = 0;
|
item.plane.pln_own = 0;
|
||||||
putplane(item.plane.pln_uid, (s_char *)&item.plane);
|
putplane(item.plane.pln_uid, &item.plane);
|
||||||
}
|
}
|
||||||
pr(" scrapped in %s\n",
|
pr(" scrapped in %s\n",
|
||||||
xyas(sect.sct_x, sect.sct_y, player->cnum));
|
xyas(sect.sct_x, sect.sct_y, player->cnum));
|
||||||
|
|
|
@ -203,7 +203,7 @@ scut(void)
|
||||||
if (!confirm(y_or_n))
|
if (!confirm(y_or_n))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
while (nxtitem(&ni, (s_char *)&item)) {
|
while (nxtitem(&ni, &item)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
if (opt_MARKET) {
|
if (opt_MARKET) {
|
||||||
|
@ -241,7 +241,7 @@ scut(void)
|
||||||
makelost(EF_PLANE, item.plane.pln_own, item.plane.pln_uid,
|
makelost(EF_PLANE, item.plane.pln_own, item.plane.pln_uid,
|
||||||
item.plane.pln_x, item.plane.pln_y);
|
item.plane.pln_x, item.plane.pln_y);
|
||||||
item.plane.pln_own = 0;
|
item.plane.pln_own = 0;
|
||||||
putplane(item.plane.pln_uid, (s_char *)&item.plane);
|
putplane(item.plane.pln_uid, &item.plane);
|
||||||
}
|
}
|
||||||
pr(" scuttled in %s\n",
|
pr(" scuttled in %s\n",
|
||||||
xyas(item.ship.shp_x, item.ship.shp_y, player->cnum));
|
xyas(item.ship.shp_x, item.ship.shp_y, player->cnum));
|
||||||
|
@ -260,7 +260,7 @@ scuttle_ship(struct shpstr *sp)
|
||||||
|
|
||||||
getsect(sp->shp_x, sp->shp_y, §);
|
getsect(sp->shp_x, sp->shp_y, §);
|
||||||
snxtitem_all(&ni, EF_PLANE);
|
snxtitem_all(&ni, EF_PLANE);
|
||||||
while (nxtitem(&ni, (s_char *)&plane)) {
|
while (nxtitem(&ni, &plane)) {
|
||||||
if (plane.pln_own == 0)
|
if (plane.pln_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (plane.pln_ship == sp->shp_uid) {
|
if (plane.pln_ship == sp->shp_uid) {
|
||||||
|
@ -278,11 +278,11 @@ scuttle_ship(struct shpstr *sp)
|
||||||
plane.pln_uid, sp->shp_uid,
|
plane.pln_uid, sp->shp_uid,
|
||||||
xyas(plane.pln_x, plane.pln_y, plane.pln_own));
|
xyas(plane.pln_x, plane.pln_y, plane.pln_own));
|
||||||
}
|
}
|
||||||
putplane(plane.pln_uid, (s_char *)&plane);
|
putplane(plane.pln_uid, &plane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
snxtitem_all(&ni, EF_LAND);
|
snxtitem_all(&ni, EF_LAND);
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (land.lnd_own == 0)
|
if (land.lnd_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (land.lnd_ship == sp->shp_uid) {
|
if (land.lnd_ship == sp->shp_uid) {
|
||||||
|
@ -292,7 +292,7 @@ scuttle_ship(struct shpstr *sp)
|
||||||
"Land unit %d transferred off ship %d to %s\n",
|
"Land unit %d transferred off ship %d to %s\n",
|
||||||
land.lnd_uid, sp->shp_uid,
|
land.lnd_uid, sp->shp_uid,
|
||||||
xyas(land.lnd_x, land.lnd_y, land.lnd_own));
|
xyas(land.lnd_x, land.lnd_y, land.lnd_own));
|
||||||
putland(land.lnd_uid, (s_char *)&land);
|
putland(land.lnd_uid, &land);
|
||||||
} else
|
} else
|
||||||
scuttle_land(&land);
|
scuttle_land(&land);
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ scuttle_land(struct lndstr *lp)
|
||||||
|
|
||||||
getsect(lp->lnd_x, lp->lnd_y, §);
|
getsect(lp->lnd_x, lp->lnd_y, §);
|
||||||
snxtitem_all(&ni, EF_PLANE);
|
snxtitem_all(&ni, EF_PLANE);
|
||||||
while (nxtitem(&ni, (s_char *)&plane)) {
|
while (nxtitem(&ni, &plane)) {
|
||||||
if (plane.pln_own == 0)
|
if (plane.pln_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (plane.pln_land == lp->lnd_uid) {
|
if (plane.pln_land == lp->lnd_uid) {
|
||||||
|
@ -330,11 +330,11 @@ scuttle_land(struct lndstr *lp)
|
||||||
plane.pln_uid, lp->lnd_uid,
|
plane.pln_uid, lp->lnd_uid,
|
||||||
xyas(plane.pln_x, plane.pln_y, plane.pln_own));
|
xyas(plane.pln_x, plane.pln_y, plane.pln_own));
|
||||||
}
|
}
|
||||||
putplane(plane.pln_uid, (s_char *)&plane);
|
putplane(plane.pln_uid, &plane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
snxtitem_all(&ni, EF_LAND);
|
snxtitem_all(&ni, EF_LAND);
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (land.lnd_own == 0)
|
if (land.lnd_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (land.lnd_land == lp->lnd_uid) {
|
if (land.lnd_land == lp->lnd_uid) {
|
||||||
|
@ -344,7 +344,7 @@ scuttle_land(struct lndstr *lp)
|
||||||
"Land unit %d transferred off unit %d to %s\n",
|
"Land unit %d transferred off unit %d to %s\n",
|
||||||
land.lnd_uid, lp->lnd_uid,
|
land.lnd_uid, lp->lnd_uid,
|
||||||
xyas(land.lnd_x, land.lnd_y, land.lnd_own));
|
xyas(land.lnd_x, land.lnd_y, land.lnd_own));
|
||||||
putland(land.lnd_uid, (s_char *)&land);
|
putland(land.lnd_uid, &land);
|
||||||
} else
|
} else
|
||||||
scuttle_land(&land);
|
scuttle_land(&land);
|
||||||
}
|
}
|
||||||
|
|
|
@ -264,7 +264,7 @@ sdump(void)
|
||||||
|
|
||||||
nships = 0;
|
nships = 0;
|
||||||
np = getnatp(player->cnum);
|
np = getnatp(player->cnum);
|
||||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
while (nxtitem(&ni, &ship)) {
|
||||||
if (!player->owner || ship.shp_own == 0)
|
if (!player->owner || ship.shp_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
||||||
|
|
|
@ -80,15 +80,14 @@ sct(void)
|
||||||
} else if (!snxtsct(&ns, str))
|
} else if (!snxtsct(&ns, str))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!mapbuf)
|
if (!mapbuf)
|
||||||
mapbuf =
|
mapbuf = malloc((WORLD_Y * MAPWIDTH(1)) * sizeof(s_char));
|
||||||
(s_char *)malloc((WORLD_Y * MAPWIDTH(1)) * sizeof(s_char));
|
|
||||||
if (!map) {
|
if (!map) {
|
||||||
map = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
|
map = malloc(WORLD_Y * sizeof(s_char *));
|
||||||
if (map && mapbuf) {
|
if (map && mapbuf) {
|
||||||
for (i = 0; i < WORLD_Y; i++)
|
for (i = 0; i < WORLD_Y; i++)
|
||||||
map[i] = &mapbuf[MAPWIDTH(1) * i];
|
map[i] = &mapbuf[MAPWIDTH(1) * i];
|
||||||
} else if (map) {
|
} else if (map) {
|
||||||
free((s_char *)map);
|
free(map);
|
||||||
map = (s_char **)0;
|
map = (s_char **)0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ set(void)
|
||||||
type = EF_LAND;
|
type = EF_LAND;
|
||||||
if (!snxtitem(&ni, type, player->argp[2]))
|
if (!snxtitem(&ni, type, player->argp[2]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
while (nxtitem(&ni, (char *)&item)) {
|
while (nxtitem(&ni, &item)) {
|
||||||
if (!player->owner && !player->god)
|
if (!player->owner && !player->god)
|
||||||
continue;
|
continue;
|
||||||
getsect(item.gen.trg_x, item.gen.trg_y, §);
|
getsect(item.gen.trg_x, item.gen.trg_y, §);
|
||||||
|
@ -113,7 +113,7 @@ set(void)
|
||||||
foundslot = -1;
|
foundslot = -1;
|
||||||
freeslot = -1;
|
freeslot = -1;
|
||||||
snxtitem_all(&ni_trade, EF_TRADE);
|
snxtitem_all(&ni_trade, EF_TRADE);
|
||||||
while (nxtitem(&ni_trade, (char *)&trade)) {
|
while (nxtitem(&ni_trade, &trade)) {
|
||||||
if (trade.trd_owner == 0)
|
if (trade.trd_owner == 0)
|
||||||
freeslot = ni_trade.cur;
|
freeslot = ni_trade.cur;
|
||||||
if (trade.trd_unitid == ni.cur && trade.trd_type == type) {
|
if (trade.trd_unitid == ni.cur && trade.trd_type == type) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ shi(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
||||||
nships = 0;
|
nships = 0;
|
||||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
while (nxtitem(&ni, &ship)) {
|
||||||
if (!player->owner || ship.shp_own == 0)
|
if (!player->owner || ship.shp_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
||||||
|
|
|
@ -80,7 +80,7 @@ shoo(void)
|
||||||
mil = sect.sct_item[I_MILIT];
|
mil = sect.sct_item[I_MILIT];
|
||||||
nsec = 0;
|
nsec = 0;
|
||||||
snxtitem_xy(&ni, EF_LAND, sect.sct_x, sect.sct_y);
|
snxtitem_xy(&ni, EF_LAND, sect.sct_x, sect.sct_y);
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
mil += total_mil(&land);
|
mil += total_mil(&land);
|
||||||
|
|
||||||
if (lchr[(int)land.lnd_type].l_flags & L_SECURITY) {
|
if (lchr[(int)land.lnd_type].l_flags & L_SECURITY) {
|
||||||
|
|
|
@ -74,9 +74,9 @@ skyw(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
for (i = 0; i < TSIZE; i++)
|
for (i = 0; i < TSIZE; i++)
|
||||||
list[i] = 0;
|
list[i] = 0;
|
||||||
skyp = (struct sky *)malloc(sizeof(*skyp));
|
skyp = malloc(sizeof(*skyp));
|
||||||
snxtitem_all(&ni, EF_PLANE);
|
snxtitem_all(&ni, EF_PLANE);
|
||||||
while (nxtitem(&ni, (s_char *)&skyp->s_sat)) {
|
while (nxtitem(&ni, &skyp->s_sat)) {
|
||||||
if (!skyp->s_sat.pln_own)
|
if (!skyp->s_sat.pln_own)
|
||||||
continue;
|
continue;
|
||||||
if (!(skyp->s_sat.pln_flags & PLN_LAUNCHED))
|
if (!(skyp->s_sat.pln_flags & PLN_LAUNCHED))
|
||||||
|
@ -86,11 +86,11 @@ skyw(void)
|
||||||
skyp->s_spotted = 0;
|
skyp->s_spotted = 0;
|
||||||
skyp->s_next = list[n];
|
skyp->s_next = list[n];
|
||||||
list[n] = skyp;
|
list[n] = skyp;
|
||||||
skyp = (struct sky *)malloc(sizeof(*skyp));
|
skyp = malloc(sizeof(*skyp));
|
||||||
nsat++;
|
nsat++;
|
||||||
}
|
}
|
||||||
/* get that last one! */
|
/* get that last one! */
|
||||||
free((s_char *)skyp);
|
free(skyp);
|
||||||
pr("- = [ Skywatch report for %s ] = -\n", cname(player->cnum));
|
pr("- = [ Skywatch report for %s ] = -\n", cname(player->cnum));
|
||||||
pr(" %18s%20s %s\n", "Country", "Satellite", "Location");
|
pr(" %18s%20s %s\n", "Country", "Satellite", "Location");
|
||||||
tech = tfact(player->cnum, 1.0);
|
tech = tfact(player->cnum, 1.0);
|
||||||
|
@ -126,7 +126,7 @@ skyw(void)
|
||||||
for (i = 0; i < TSIZE; i++) {
|
for (i = 0; i < TSIZE; i++) {
|
||||||
while (NULL != (skyp = list[i])) {
|
while (NULL != (skyp = list[i])) {
|
||||||
list[i] = skyp->s_next;
|
list[i] = skyp->s_next;
|
||||||
free((s_char *)skyp);
|
free(skyp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
|
@ -148,7 +148,7 @@ showsat(struct sky **skypp, int x, int y)
|
||||||
do {
|
do {
|
||||||
/* we delete it, we free it. */
|
/* we delete it, we free it. */
|
||||||
if (todelete) {
|
if (todelete) {
|
||||||
free((s_char *)todelete);
|
free(todelete);
|
||||||
todelete = 0;
|
todelete = 0;
|
||||||
}
|
}
|
||||||
if (skyp->s_sat.pln_x != x || skyp->s_sat.pln_y != y) {
|
if (skyp->s_sat.pln_x != x || skyp->s_sat.pln_y != y) {
|
||||||
|
@ -170,6 +170,6 @@ showsat(struct sky **skypp, int x, int y)
|
||||||
} while (NULL != (skyp = skyp->s_next));
|
} while (NULL != (skyp = skyp->s_next));
|
||||||
/* check that last one! */
|
/* check that last one! */
|
||||||
if (todelete)
|
if (todelete)
|
||||||
free((s_char *)todelete);
|
free(todelete);
|
||||||
return (nsat);
|
return (nsat);
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,30 +80,28 @@ sona(void)
|
||||||
if (!snxtitem(&ni, EF_SHIP, player->argp[1]))
|
if (!snxtitem(&ni, EF_SHIP, player->argp[1]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!radbuf)
|
if (!radbuf)
|
||||||
radbuf =
|
radbuf = malloc((WORLD_Y * (WORLD_X + 1)) * sizeof(s_char));
|
||||||
(s_char *)malloc((WORLD_Y * (WORLD_X + 1)) * sizeof(s_char));
|
|
||||||
if (!visbuf)
|
if (!visbuf)
|
||||||
visbuf =
|
visbuf = malloc((WORLD_Y * (WORLD_X + 1)) * sizeof(s_char));
|
||||||
(s_char *)malloc((WORLD_Y * (WORLD_X + 1)) * sizeof(s_char));
|
|
||||||
if (!rad) {
|
if (!rad) {
|
||||||
rad = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
|
rad = malloc(WORLD_Y * sizeof(s_char *));
|
||||||
if (rad && radbuf) {
|
if (rad && radbuf) {
|
||||||
for (x = 0; x < WORLD_Y; x++) {
|
for (x = 0; x < WORLD_Y; x++) {
|
||||||
rad[x] = &radbuf[(WORLD_X + 1) * x];
|
rad[x] = &radbuf[(WORLD_X + 1) * x];
|
||||||
}
|
}
|
||||||
} else if (rad) {
|
} else if (rad) {
|
||||||
free((s_char *)rad);
|
free(rad);
|
||||||
rad = (s_char **)0;
|
rad = (s_char **)0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!vis) {
|
if (!vis) {
|
||||||
vis = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
|
vis = malloc(WORLD_Y * sizeof(s_char *));
|
||||||
if (vis && visbuf) {
|
if (vis && visbuf) {
|
||||||
for (x = 0; x < WORLD_Y; x++) {
|
for (x = 0; x < WORLD_Y; x++) {
|
||||||
vis[x] = &visbuf[(WORLD_X + 1) * x];
|
vis[x] = &visbuf[(WORLD_X + 1) * x];
|
||||||
}
|
}
|
||||||
} else if (vis) {
|
} else if (vis) {
|
||||||
free((s_char *)vis);
|
free(vis);
|
||||||
vis = (s_char **)0;
|
vis = (s_char **)0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,7 +110,7 @@ sona(void)
|
||||||
logerror("malloc failed in sona\n");
|
logerror("malloc failed in sona\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
while (nxtitem(&ni, &ship)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
mcp = &mchr[(int)ship.shp_type];
|
mcp = &mchr[(int)ship.shp_type];
|
||||||
|
|
|
@ -99,7 +99,7 @@ spy(void)
|
||||||
* set up all the goodies we need later
|
* set up all the goodies we need later
|
||||||
* 6 = neighbors, 2 = x,y
|
* 6 = neighbors, 2 = x,y
|
||||||
*/
|
*/
|
||||||
table = (coord *)malloc((nsects + 1) * 6 * 2 * sizeof(coord));
|
table = malloc((nsects + 1) * 6 * 2 * sizeof(coord));
|
||||||
memset(table, 0, (nsects + 1) * 6 * 2 * sizeof(coord));
|
memset(table, 0, (nsects + 1) * 6 * 2 * sizeof(coord));
|
||||||
pr("SPY report\n");
|
pr("SPY report\n");
|
||||||
prdate();
|
prdate();
|
||||||
|
@ -111,7 +111,7 @@ spy(void)
|
||||||
nrecon = 0;
|
nrecon = 0;
|
||||||
nunits = 0;
|
nunits = 0;
|
||||||
snxtitem_xy(&ni, EF_LAND, from.sct_x, from.sct_y);
|
snxtitem_xy(&ni, EF_LAND, from.sct_x, from.sct_y);
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
nunits++;
|
nunits++;
|
||||||
if (lchr[(int)land.lnd_type].l_flags & L_RECON)
|
if (lchr[(int)land.lnd_type].l_flags & L_RECON)
|
||||||
nrecon++;
|
nrecon++;
|
||||||
|
@ -208,7 +208,7 @@ spy(void)
|
||||||
if (changed)
|
if (changed)
|
||||||
writemap(player->cnum);
|
writemap(player->cnum);
|
||||||
player->btused += btucost;
|
player->btused += btucost;
|
||||||
free((s_char *)table);
|
free(table);
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ num_units(int x, int y)
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
snxtitem_xy(&ni, EF_LAND, x, y);
|
snxtitem_xy(&ni, EF_LAND, x, y);
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if ((land.lnd_own == player->cnum) || (land.lnd_own == 0))
|
if ((land.lnd_own == player->cnum) || (land.lnd_own == 0))
|
||||||
continue;
|
continue;
|
||||||
if (land.lnd_ship >= 0 || land.lnd_land >= 0)
|
if (land.lnd_ship >= 0 || land.lnd_land >= 0)
|
||||||
|
@ -294,7 +294,7 @@ prunits(int x, int y)
|
||||||
s_char report[128];
|
s_char report[128];
|
||||||
|
|
||||||
snxtitem_xy(&ni, EF_LAND, x, y);
|
snxtitem_xy(&ni, EF_LAND, x, y);
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (land.lnd_own == player->cnum || land.lnd_own == 0)
|
if (land.lnd_own == player->cnum || land.lnd_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (land.lnd_ship >= 0 || land.lnd_land >= 0)
|
if (land.lnd_ship >= 0 || land.lnd_land >= 0)
|
||||||
|
@ -330,7 +330,7 @@ prplanes(int x, int y)
|
||||||
s_char report[128];
|
s_char report[128];
|
||||||
|
|
||||||
snxtitem_xy(&ni, EF_PLANE, x, y);
|
snxtitem_xy(&ni, EF_PLANE, x, y);
|
||||||
while (nxtitem(&ni, (s_char *)&plane)) {
|
while (nxtitem(&ni, &plane)) {
|
||||||
if (plane.pln_own == player->cnum || plane.pln_own == 0)
|
if (plane.pln_own == player->cnum || plane.pln_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (plane.pln_ship >= 0 || plane.pln_land >= 0)
|
if (plane.pln_ship >= 0 || plane.pln_land >= 0)
|
||||||
|
|
|
@ -49,7 +49,7 @@ sstat(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
||||||
nships = 0;
|
nships = 0;
|
||||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
while (nxtitem(&ni, &ship)) {
|
||||||
if (!player->owner || ship.shp_own == 0)
|
if (!player->owner || ship.shp_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
|
||||||
|
|
|
@ -126,7 +126,7 @@ units_in_sector(struct combat *def)
|
||||||
struct lndstr land;
|
struct lndstr land;
|
||||||
|
|
||||||
snxtitem_xy(&ni, EF_LAND, def->x, def->y);
|
snxtitem_xy(&ni, EF_LAND, def->x, def->y);
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (land.lnd_own == 0)
|
if (land.lnd_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (land.lnd_own != def->own)
|
if (land.lnd_own != def->own)
|
||||||
|
|
|
@ -166,7 +166,7 @@ starv_ships(s_char *range)
|
||||||
if (!snxtitem(&ni, EF_SHIP, range))
|
if (!snxtitem(&ni, EF_SHIP, range))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
while (nxtitem(&ni, &ship)) {
|
||||||
if (!player->owner || !ship.shp_own)
|
if (!player->owner || !ship.shp_own)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ starv_units(s_char *range)
|
||||||
if (!snxtitem(&ni, EF_LAND, range))
|
if (!snxtitem(&ni, EF_LAND, range))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (!player->owner || !land.lnd_own)
|
if (!player->owner || !land.lnd_own)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ supp(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
||||||
nunits = 0;
|
nunits = 0;
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (!player->owner || land.lnd_own == 0)
|
if (!player->owner || land.lnd_own == 0)
|
||||||
continue;
|
continue;
|
||||||
nunits++;
|
nunits++;
|
||||||
|
|
|
@ -106,7 +106,7 @@ surv(void)
|
||||||
for (i = 0; i < WORLD_Y; i++)
|
for (i = 0; i < WORLD_Y; i++)
|
||||||
map[i] = &mapbuf[MAPWIDTH(1) * i];
|
map[i] = &mapbuf[MAPWIDTH(1) * i];
|
||||||
} else if (map) {
|
} else if (map) {
|
||||||
free((s_char *)map);
|
free(map);
|
||||||
map = (s_char **)0;
|
map = (s_char **)0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ tend(void)
|
||||||
getstarg(player->argp[2], "Tender(s)? ", buf)))
|
getstarg(player->argp[2], "Tender(s)? ", buf)))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
||||||
while (nxtitem(&tenders, (s_char *)&tender)) {
|
while (nxtitem(&tenders, &tender)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
if (type == EF_LAND) {
|
if (type == EF_LAND) {
|
||||||
|
@ -211,7 +211,7 @@ tend_land(struct shpstr *tenderp, s_char *units)
|
||||||
if (!snxtitem(&lni, EF_LAND, units))
|
if (!snxtitem(&lni, EF_LAND, units))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
|
||||||
while (nxtitem(&lni, (s_char *)&land)) {
|
while (nxtitem(&lni, &land)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
if (land.lnd_ship != tenderp->shp_uid) {
|
if (land.lnd_ship != tenderp->shp_uid) {
|
||||||
|
@ -272,7 +272,7 @@ tend_land(struct shpstr *tenderp, s_char *units)
|
||||||
count_units(tenderp);
|
count_units(tenderp);
|
||||||
putship(tenderp->shp_uid, tenderp);
|
putship(tenderp->shp_uid, tenderp);
|
||||||
snxtitem_xy(&pni, EF_PLANE, land.lnd_x, land.lnd_y);
|
snxtitem_xy(&pni, EF_PLANE, land.lnd_x, land.lnd_y);
|
||||||
while (nxtitem(&pni, (s_char *)&plane)) {
|
while (nxtitem(&pni, &plane)) {
|
||||||
if (plane.pln_flags & PLN_LAUNCHED)
|
if (plane.pln_flags & PLN_LAUNCHED)
|
||||||
continue;
|
continue;
|
||||||
if (plane.pln_land != land.lnd_uid)
|
if (plane.pln_land != land.lnd_uid)
|
||||||
|
|
|
@ -81,7 +81,7 @@ torp(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
if (!snxtitem(&nbst, EF_SHIP, sav))
|
if (!snxtitem(&nbst, EF_SHIP, sav))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
while (nxtitem(&nbst, (s_char *)&sub)) {
|
while (nxtitem(&nbst, &sub)) {
|
||||||
if (sub.shp_own != player->cnum)
|
if (sub.shp_own != player->cnum)
|
||||||
continue;
|
continue;
|
||||||
if ((mchr[(int)sub.shp_type].m_flags & M_TORP) == 0)
|
if ((mchr[(int)sub.shp_type].m_flags & M_TORP) == 0)
|
||||||
|
@ -102,7 +102,7 @@ torp(void)
|
||||||
}
|
}
|
||||||
pr("%d ships are eligible to torp\n", ntorping);
|
pr("%d ships are eligible to torp\n", ntorping);
|
||||||
snxtitem(&nbst, EF_SHIP, sav);
|
snxtitem(&nbst, EF_SHIP, sav);
|
||||||
while (nxtitem(&nbst, (s_char *)&sub)) {
|
while (nxtitem(&nbst, &sub)) {
|
||||||
if (!sub.shp_own)
|
if (!sub.shp_own)
|
||||||
continue;
|
continue;
|
||||||
if (sub.shp_own != player->cnum) {
|
if (sub.shp_own != player->cnum) {
|
||||||
|
|
|
@ -95,7 +95,7 @@ trad(void)
|
||||||
pr(" --- -------- -- --------- ----- -------------------------\n");
|
pr(" --- -------- -- --------- ----- -------------------------\n");
|
||||||
|
|
||||||
snxtitem_all(&ni, EF_TRADE);
|
snxtitem_all(&ni, EF_TRADE);
|
||||||
while (nxtitem(&ni, (char *)&trade)) {
|
while (nxtitem(&ni, &trade)) {
|
||||||
if (trade.trd_owner == 0)
|
if (trade.trd_owner == 0)
|
||||||
continue;
|
continue;
|
||||||
if (!trade_getitem(&trade, &tg)) {
|
if (!trade_getitem(&trade, &tg)) {
|
||||||
|
@ -512,7 +512,7 @@ check_trade(void)
|
||||||
tg.lnd.lnd_mission = 0;
|
tg.lnd.lnd_mission = 0;
|
||||||
/* Drop any land units this unit was carrying */
|
/* Drop any land units this unit was carrying */
|
||||||
snxtitem_xy(&ni, EF_LAND, tg.lnd.lnd_x, tg.lnd.lnd_y);
|
snxtitem_xy(&ni, EF_LAND, tg.lnd.lnd_x, tg.lnd.lnd_y);
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (land.lnd_land != tg.lnd.lnd_uid)
|
if (land.lnd_land != tg.lnd.lnd_uid)
|
||||||
continue;
|
continue;
|
||||||
land.lnd_land = -1;
|
land.lnd_land = -1;
|
||||||
|
@ -523,7 +523,7 @@ check_trade(void)
|
||||||
}
|
}
|
||||||
/* Drop any planes this unit was carrying */
|
/* Drop any planes this unit was carrying */
|
||||||
snxtitem_xy(&ni, EF_PLANE, tg.lnd.lnd_x, tg.lnd.lnd_y);
|
snxtitem_xy(&ni, EF_PLANE, tg.lnd.lnd_x, tg.lnd.lnd_y);
|
||||||
while (nxtitem(&ni, (s_char *)&plane)) {
|
while (nxtitem(&ni, &plane)) {
|
||||||
if (plane.pln_flags & PLN_LAUNCHED)
|
if (plane.pln_flags & PLN_LAUNCHED)
|
||||||
continue;
|
continue;
|
||||||
if (plane.pln_land != land.lnd_uid)
|
if (plane.pln_land != land.lnd_uid)
|
||||||
|
@ -541,7 +541,7 @@ check_trade(void)
|
||||||
logerror("Bad trade type %d in trade\n", trade.trd_type);
|
logerror("Bad trade type %d in trade\n", trade.trd_type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!ef_write(trade.trd_type, saveid, (char *)&tg)) {
|
if (!ef_write(trade.trd_type, saveid, &tg)) {
|
||||||
logerror("Couldn't write unit to disk; seek help.\n");
|
logerror("Couldn't write unit to disk; seek help.\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,7 +208,7 @@ tran_plane(void)
|
||||||
* No one could seriously want to move planes in parallel from
|
* No one could seriously want to move planes in parallel from
|
||||||
* several sectors!
|
* several sectors!
|
||||||
*/
|
*/
|
||||||
while (nxtitem(&nstr, (s_char *)&plane)) {
|
while (nxtitem(&nstr, &plane)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
type = plane.pln_type;
|
type = plane.pln_type;
|
||||||
|
@ -260,7 +260,7 @@ tran_plane(void)
|
||||||
dstx = endsect.sct_x;
|
dstx = endsect.sct_x;
|
||||||
dsty = endsect.sct_y;
|
dsty = endsect.sct_y;
|
||||||
snxtitem_rewind(&nstr);
|
snxtitem_rewind(&nstr);
|
||||||
while (nxtitem(&nstr, (s_char *)&plane)) {
|
while (nxtitem(&nstr, &plane)) {
|
||||||
if (!player->owner)
|
if (!player->owner)
|
||||||
continue;
|
continue;
|
||||||
if (dam)
|
if (dam)
|
||||||
|
|
|
@ -51,7 +51,7 @@ trea(void)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
pr("\t... %s Treaty Report ...\n", cname(player->cnum));
|
pr("\t... %s Treaty Report ...\n", cname(player->cnum));
|
||||||
ntreaty = 0;
|
ntreaty = 0;
|
||||||
while (nxtitem(&nstr, (s_char *)&treaty)) {
|
while (nxtitem(&nstr, &treaty)) {
|
||||||
if (distrea(nstr.cur, &treaty) > 0)
|
if (distrea(nstr.cur, &treaty) > 0)
|
||||||
ntreaty++;
|
ntreaty++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ lupgr(void)
|
||||||
cash = natp->nat_money;
|
cash = natp->nat_money;
|
||||||
tlev = (int)natp->nat_level[NAT_TLEV];
|
tlev = (int)natp->nat_level[NAT_TLEV];
|
||||||
n = 0;
|
n = 0;
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (land.lnd_own == 0)
|
if (land.lnd_own == 0)
|
||||||
continue;
|
continue;
|
||||||
getsect(land.lnd_x, land.lnd_y, §);
|
getsect(land.lnd_x, land.lnd_y, §);
|
||||||
|
@ -181,7 +181,7 @@ supgr(void)
|
||||||
cash = natp->nat_money;
|
cash = natp->nat_money;
|
||||||
tlev = (int)natp->nat_level[NAT_TLEV];
|
tlev = (int)natp->nat_level[NAT_TLEV];
|
||||||
n = 0;
|
n = 0;
|
||||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
while (nxtitem(&ni, &ship)) {
|
||||||
if (ship.shp_own == 0)
|
if (ship.shp_own == 0)
|
||||||
continue;
|
continue;
|
||||||
getsect(ship.shp_x, ship.shp_y, §);
|
getsect(ship.shp_x, ship.shp_y, §);
|
||||||
|
@ -263,7 +263,7 @@ pupgr(void)
|
||||||
cash = natp->nat_money;
|
cash = natp->nat_money;
|
||||||
tlev = (int)natp->nat_level[NAT_TLEV];
|
tlev = (int)natp->nat_level[NAT_TLEV];
|
||||||
n = 0;
|
n = 0;
|
||||||
while (nxtitem(&ni, (s_char *)&plane)) {
|
while (nxtitem(&ni, &plane)) {
|
||||||
if (plane.pln_own == 0)
|
if (plane.pln_own == 0)
|
||||||
continue;
|
continue;
|
||||||
getsect(plane.pln_x, plane.pln_y, §);
|
getsect(plane.pln_x, plane.pln_y, §);
|
||||||
|
|
|
@ -67,7 +67,7 @@ work(void)
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
nunits = 0;
|
nunits = 0;
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (!player->owner || land.lnd_own == 0)
|
if (!player->owner || land.lnd_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (land.lnd_type < 0 || land.lnd_type > lnd_maxno) {
|
if (land.lnd_type < 0 || land.lnd_type > lnd_maxno) {
|
||||||
|
|
|
@ -132,13 +132,12 @@ bestownedpath(s_char *bpath,
|
||||||
unsigned int routelen;
|
unsigned int routelen;
|
||||||
|
|
||||||
if (!mapbuf)
|
if (!mapbuf)
|
||||||
mapbuf = (unsigned int *)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 ((s_char *)0);
|
||||||
if (!mapindex) {
|
if (!mapindex) {
|
||||||
mapindex =
|
mapindex = malloc(WORLD_X * sizeof(unsigned int *));
|
||||||
(unsigned int **)malloc(WORLD_X * sizeof(unsigned int *));
|
|
||||||
if (mapindex) {
|
if (mapindex) {
|
||||||
/* Setup the map pointers */
|
/* Setup the map pointers */
|
||||||
for (i = 0; i < WORLD_X; i++)
|
for (i = 0; i < WORLD_X; i++)
|
||||||
|
@ -160,7 +159,7 @@ bestownedpath(s_char *bpath,
|
||||||
if (x == ex && y == ey) {
|
if (x == ex && y == ey) {
|
||||||
bpath[0] = 'h';
|
bpath[0] = 'h';
|
||||||
bpath[1] = 0;
|
bpath[1] = 0;
|
||||||
return ((s_char *)bpath);
|
return bpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!valid(x, y) || !valid(ex, ey))
|
if (!valid(x, y) || !valid(ex, ey))
|
||||||
|
@ -186,7 +185,7 @@ bestownedpath(s_char *bpath,
|
||||||
if (++routelen == MAXROUTE) {
|
if (++routelen == MAXROUTE) {
|
||||||
bpath[0] = '?';
|
bpath[0] = '?';
|
||||||
bpath[1] = 0;
|
bpath[1] = 0;
|
||||||
return ((s_char *)bpath);
|
return bpath;
|
||||||
}
|
}
|
||||||
markedsectors = 0;
|
markedsectors = 0;
|
||||||
for (scanx = minx; scanx <= maxx; scanx++) {
|
for (scanx = minx; scanx <= maxx; scanx++) {
|
||||||
|
@ -219,7 +218,7 @@ bestownedpath(s_char *bpath,
|
||||||
tx = XNORM(tx);
|
tx = XNORM(tx);
|
||||||
ty = YNORM(ty);
|
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 */
|
/* Sink all the units */
|
||||||
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
|
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)
|
if (land.lnd_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (land.lnd_x != sp->sct_x || land.lnd_y != sp->sct_y)
|
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 */
|
/* Sink all the planes */
|
||||||
snxtitem_xy(&ni, EF_PLANE, sp->sct_x, sp->sct_y);
|
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)
|
if (plane.pln_own == 0)
|
||||||
continue;
|
continue;
|
||||||
if (plane.pln_x != sp->sct_x || plane.pln_y != sp->sct_y)
|
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;
|
int n;
|
||||||
struct lndstr land;
|
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)
|
if (land.lnd_x != x || land.lnd_y != y)
|
||||||
continue;
|
continue;
|
||||||
if (lp) {
|
if (lp) {
|
||||||
|
@ -85,7 +85,7 @@ has_units_with_mob(coord x, coord y, natid cn)
|
||||||
struct lndstr land;
|
struct lndstr land;
|
||||||
|
|
||||||
snxtitem_xy(&ni, EF_LAND, x, y);
|
snxtitem_xy(&ni, EF_LAND, x, y);
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
if (land.lnd_own != cn)
|
if (land.lnd_own != cn)
|
||||||
continue;
|
continue;
|
||||||
if (land.lnd_mobil > 0)
|
if (land.lnd_mobil > 0)
|
||||||
|
@ -105,7 +105,7 @@ has_helpful_engineer(coord x, coord y, natid cn)
|
||||||
struct lndstr land;
|
struct lndstr land;
|
||||||
|
|
||||||
snxtitem_xy(&ni, EF_LAND, x, y);
|
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)
|
if (land.lnd_own != cn && getrel(getnatp(land.lnd_own), cn) != ALLIED)
|
||||||
continue;
|
continue;
|
||||||
if (lchr[(int)land.lnd_type].l_flags & L_ENGINEER)
|
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;
|
static s_char **wmap = (s_char **)0;
|
||||||
|
|
||||||
if (!wmapbuf)
|
if (!wmapbuf)
|
||||||
wmapbuf =
|
wmapbuf = malloc((WORLD_Y * MAPWIDTH(1)) * sizeof(s_char));
|
||||||
(s_char *)malloc((WORLD_Y * MAPWIDTH(1)) * sizeof(s_char));
|
|
||||||
if (!wmap) {
|
if (!wmap) {
|
||||||
wmap = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
|
wmap = malloc(WORLD_Y * sizeof(s_char *));
|
||||||
if (wmap && wmapbuf) {
|
if (wmap && wmapbuf) {
|
||||||
for (i = 0; i < WORLD_Y; i++)
|
for (i = 0; i < WORLD_Y; i++)
|
||||||
wmap[i] = &wmapbuf[MAPWIDTH(1) * i];
|
wmap[i] = &wmapbuf[MAPWIDTH(1) * i];
|
||||||
} else if (wmap) {
|
} else if (wmap) {
|
||||||
free((s_char *)wmap);
|
free(wmap);
|
||||||
wmap = (s_char **)0;
|
wmap = (s_char **)0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!bitmap)
|
if (!bitmap)
|
||||||
bitmap = (u_char *)malloc((WORLD_X * WORLD_Y) / 8);
|
bitmap = malloc((WORLD_X * WORLD_Y) / 8);
|
||||||
if (!wmapbuf || !wmap || !bitmap) {
|
if (!wmapbuf || !wmap || !bitmap) {
|
||||||
pr("Memory error, tell the deity.\n");
|
pr("Memory error, tell the deity.\n");
|
||||||
logerror("malloc failed in draw_map\n");
|
logerror("malloc failed in draw_map\n");
|
||||||
|
|
|
@ -81,7 +81,7 @@ bp_init(void)
|
||||||
|
|
||||||
ep = &empfile[EF_SECTOR];
|
ep = &empfile[EF_SECTOR];
|
||||||
|
|
||||||
bp = (struct bestp *)malloc(sizeof(*bp));
|
bp = malloc(sizeof(*bp));
|
||||||
memset(bp, 0, sizeof(*bp));
|
memset(bp, 0, sizeof(*bp));
|
||||||
bp->adp = as_init(BP_NEIGHBORS, BP_ASHASHSIZE, bp_coord_hash,
|
bp->adp = as_init(BP_NEIGHBORS, BP_ASHASHSIZE, bp_coord_hash,
|
||||||
bp_neighbors, bp_lbcost, bp_realcost,
|
bp_neighbors, bp_lbcost, bp_realcost,
|
||||||
|
@ -91,9 +91,8 @@ bp_init(void)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (neighsects == (struct sctstr **)0)
|
if (neighsects == (struct sctstr **)0)
|
||||||
neighsects = (struct sctstr **)calloc(1, (sizeof(struct sctstr *) *
|
neighsects = calloc(((WORLD_X * WORLD_Y) / 2) * 6,
|
||||||
((WORLD_X * WORLD_Y) /
|
sizeof(struct sctstr *));
|
||||||
2) * 6));
|
|
||||||
|
|
||||||
return (s_char *)bp;
|
return (s_char *)bp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ sectdamage(struct sctstr *sp, int dam, struct emp_qelem *list)
|
||||||
return eff;
|
return eff;
|
||||||
|
|
||||||
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
|
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)
|
if (!land.lnd_own)
|
||||||
continue;
|
continue;
|
||||||
landdamage(&land, dam);
|
landdamage(&land, dam);
|
||||||
|
@ -119,7 +119,7 @@ sectdamage(struct sctstr *sp, int dam, struct emp_qelem *list)
|
||||||
if (dam <= 0)
|
if (dam <= 0)
|
||||||
return eff;
|
return eff;
|
||||||
snxtitem_xy(&ni, EF_PLANE, sp->sct_x, sp->sct_y);
|
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)
|
if (!plane.pln_own)
|
||||||
continue;
|
continue;
|
||||||
if (plane.pln_flags & PLN_LAUNCHED)
|
if (plane.pln_flags & PLN_LAUNCHED)
|
||||||
|
|
|
@ -414,7 +414,7 @@ empth_init(char **ctx_ptr, int flags)
|
||||||
SetConsoleCtrlHandler((PHANDLER_ROUTINE)loc_Exit_Handler, TRUE);
|
SetConsoleCtrlHandler((PHANDLER_ROUTINE)loc_Exit_Handler, TRUE);
|
||||||
|
|
||||||
/* Create the global Thread context. */
|
/* Create the global Thread context. */
|
||||||
pThread = (loc_Thread_t *)malloc(sizeof(*pThread));
|
pThread = malloc(sizeof(*pThread));
|
||||||
if (!pThread) {
|
if (!pThread) {
|
||||||
logerror("not enough memory to create main thread.");
|
logerror("not enough memory to create main thread.");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -461,7 +461,7 @@ empth_create(int prio, void (*entry)(void *), int size, int flags,
|
||||||
|
|
||||||
loc_debug("creating new thread %s:%s", name, desc);
|
loc_debug("creating new thread %s:%s", name, desc);
|
||||||
|
|
||||||
pThread = (loc_Thread_t *)malloc(sizeof(*pThread));
|
pThread = malloc(sizeof(*pThread));
|
||||||
if (!pThread) {
|
if (!pThread) {
|
||||||
logerror("not enough memory to create thread: %s (%s)", name,
|
logerror("not enough memory to create thread: %s (%s)", name,
|
||||||
desc);
|
desc);
|
||||||
|
@ -671,7 +671,7 @@ empth_sem_create(char *name, int cnt)
|
||||||
{
|
{
|
||||||
loc_Sem_t *pSem;
|
loc_Sem_t *pSem;
|
||||||
|
|
||||||
pSem = (loc_Sem_t *)malloc(sizeof(*pSem));
|
pSem = malloc(sizeof(*pSem));
|
||||||
if (!pSem) {
|
if (!pSem) {
|
||||||
logerror("out of memory at %s:%d", __FILE__, __LINE__);
|
logerror("out of memory at %s:%d", __FILE__, __LINE__);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -140,7 +140,7 @@ empth_init(char **ctx_ptr, int flags)
|
||||||
sigaction(SIGALRM, &act, NULL);
|
sigaction(SIGALRM, &act, NULL);
|
||||||
|
|
||||||
udata = ctx_ptr;
|
udata = ctx_ptr;
|
||||||
ctx = (empth_t *)malloc(sizeof(empth_t));
|
ctx = malloc(sizeof(empth_t));
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
logerror("pthread init failed: not enough memory");
|
logerror("pthread init failed: not enough memory");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -176,7 +176,7 @@ empth_create(int prio, void (*entry)(void *), int size, int flags,
|
||||||
|
|
||||||
empth_status("creating new thread %s:%s", name, desc);
|
empth_status("creating new thread %s:%s", name, desc);
|
||||||
|
|
||||||
ctx = (empth_t *)malloc(sizeof(empth_t));
|
ctx = malloc(sizeof(empth_t));
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
logerror("not enough memoty to create thread: %s (%s)", name,
|
logerror("not enough memoty to create thread: %s (%s)", name,
|
||||||
desc);
|
desc);
|
||||||
|
@ -262,7 +262,7 @@ empth_restorectx(void)
|
||||||
#else
|
#else
|
||||||
ctx_ptr = (empth_t *)pthread_getspecific(ctx_key);
|
ctx_ptr = (empth_t *)pthread_getspecific(ctx_key);
|
||||||
#endif
|
#endif
|
||||||
*udata = (char *)ctx_ptr->ud;
|
*udata = ctx_ptr->ud;
|
||||||
if (ctx_ptr->state == EMPTH_KILLED) {
|
if (ctx_ptr->state == EMPTH_KILLED) {
|
||||||
empth_status("i am dead");
|
empth_status("i am dead");
|
||||||
empth_exit();
|
empth_exit();
|
||||||
|
@ -447,7 +447,7 @@ empth_sem_create(char *name, int cnt)
|
||||||
{
|
{
|
||||||
empth_sem_t *sm;
|
empth_sem_t *sm;
|
||||||
|
|
||||||
sm = (empth_sem_t *)malloc(sizeof(empth_sem_t));
|
sm = malloc(sizeof(empth_sem_t));
|
||||||
if (!sm) {
|
if (!sm) {
|
||||||
logerror("out of memory at %s:%d", __FILE__, __LINE__);
|
logerror("out of memory at %s:%d", __FILE__, __LINE__);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -89,7 +89,7 @@ io_open(int fd, int flags, int bufsize, int (*notify)(void),
|
||||||
flags = flags & (IO_READ | IO_WRITE | IO_NBLOCK | IO_NEWSOCK);
|
flags = flags & (IO_READ | IO_WRITE | IO_NBLOCK | IO_NEWSOCK);
|
||||||
if ((flags & (IO_READ | IO_WRITE)) == 0)
|
if ((flags & (IO_READ | IO_WRITE)) == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
iop = (struct iop *)malloc(sizeof(struct iop));
|
iop = malloc(sizeof(struct iop));
|
||||||
if (!iop)
|
if (!iop)
|
||||||
return NULL;
|
return NULL;
|
||||||
iop->fd = fd;
|
iop->fd = fd;
|
||||||
|
@ -122,7 +122,7 @@ io_close(struct iop *iop)
|
||||||
#else
|
#else
|
||||||
closesocket(iop->fd);
|
closesocket(iop->fd);
|
||||||
#endif
|
#endif
|
||||||
free((s_char *)iop);
|
free(iop);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -66,7 +66,7 @@ ioq_create(int size)
|
||||||
{
|
{
|
||||||
struct ioqueue *ioq;
|
struct ioqueue *ioq;
|
||||||
|
|
||||||
ioq = (struct ioqueue *)malloc(sizeof(struct ioqueue));
|
ioq = malloc(sizeof(struct ioqueue));
|
||||||
emp_initque(&ioq->list.queue);
|
emp_initque(&ioq->list.queue);
|
||||||
ioq->list.nbytes = 0;
|
ioq->list.nbytes = 0;
|
||||||
ioq->list.offset = 0;
|
ioq->list.offset = 0;
|
||||||
|
@ -84,7 +84,7 @@ ioq_destroy(struct ioqueue *ioq)
|
||||||
/* ioq_drain doesn't work under aix or NeXT... dunno why --ts */
|
/* ioq_drain doesn't work under aix or NeXT... dunno why --ts */
|
||||||
ioq_drain(ioq);
|
ioq_drain(ioq);
|
||||||
#endif /* aix */
|
#endif /* aix */
|
||||||
free((s_char *)ioq);
|
free(ioq);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -318,7 +318,7 @@ appendcc(struct ioqueue *ioq, s_char *buf, int cc)
|
||||||
len = cc > ioq->bufsize ? cc : ioq->bufsize;
|
len = cc > ioq->bufsize ? cc : ioq->bufsize;
|
||||||
ptr = malloc(len);
|
ptr = malloc(len);
|
||||||
memcpy(ptr, buf, cc);
|
memcpy(ptr, buf, cc);
|
||||||
io = (struct io *)malloc(sizeof(struct io));
|
io = malloc(sizeof(struct io));
|
||||||
io->nbytes = cc;
|
io->nbytes = cc;
|
||||||
io->size = len;
|
io->size = len;
|
||||||
io->offset = 0;
|
io->offset = 0;
|
||||||
|
|
|
@ -41,7 +41,7 @@ strdup(char *x)
|
||||||
{
|
{
|
||||||
char *y;
|
char *y;
|
||||||
|
|
||||||
y = (char *)malloc((sizeof(char) * strlen(x)) + 1);
|
y = malloc((sizeof(char) * strlen(x)) + 1);
|
||||||
strcpy(y, x);
|
strcpy(y, x);
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ lwpInitContext(struct lwpProc *newp, void *sp)
|
||||||
int endpoint;
|
int endpoint;
|
||||||
|
|
||||||
if (initcontext == NULL) {
|
if (initcontext == NULL) {
|
||||||
initcontext = (struct lwpProc *)malloc(sizeof(struct lwpProc));
|
initcontext = malloc(sizeof(struct lwpProc));
|
||||||
tempcontext = &holder;
|
tempcontext = &holder;
|
||||||
if (!setjmp(tempcontext->context))
|
if (!setjmp(tempcontext->context))
|
||||||
startcontext();
|
startcontext();
|
||||||
|
|
|
@ -215,7 +215,7 @@ lwpCreate(int priority, void (*entry)(void *), int size, int flags, char *name,
|
||||||
#endif /* UCONTEXT */
|
#endif /* UCONTEXT */
|
||||||
unsigned long stackp;
|
unsigned long stackp;
|
||||||
|
|
||||||
if (!(newp = (struct lwpProc *)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 */
|
||||||
|
@ -223,7 +223,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 = (int *)malloc(size)))
|
if (!(s = malloc(size)))
|
||||||
return (0);
|
return (0);
|
||||||
newp->flags = flags;
|
newp->flags = flags;
|
||||||
newp->name = strdup(name);
|
newp->name = strdup(name);
|
||||||
|
@ -304,7 +304,7 @@ lwpDestroy(struct lwpProc *proc)
|
||||||
proc->entry = 0;
|
proc->entry = 0;
|
||||||
proc->ud = 0;
|
proc->ud = 0;
|
||||||
proc->argv = 0;
|
proc->argv = 0;
|
||||||
free((char *)proc->sbtm);
|
free(proc->sbtm);
|
||||||
free(proc->name);
|
free(proc->name);
|
||||||
free(proc->desc);
|
free(proc->desc);
|
||||||
proc->name = 0;
|
proc->name = 0;
|
||||||
|
@ -312,7 +312,7 @@ lwpDestroy(struct lwpProc *proc)
|
||||||
proc->sbtm = 0;
|
proc->sbtm = 0;
|
||||||
proc->lowmark = 0;
|
proc->lowmark = 0;
|
||||||
proc->himark = 0;
|
proc->himark = 0;
|
||||||
free((char *)proc);
|
free(proc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -434,7 +434,7 @@ lwpInitSystem(int pri, char **ctxptr, int flags)
|
||||||
/* *LwpContextPtr = 0; */
|
/* *LwpContextPtr = 0; */
|
||||||
if (!(LwpCurrent = calloc(1, sizeof(struct lwpProc))))
|
if (!(LwpCurrent = calloc(1, sizeof(struct lwpProc))))
|
||||||
return (0);
|
return (0);
|
||||||
if (!(stack = (int *)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;
|
||||||
|
|
|
@ -73,8 +73,7 @@ lwpInitSelect(struct lwpProc *proc)
|
||||||
#endif
|
#endif
|
||||||
FD_ZERO(&LwpSelect.readmask);
|
FD_ZERO(&LwpSelect.readmask);
|
||||||
FD_ZERO(&LwpSelect.writemask);
|
FD_ZERO(&LwpSelect.writemask);
|
||||||
LwpSelect.wait = (struct lwpProc **)
|
LwpSelect.wait = calloc(LwpSelect.nfile, sizeof(char *));
|
||||||
calloc(LwpSelect.nfile, sizeof(char *));
|
|
||||||
LwpSelect.delayq.head = 0;
|
LwpSelect.delayq.head = 0;
|
||||||
LwpSelect.delayq.tail = 0;
|
LwpSelect.delayq.tail = 0;
|
||||||
LwpSelect.proc = proc;
|
LwpSelect.proc = proc;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue