Remove a bunch of redundant casts.
This commit is contained in:
parent
ee6d72f3b8
commit
4f59fc9967
125 changed files with 417 additions and 432 deletions
|
@ -269,7 +269,7 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
|
|||
/* Go figure out if there are ships in this sector, and who's they are */
|
||||
memset(nats, 0, sizeof(nats));
|
||||
snxtitem_xy(&ni, EF_SHIP, x, y);
|
||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
||||
while (nxtitem(&ni, &ship)) {
|
||||
if (mchr[(int)ship.shp_type].m_flags & M_SUB)
|
||||
continue;
|
||||
nats[ship.shp_own]++;
|
||||
|
@ -277,7 +277,7 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
|
|||
/* Go figure out if there are units in this sector, and who's they are */
|
||||
memset(lnats, 0, sizeof(lnats));
|
||||
snxtitem_xy(&ni, EF_LAND, x, y);
|
||||
while (nxtitem(&ni, (s_char *)&land)) {
|
||||
while (nxtitem(&ni, &land)) {
|
||||
if (land.lnd_ship >= 0 || land.lnd_land >= 0)
|
||||
continue;
|
||||
lnats[land.lnd_own]++;
|
||||
|
@ -390,12 +390,12 @@ sam_intercept(struct emp_qelem *att_list, struct emp_qelem *def_list,
|
|||
if (dplp->plane.pln_range <
|
||||
mapdist(x, y, dplp->plane.pln_x, dplp->plane.pln_y)) {
|
||||
emp_remque(dqp);
|
||||
free((s_char *)dqp);
|
||||
free(dqp);
|
||||
continue;
|
||||
}
|
||||
if (mission_pln_equip(dplp, 0, P_F, 0) < 0) {
|
||||
emp_remque(dqp);
|
||||
free((s_char *)dqp);
|
||||
free(dqp);
|
||||
continue;
|
||||
}
|
||||
if (first) {
|
||||
|
@ -421,7 +421,7 @@ sam_intercept(struct emp_qelem *att_list, struct emp_qelem *def_list,
|
|||
if (!(dplp->pcp->pl_flags & P_M))
|
||||
continue;
|
||||
emp_remque(dqp);
|
||||
free((s_char *)dqp);
|
||||
free(dqp);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -465,7 +465,7 @@ ac_intercept(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
|
|||
continue;
|
||||
if (mission_pln_equip(plp, 0, P_F, 0) < 0) {
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
continue;
|
||||
}
|
||||
/* got one; delete from def_list, add to int_list */
|
||||
|
@ -746,11 +746,11 @@ ac_planedamage(struct plist *plp, natid from, int dam, natid other,
|
|||
pp->pln_own = 0;
|
||||
putplane(pp->pln_uid, pp);
|
||||
emp_remque(&plp->queue);
|
||||
free((s_char *)plp);
|
||||
free(plp);
|
||||
} else if (disp == 2) {
|
||||
putplane(pp->pln_uid, pp);
|
||||
emp_remque(&plp->queue);
|
||||
free((s_char *)plp);
|
||||
free(plp);
|
||||
} else
|
||||
putplane(pp->pln_uid, pp);
|
||||
strcpy(mesg, dmess);
|
||||
|
@ -813,7 +813,7 @@ ac_shipflak(struct emp_qelem *list, coord x, coord y)
|
|||
memset(nats, 0, sizeof(nats));
|
||||
guns = 0;
|
||||
snxtitem_xy(&ni, EF_SHIP, x, y);
|
||||
while (!QEMPTY(list) && nxtitem(&ni, (s_char *)&ship)) {
|
||||
while (!QEMPTY(list) && nxtitem(&ni, &ship)) {
|
||||
if (ship.shp_own == 0 || ship.shp_own == plane_owner)
|
||||
continue;
|
||||
if (guns >= 14)
|
||||
|
@ -881,7 +881,7 @@ ac_landflak(struct emp_qelem *list, coord x, coord y)
|
|||
memset(nats, 0, sizeof(nats));
|
||||
guns = 0;
|
||||
snxtitem_xy(&ni, EF_LAND, x, y);
|
||||
while (!QEMPTY(list) && nxtitem(&ni, (s_char *)&land)) {
|
||||
while (!QEMPTY(list) && nxtitem(&ni, &land)) {
|
||||
if (land.lnd_own == 0 || land.lnd_own == plane_owner)
|
||||
continue;
|
||||
if (guns >= 14)
|
||||
|
@ -1034,7 +1034,7 @@ getilist(struct emp_qelem *list, natid own, struct emp_qelem *a,
|
|||
|
||||
emp_initque(list);
|
||||
snxtitem_all(&ni, EF_PLANE);
|
||||
while (nxtitem(&ni, (s_char *)&plane)) {
|
||||
while (nxtitem(&ni, &plane)) {
|
||||
if (plane.pln_own != own)
|
||||
continue;
|
||||
pcp = &plchr[(int)plane.pln_type];
|
||||
|
@ -1076,7 +1076,7 @@ getilist(struct emp_qelem *list, natid own, struct emp_qelem *a,
|
|||
if (ac_isflying(&plane, d))
|
||||
continue;
|
||||
/* got one! */
|
||||
ip = (struct plist *)malloc(sizeof(*ip));
|
||||
ip = malloc(sizeof(*ip));
|
||||
ip->state = P_OK;
|
||||
ip->bombs = 0;
|
||||
ip->misc = 0;
|
||||
|
|
|
@ -1020,7 +1020,7 @@ ask_olist(int combat_mode, struct combat *off, struct combat *def,
|
|||
maxland = def->shp_mcp->m_nland;
|
||||
|
||||
snxtitem_xy(&ni, EF_LAND, off->x, off->y);
|
||||
while (nxtitem(&ni, (s_char *)&land)) {
|
||||
while (nxtitem(&ni, &land)) {
|
||||
if (land.lnd_own != player->cnum)
|
||||
continue;
|
||||
if (land.lnd_effic < LAND_MINEFF)
|
||||
|
@ -1111,7 +1111,7 @@ ask_olist(int combat_mode, struct combat *off, struct combat *def,
|
|||
land_answer[(int)land.lnd_army] != 'Y')
|
||||
continue;
|
||||
}
|
||||
if (!(llp = (struct llist *)malloc(sizeof(struct llist)))) {
|
||||
if (!(llp = malloc(sizeof(struct llist)))) {
|
||||
logerror("Malloc failed in attack!\n");
|
||||
abort_attack();
|
||||
return;
|
||||
|
@ -1257,7 +1257,7 @@ get_dlist(struct combat *def, struct emp_qelem *list, int a_spy,
|
|||
lists. Spies try to hide, trains get trapped and can be boarded. */
|
||||
|
||||
snxtitem_xy(&ni, EF_LAND, def->x, def->y);
|
||||
while (nxtitem(&ni, (s_char *)&land)) {
|
||||
while (nxtitem(&ni, &land)) {
|
||||
if (!land.lnd_own)
|
||||
continue;
|
||||
if (land.lnd_own != def->own)
|
||||
|
@ -1276,7 +1276,7 @@ get_dlist(struct combat *def, struct emp_qelem *list, int a_spy,
|
|||
"Scouts report defending unit:");
|
||||
continue;
|
||||
}
|
||||
if (!(llp = (struct llist *)malloc(sizeof(struct llist)))) {
|
||||
if (!(llp = malloc(sizeof(struct llist)))) {
|
||||
logerror("Malloc failed in attack!\n");
|
||||
abort_attack();
|
||||
return 0;
|
||||
|
@ -1498,7 +1498,7 @@ put_land(struct emp_qelem *list)
|
|||
putland(llp->land.lnd_uid, &llp->land);
|
||||
if (llp->land.lnd_own != player->cnum) {
|
||||
emp_remque((struct emp_qelem *)llp);
|
||||
free((s_char *)llp);
|
||||
free(llp);
|
||||
} else
|
||||
get_land(A_ATTACK, 0, llp->land.lnd_uid, llp, 0);
|
||||
}
|
||||
|
@ -1543,7 +1543,7 @@ att_reacting_units(struct combat *def, struct emp_qelem *list, int a_spy,
|
|||
else
|
||||
dtotal = 0;
|
||||
snxtitem_all(&ni, EF_LAND);
|
||||
while (nxtitem(&ni, (s_char *)&land) &&
|
||||
while (nxtitem(&ni, &land) &&
|
||||
(dtotal + new_land * eff < (int)(1.2 * (float)ototal))) {
|
||||
if (!land.lnd_own)
|
||||
continue;
|
||||
|
|
|
@ -56,7 +56,7 @@ military_control(struct sctstr *sp)
|
|||
|
||||
if (sp->sct_oldown != sp->sct_own) {
|
||||
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 == sp->sct_own)
|
||||
tot_mil += total_mil(&land);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ shipsatxy(coord x, coord y, int wantflags, int nowantflags)
|
|||
first = 1;
|
||||
ships = 0;
|
||||
snxtitem_xy(&ni, EF_SHIP, x, y);
|
||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
||||
while (nxtitem(&ni, &ship)) {
|
||||
if (player->owner)
|
||||
continue;
|
||||
if (ship.shp_effic < SHIP_MINEFF || ship.shp_own == 0)
|
||||
|
@ -93,7 +93,7 @@ carriersatxy(coord x, coord y, int wantflags, int nowantflags, natid own)
|
|||
first = 1;
|
||||
ships = 0;
|
||||
snxtitem_xy(&ni, EF_SHIP, x, y);
|
||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
||||
while (nxtitem(&ni, &ship)) {
|
||||
if (ship.shp_effic < SHIP_MINEFF || ship.shp_own == 0)
|
||||
continue;
|
||||
if (ship.shp_own != own
|
||||
|
@ -133,7 +133,7 @@ unitsatxy(coord x, coord y, int wantflags, int nowantflags)
|
|||
first = 1;
|
||||
units = 0;
|
||||
snxtitem_xy(&ni, EF_LAND, x, y);
|
||||
while (nxtitem(&ni, (s_char *)&land)) {
|
||||
while (nxtitem(&ni, &land)) {
|
||||
if (land.lnd_effic < LAND_MINEFF || land.lnd_own == 0)
|
||||
continue;
|
||||
/* Can't bomb units on ships or other units */
|
||||
|
@ -179,7 +179,7 @@ planesatxy(coord x, coord y, int wantflags, int nowantflags,
|
|||
planes = 0;
|
||||
first = 1;
|
||||
snxtitem_xy(&ni, EF_PLANE, x, y);
|
||||
while (nxtitem(&ni, (s_char *)&plane)) {
|
||||
while (nxtitem(&ni, &plane)) {
|
||||
if (plane.pln_effic < PLANE_MINEFF || plane.pln_own == 0)
|
||||
continue;
|
||||
if (plane.pln_flags & PLN_LAUNCHED)
|
||||
|
@ -220,7 +220,7 @@ asw_shipsatxy(coord x, coord y, int wantflags, int nowantflags,
|
|||
first = 1;
|
||||
ships = 0;
|
||||
snxtitem_xy(&ni, EF_SHIP, x, y);
|
||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
||||
while (nxtitem(&ni, &ship)) {
|
||||
if (player->owner)
|
||||
continue;
|
||||
if (ship.shp_effic < SHIP_MINEFF || ship.shp_own == 0)
|
||||
|
@ -261,7 +261,7 @@ num_shipsatxy(coord x, coord y, int wantflags, int nowantflags)
|
|||
|
||||
ships = 0;
|
||||
snxtitem_xy(&ni, EF_SHIP, x, y);
|
||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
||||
while (nxtitem(&ni, &ship)) {
|
||||
if (ship.shp_effic < SHIP_MINEFF || ship.shp_own == 0)
|
||||
continue;
|
||||
mp = &mchr[(int)ship.shp_type];
|
||||
|
|
|
@ -163,7 +163,7 @@ lnd_delete(struct llist *llp, s_char *s)
|
|||
lnd_print(llp, s);
|
||||
putland(llp->land.lnd_uid, &llp->land);
|
||||
emp_remque((struct emp_qelem *)llp);
|
||||
free((s_char *)llp);
|
||||
free(llp);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -204,9 +204,8 @@ lnd_take_casualty(int combat_mode, struct llist *llp, int cas)
|
|||
|
||||
if (llp->land.lnd_effic < LAND_MINEFF) {
|
||||
sprintf(buf, "dies %s %s!",
|
||||
combat_mode ? att_mode[combat_mode] : (s_char *)
|
||||
"defending", xyas(llp->land.lnd_x, llp->land.lnd_y,
|
||||
llp->land.lnd_own));
|
||||
combat_mode ? att_mode[combat_mode] : "defending",
|
||||
xyas(llp->land.lnd_x, llp->land.lnd_y, llp->land.lnd_own));
|
||||
lnd_delete(llp, buf);
|
||||
/* Since we killed the unit, we killed all the mil on it */
|
||||
return taken;
|
||||
|
@ -433,7 +432,7 @@ count_sect_units(struct sctstr *sp)
|
|||
struct lndstr land;
|
||||
|
||||
snxtitem_all(&ni, EF_LAND);
|
||||
while (nxtitem(&ni, (s_char *)&land)) {
|
||||
while (nxtitem(&ni, &land)) {
|
||||
if (!land.lnd_own)
|
||||
continue;
|
||||
if (land.lnd_x != sp->sct_x || land.lnd_y != sp->sct_y)
|
||||
|
@ -461,7 +460,7 @@ count_units(struct shpstr *sp)
|
|||
return;
|
||||
|
||||
snxtitem_xy(&ni, EF_LAND, sp->shp_x, sp->shp_y);
|
||||
while (nxtitem(&ni, (s_char *)&land)) {
|
||||
while (nxtitem(&ni, &land)) {
|
||||
if (land.lnd_own == 0)
|
||||
continue;
|
||||
if (land.lnd_ship == sp->shp_uid)
|
||||
|
@ -485,7 +484,7 @@ lnd_count_units(struct lndstr *lp)
|
|||
return;
|
||||
|
||||
snxtitem_xy(&ni, EF_LAND, lp->lnd_x, lp->lnd_y);
|
||||
while (nxtitem(&ni, (s_char *)&land)) {
|
||||
while (nxtitem(&ni, &land)) {
|
||||
if (land.lnd_own == 0)
|
||||
continue;
|
||||
if (land.lnd_land == lp->lnd_uid)
|
||||
|
@ -511,7 +510,7 @@ lnd_sel(struct nstr_item *ni, struct emp_qelem *list)
|
|||
struct llist *llp;
|
||||
|
||||
emp_initque(list);
|
||||
while (nxtitem(ni, (s_char *)&land)) {
|
||||
while (nxtitem(ni, &land)) {
|
||||
if (!player->owner)
|
||||
continue;
|
||||
if (opt_MARKET) {
|
||||
|
@ -546,7 +545,7 @@ lnd_sel(struct nstr_item *ni, struct emp_qelem *list)
|
|||
land.lnd_harden = 0;
|
||||
memset(land.lnd_rpath, 0, sizeof(land.lnd_rpath));
|
||||
putland(land.lnd_uid, &land);
|
||||
llp = (struct llist *)malloc(sizeof(struct llist));
|
||||
llp = malloc(sizeof(struct llist));
|
||||
llp->lcp = lcp;
|
||||
llp->land = land;
|
||||
llp->mobil = (double)land.lnd_mobil;
|
||||
|
@ -581,7 +580,7 @@ lnd_mar(struct emp_qelem *list, double *minmobp, double *maxmobp,
|
|||
mpr(actor, "%s was disbanded at %s\n",
|
||||
prland(&land), xyas(land.lnd_x, land.lnd_y, land.lnd_own));
|
||||
emp_remque((struct emp_qelem *)llp);
|
||||
free((s_char *)llp);
|
||||
free(llp);
|
||||
continue;
|
||||
}
|
||||
if (land.lnd_ship >= 0) {
|
||||
|
@ -648,7 +647,7 @@ lnd_put(struct emp_qelem *list, natid actor)
|
|||
putland(llp->land.lnd_uid, &llp->land);
|
||||
newqp = qp->q_back;
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
qp = newqp;
|
||||
}
|
||||
}
|
||||
|
@ -764,11 +763,11 @@ lnd_check_mines(struct emp_qelem *land_list)
|
|||
lnd_hit_mine(&llp->land, llp->lcp);
|
||||
sect.sct_mines--;
|
||||
putsect(§);
|
||||
putland(llp->land.lnd_uid, (s_char *)&llp->land);
|
||||
putland(llp->land.lnd_uid, &llp->land);
|
||||
if (!llp->land.lnd_own) {
|
||||
stopping = 1;
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -816,7 +815,7 @@ lnd_mess(s_char *str, struct llist *llp)
|
|||
llp->land.lnd_mobil = llp->mobil;
|
||||
putland(llp->land.lnd_uid, &llp->land);
|
||||
emp_remque((struct emp_qelem *)llp);
|
||||
free((s_char *)llp);
|
||||
free(llp);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -856,7 +855,7 @@ lnd_damage(struct emp_qelem *list, int totdam)
|
|||
putland(llp->land.lnd_uid, &llp->land);
|
||||
if (!llp->land.lnd_own) {
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
}
|
||||
}
|
||||
return dam;
|
||||
|
@ -1254,7 +1253,7 @@ lnd_support(natid victim, natid attacker, coord x, coord y, int defending)
|
|||
double range, range2;
|
||||
|
||||
snxtitem_all(&ni, EF_LAND);
|
||||
while (nxtitem(&ni, (s_char *)&land)) {
|
||||
while (nxtitem(&ni, &land)) {
|
||||
if (land.lnd_frg == 0)
|
||||
continue;
|
||||
if ((land.lnd_x == x) && (land.lnd_y == y))
|
||||
|
@ -1336,9 +1335,9 @@ lnd_path(int together, struct lndstr *lp, s_char *buf)
|
|||
}
|
||||
getsect(lp->lnd_x, lp->lnd_y, §);
|
||||
if (lchr[(int)lp->lnd_type].l_flags & L_TRAIN)
|
||||
cp = (s_char *)BestLandPath(buf, §, &d_sect, &dummy, MOB_RAIL);
|
||||
cp = BestLandPath(buf, §, &d_sect, &dummy, MOB_RAIL);
|
||||
else
|
||||
cp = (s_char *)BestLandPath(buf, §, &d_sect, &dummy, MOB_ROAD);
|
||||
cp = BestLandPath(buf, §, &d_sect, &dummy, MOB_ROAD);
|
||||
if (!cp) {
|
||||
pr("No owned path from %s to %s!\n",
|
||||
xyas(lp->lnd_x, lp->lnd_y, player->cnum),
|
||||
|
|
|
@ -309,7 +309,7 @@ build_mission_list_type(struct genlist *mi, coord x, coord y, int mission,
|
|||
/*
|
||||
size = max(sizeof(struct shpstr),sizeof(struct lndstr));
|
||||
size = max(size,sizeof(struct plnstr));
|
||||
block = (s_char *)malloc(size);
|
||||
block = malloc(size);
|
||||
*/
|
||||
size = sizeof(u_block);
|
||||
block = (s_char *)&u_block;
|
||||
|
@ -360,7 +360,7 @@ build_mission_list_type(struct genlist *mi, coord x, coord y, int mission,
|
|||
|
||||
if (opt_SLOW_WAR) {
|
||||
if (mission != MI_AIR_DEFENSE) {
|
||||
getsect(x, y, (s_char *)§);
|
||||
getsect(x, y, §);
|
||||
if (getrel(getnatp(gp->own), sect.sct_own) > AT_WAR) {
|
||||
|
||||
/*
|
||||
|
@ -377,7 +377,7 @@ build_mission_list_type(struct genlist *mi, coord x, coord y, int mission,
|
|||
}
|
||||
}
|
||||
|
||||
glp = (struct genlist *)malloc(sizeof(struct genlist));
|
||||
glp = malloc(sizeof(struct genlist));
|
||||
memset(glp, 0, sizeof(struct genlist));
|
||||
glp->x = gp->x;
|
||||
glp->y = gp->y;
|
||||
|
@ -393,7 +393,7 @@ build_mission_list_type(struct genlist *mi, coord x, coord y, int mission,
|
|||
glp->cp = (s_char *)&plchr[(int)gp->type];
|
||||
break;
|
||||
}
|
||||
glp->thing = (s_char *)malloc(size);
|
||||
glp->thing = malloc(size);
|
||||
memcpy(glp->thing, block, size);
|
||||
emp_insque(&glp->queue, &mi[gp->own].queue);
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ find_escorts(coord x, coord y, natid cn, struct emp_qelem *escorts)
|
|||
int dist;
|
||||
|
||||
snxtitem_all(&ni, EF_PLANE);
|
||||
while (nxtitem(&ni, (s_char *)&plane)) {
|
||||
while (nxtitem(&ni, &plane)) {
|
||||
if (plane.pln_own != cn)
|
||||
continue;
|
||||
|
||||
|
@ -420,7 +420,7 @@ find_escorts(coord x, coord y, natid cn, struct emp_qelem *escorts)
|
|||
if (dist > ((int)((float)plane.pln_range / 2.0)))
|
||||
continue;
|
||||
|
||||
plp = (struct plist *)malloc(sizeof(struct plist));
|
||||
plp = malloc(sizeof(struct plist));
|
||||
memset(plp, 0, sizeof(struct plist));
|
||||
plp->pcp = &plchr[(int)plane.pln_type];
|
||||
plp->plane = plane;
|
||||
|
@ -656,7 +656,7 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
|
|||
continue;
|
||||
|
||||
/* save planes for later */
|
||||
plp = (struct plist *)malloc(sizeof(struct plist));
|
||||
plp = malloc(sizeof(struct plist));
|
||||
|
||||
memset(plp, 0, sizeof(struct plist));
|
||||
plp->pcp = pcp;
|
||||
|
@ -689,7 +689,7 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
|
|||
qp = qp->q_forw;
|
||||
|
||||
free(glp->thing);
|
||||
free((s_char *)glp);
|
||||
free(glp);
|
||||
}
|
||||
return dam;
|
||||
}
|
||||
|
@ -779,14 +779,14 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
|
|||
qp = qp->q_forw;
|
||||
|
||||
free(glp->thing);
|
||||
free((s_char *)glp);
|
||||
free(glp);
|
||||
}
|
||||
|
||||
qp = escorts.q_forw;
|
||||
while (qp != (&escorts)) {
|
||||
newqp = qp->q_forw;
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
qp = newqp;
|
||||
}
|
||||
|
||||
|
@ -794,7 +794,7 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
|
|||
while (qp != (&bombers)) {
|
||||
newqp = qp->q_forw;
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
qp = newqp;
|
||||
}
|
||||
|
||||
|
@ -906,7 +906,7 @@ show_mission(int type, struct nstr_item *np)
|
|||
|
||||
size = max(sizeof(struct lndstr), sizeof(struct plnstr));
|
||||
size = max(size, sizeof(struct shpstr));
|
||||
block = (s_char *)malloc(size);
|
||||
block = malloc(size);
|
||||
|
||||
while (nxtitem(np, block)) {
|
||||
gp = (struct genitem *)block;
|
||||
|
@ -1018,20 +1018,20 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
|
|||
|
||||
if (pp->pln_effic < 40) {
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pp->pln_mobil < 1) {
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (opt_MARKET) {
|
||||
if (ontradingblock(EF_PLANE, (int *)pp)) {
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -1060,7 +1060,7 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
|
|||
}
|
||||
if (bad) {
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
continue;
|
||||
}
|
||||
if (bad1 == 2) {
|
||||
|
@ -1074,7 +1074,7 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
|
|||
}
|
||||
if (bad1) {
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -1089,7 +1089,7 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
|
|||
}
|
||||
if (bad) {
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -1099,7 +1099,7 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
|
|||
pp->pln_effic = 0;
|
||||
putplane(pp->pln_uid, pp);
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
continue;
|
||||
}
|
||||
if (!can_be_on_ship(pp->pln_uid, ship.shp_uid)) {
|
||||
|
@ -1113,7 +1113,7 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
|
|||
((ship.shp_own != pp->pln_own) &&
|
||||
(getrel(getnatp(ship.shp_own), pp->pln_own) != ALLIED))) {
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -1123,7 +1123,7 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
|
|||
pp->pln_effic = 0;
|
||||
putplane(pp->pln_uid, pp);
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
continue;
|
||||
}
|
||||
if (!(pcp->pl_flags & P_E))
|
||||
|
@ -1136,14 +1136,14 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
|
|||
((land.lnd_own != pp->pln_own) &&
|
||||
(getrel(getnatp(land.lnd_own), pp->pln_own) != ALLIED))) {
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Can't fly off units in ships or other units */
|
||||
if ((land.lnd_ship >= 0) || (land.lnd_land >= 0)) {
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -1152,7 +1152,7 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
|
|||
/* If we can't get the sector, we can't check it, and can't fly */
|
||||
if (!getsect(pp->pln_x, pp->pln_y, §)) {
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
continue;
|
||||
}
|
||||
/* First, check allied status */
|
||||
|
@ -1160,14 +1160,14 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
|
|||
if ((sect.sct_own != pp->pln_own) &&
|
||||
(getrel(getnatp(sect.sct_own), pp->pln_own) != ALLIED)) {
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
continue;
|
||||
}
|
||||
/* non-vtol plane */
|
||||
if ((pcp->pl_flags & P_V) == 0) {
|
||||
if ((sect.sct_type != SCT_AIRPT) || (sect.sct_effic < 40)) {
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -1175,7 +1175,7 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
|
|||
if (pcp->pl_flags & P_A) {
|
||||
if (roll(100) > pln_identchance(pp, hardtarget, EF_SHIP)) {
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -1210,7 +1210,7 @@ mission_pln_arm(struct emp_qelem *list, coord x, coord y, int dist,
|
|||
|
||||
if (mission_pln_equip(plp, ip, flags, mission) < 0) {
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
continue;
|
||||
}
|
||||
if (flags & (P_S | P_I)) {
|
||||
|
@ -1371,7 +1371,7 @@ add_airport(struct emp_qelem *airp, coord x, coord y)
|
|||
struct airport *a;
|
||||
struct sctstr sect;
|
||||
|
||||
a = (struct airport *)malloc(sizeof(struct airport));
|
||||
a = malloc(sizeof(struct airport));
|
||||
|
||||
a->x = x;
|
||||
a->y = y;
|
||||
|
@ -1554,7 +1554,7 @@ air_defense(coord x, coord y, natid victim, struct emp_qelem *bomb_list,
|
|||
|
||||
dist = mapdist(x, y, gp->x, gp->y);
|
||||
|
||||
plp = (struct plist *)malloc(sizeof(struct plist));
|
||||
plp = malloc(sizeof(struct plist));
|
||||
memset(plp, 0, sizeof(struct plist));
|
||||
plp->pcp = (struct plchrstr *)glp->cp;
|
||||
memcpy(&plp->plane, glp->thing, sizeof(struct plnstr));
|
||||
|
@ -1594,7 +1594,7 @@ air_defense(coord x, coord y, natid victim, struct emp_qelem *bomb_list,
|
|||
/* Free it up and continue */
|
||||
emp_remque(qp);
|
||||
glp = (struct genlist *)qp;
|
||||
free((s_char *)glp);
|
||||
free(glp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1704,7 +1704,7 @@ air_defense(coord x, coord y, natid victim, struct emp_qelem *bomb_list,
|
|||
next = qp->q_forw;
|
||||
glp = (struct genlist *)qp;
|
||||
free(glp->thing);
|
||||
free((s_char *)glp);
|
||||
free(glp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ msl_sel(struct emp_qelem *list, coord x, coord y, natid victim,
|
|||
|
||||
emp_initque(list);
|
||||
snxtitem_all(&ni, EF_PLANE);
|
||||
while (nxtitem(&ni, (s_char *)&plane)) {
|
||||
while (nxtitem(&ni, &plane)) {
|
||||
if (!plane.pln_own)
|
||||
continue;
|
||||
|
||||
|
@ -198,7 +198,7 @@ msl_sel(struct emp_qelem *list, coord x, coord y, natid victim,
|
|||
if (plane.pln_effic < 100)
|
||||
continue;
|
||||
/* got a valid interceptor */
|
||||
irv = (struct plist *)malloc(sizeof(*irv));
|
||||
irv = malloc(sizeof(*irv));
|
||||
irv->state = P_OK;
|
||||
irv->bombs = 0;
|
||||
irv->misc = 0;
|
||||
|
@ -267,7 +267,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
|
|||
pcp = ip->pcp;
|
||||
if (mission_pln_equip(ip, 0, 0, 'i') < 0) {
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
continue;
|
||||
}
|
||||
/* got one interceptor, delete from irv_list and
|
||||
|
@ -286,7 +286,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
|
|||
pcp = ip->pcp;
|
||||
if (mission_pln_equip(ip, 0, 0, 'i') < 0) {
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
continue;
|
||||
}
|
||||
/* got one interceptor, delete from irv_list and
|
||||
|
@ -301,7 +301,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
|
|||
while (!QEMPTY(irvlist)) {
|
||||
qp = irvlist->q_forw;
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
}
|
||||
if (icount == 0) {
|
||||
if (sect.sct_own != 0)
|
||||
|
@ -348,7 +348,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
|
|||
pp->pln_own = 0;
|
||||
putplane(pp->pln_uid, pp);
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
if (destroyed)
|
||||
break;
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
|
|||
while (!QEMPTY(intlist)) {
|
||||
qp = intlist->q_forw;
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
}
|
||||
if (destroyed)
|
||||
return (destroyed);
|
||||
|
|
|
@ -339,7 +339,7 @@ pln_sel(struct nstr_item *ni, struct emp_qelem *list, struct sctstr *ap,
|
|||
unsigned int x;
|
||||
|
||||
emp_initque(list);
|
||||
while (nxtitem(ni, (s_char *)&plane)) {
|
||||
while (nxtitem(ni, &plane)) {
|
||||
if (!player->owner)
|
||||
continue;
|
||||
if (plane.pln_mobil <= 0)
|
||||
|
@ -503,7 +503,7 @@ pln_sel(struct nstr_item *ni, struct emp_qelem *list, struct sctstr *ap,
|
|||
pr("%s standing by\n", prplane(&plane));
|
||||
plane.pln_mission = 0;
|
||||
putplane(plane.pln_uid, &plane);
|
||||
plp = (struct plist *)malloc(sizeof(struct plist));
|
||||
plp = malloc(sizeof(struct plist));
|
||||
plp->state = P_OK;
|
||||
plp->misc = 0;
|
||||
plp->bombs = 0;
|
||||
|
@ -526,7 +526,7 @@ pln_arm(struct emp_qelem *list, int dist, int mission, struct ichrstr *ip,
|
|||
plp = (struct plist *)qp;
|
||||
if (pln_equip(plp, ip, flags, mission) < 0) {
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
continue;
|
||||
}
|
||||
if (flags & (P_S | P_I)) {
|
||||
|
@ -732,7 +732,7 @@ pln_put(struct emp_qelem *list)
|
|||
putplane(pp->pln_uid, pp);
|
||||
newqp = qp->q_forw;
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
qp = newqp;
|
||||
}
|
||||
}
|
||||
|
@ -759,7 +759,7 @@ pln_removedupes(struct emp_qelem *bomb_list, struct emp_qelem *esc_list)
|
|||
escp = (struct plist *)esc;
|
||||
if (escp->plane.pln_uid == bombp->plane.pln_uid) {
|
||||
emp_remque(esc);
|
||||
free((s_char *)esc);
|
||||
free(esc);
|
||||
esc = esc_list;
|
||||
} else
|
||||
esc = esc->q_forw;
|
||||
|
@ -991,7 +991,7 @@ count_planes(struct shpstr *sp)
|
|||
|
||||
mcp = &mchr[(int)sp->shp_type];
|
||||
snxtitem_xy(&ni, EF_PLANE, sp->shp_x, sp->shp_y);
|
||||
while (nxtitem(&ni, (s_char *)&plane)) {
|
||||
while (nxtitem(&ni, &plane)) {
|
||||
if (plane.pln_own == 0)
|
||||
continue;
|
||||
if (plane.pln_ship == sp->shp_uid) {
|
||||
|
@ -1025,7 +1025,7 @@ count_land_planes(struct lndstr *lp)
|
|||
return;
|
||||
|
||||
snxtitem_all(&ni, EF_PLANE);
|
||||
while (nxtitem(&ni, (s_char *)&plane)) {
|
||||
while (nxtitem(&ni, &plane)) {
|
||||
if (plane.pln_own == 0)
|
||||
continue;
|
||||
if (plane.pln_land == lp->lnd_uid)
|
||||
|
@ -1046,7 +1046,7 @@ count_sect_planes(struct sctstr *sp)
|
|||
struct plnstr plane;
|
||||
|
||||
snxtitem_all(&ni, EF_PLANE);
|
||||
while (nxtitem(&ni, (s_char *)&plane)) {
|
||||
while (nxtitem(&ni, &plane)) {
|
||||
if (!plane.pln_own)
|
||||
continue;
|
||||
if (plane.pln_flags & PLN_LAUNCHED)
|
||||
|
|
|
@ -246,7 +246,7 @@ pr_hilite(s_char *buf)
|
|||
register s_char c;
|
||||
s_char *p;
|
||||
|
||||
p = (s_char *)malloc(strlen(buf) + 1);
|
||||
p = malloc(strlen(buf) + 1);
|
||||
strcpy(p, buf);
|
||||
for (bp = p; 0 != (c = *bp); bp++)
|
||||
if (isprint(c))
|
||||
|
|
|
@ -87,20 +87,20 @@ radmap2(int owner,
|
|||
int changed = 0;
|
||||
|
||||
if (!radbuf)
|
||||
radbuf = (s_char *)malloc((WORLD_Y * (WORLD_X + 1)) *
|
||||
radbuf = malloc((WORLD_Y * (WORLD_X + 1)) *
|
||||
sizeof(s_char));
|
||||
if (!visbuf)
|
||||
visbuf = (s_char *)malloc((WORLD_Y * (WORLD_X + 1)) *
|
||||
visbuf = malloc((WORLD_Y * (WORLD_X + 1)) *
|
||||
sizeof(s_char));
|
||||
if (!rad) {
|
||||
rad = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
|
||||
rad = malloc(WORLD_Y * sizeof(s_char *));
|
||||
if (rad && radbuf) {
|
||||
for (x = 0; x < WORLD_Y; x++)
|
||||
rad[x] = &radbuf[(WORLD_X + 1) * x];
|
||||
}
|
||||
}
|
||||
if (!vis) {
|
||||
vis = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
|
||||
vis = malloc(WORLD_Y * sizeof(s_char *));
|
||||
if (vis && visbuf) {
|
||||
for (x = 0; x < WORLD_Y; x++)
|
||||
vis[x] = &visbuf[(WORLD_X + 1) * x];
|
||||
|
|
|
@ -101,7 +101,7 @@ retreat_ship(struct shpstr *sp, s_char code)
|
|||
buf[0] = sp->shp_fleet;
|
||||
buf[1] = 0;
|
||||
snxtitem(&ni, EF_SHIP, buf);
|
||||
while (nxtitem(&ni, (s_char *)&ship))
|
||||
while (nxtitem(&ni, &ship))
|
||||
if ((ship.shp_fleet == buf[0]) &&
|
||||
(ship.shp_own == sp->shp_own)) {
|
||||
if (ship.shp_uid == sp->shp_uid) {
|
||||
|
@ -402,7 +402,7 @@ retreat_land(struct lndstr *lp, s_char code)
|
|||
buf[0] = lp->lnd_army;
|
||||
buf[1] = 0;
|
||||
snxtitem(&ni, EF_SHIP, buf);
|
||||
while (nxtitem(&ni, (s_char *)&land))
|
||||
while (nxtitem(&ni, &land))
|
||||
if ((land.lnd_army == buf[0]) && (land.lnd_own == lp->lnd_own)) {
|
||||
if (land.lnd_uid == lp->lnd_uid) {
|
||||
retreat_land1(lp, code, 1);
|
||||
|
|
|
@ -70,10 +70,10 @@ satmap(int x, int y, int eff, int range, int flags, int type)
|
|||
return;
|
||||
|
||||
if (!radbuf)
|
||||
radbuf = (s_char *)malloc((WORLD_Y * (WORLD_X + 1)) *
|
||||
radbuf = malloc((WORLD_Y * (WORLD_X + 1)) *
|
||||
sizeof(s_char));
|
||||
if (!rad) {
|
||||
rad = (s_char **)malloc(WORLD_Y * sizeof(s_char *));
|
||||
rad = malloc(WORLD_Y * sizeof(s_char *));
|
||||
if (rad && radbuf) {
|
||||
for (rx = 0; rx < WORLD_Y; rx++)
|
||||
rad[rx] = &radbuf[(WORLD_X + 1) * rx];
|
||||
|
|
|
@ -71,7 +71,7 @@ shp_sel(struct nstr_item *ni, struct emp_qelem *list)
|
|||
struct mlist *mlp;
|
||||
|
||||
emp_initque(list);
|
||||
while (nxtitem(ni, (s_char *)&ship)) {
|
||||
while (nxtitem(ni, &ship)) {
|
||||
if (!player->owner)
|
||||
continue;
|
||||
mcp = &mchr[(int)ship.shp_type];
|
||||
|
@ -103,7 +103,7 @@ shp_sel(struct nstr_item *ni, struct emp_qelem *list)
|
|||
ship.shp_rflags = 0;
|
||||
memset(ship.shp_rpath, 0, sizeof(ship.shp_rpath));
|
||||
putship(ship.shp_uid, &ship);
|
||||
mlp = (struct mlist *)malloc(sizeof(struct mlist));
|
||||
mlp = malloc(sizeof(struct mlist));
|
||||
mlp->mcp = mcp;
|
||||
mlp->ship = ship;
|
||||
mlp->mobil = (double)ship.shp_mobil;
|
||||
|
@ -136,7 +136,7 @@ shp_nav(struct emp_qelem *list, double *minmobp, double *maxmobp,
|
|||
mpr(actor, "%s was sunk at %s\n",
|
||||
prship(&ship), xyas(ship.shp_x, ship.shp_y, actor));
|
||||
emp_remque((struct emp_qelem *)mlp);
|
||||
free((s_char *)mlp);
|
||||
free(mlp);
|
||||
continue;
|
||||
}
|
||||
if (opt_SAIL) {
|
||||
|
@ -203,7 +203,7 @@ shp_put(struct emp_qelem *list, natid actor)
|
|||
putship(mlp->ship.shp_uid, &mlp->ship);
|
||||
newqp = qp->q_back;
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
qp = newqp;
|
||||
}
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ shp_sweep(struct emp_qelem *ship_list, int verbose, natid actor)
|
|||
if (shp_check_one_mines(mlp)) {
|
||||
stopping = 1;
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
}
|
||||
putship(mlp->ship.shp_uid, &mlp->ship);
|
||||
putsect(§);
|
||||
|
@ -294,7 +294,7 @@ shp_check_one_mines(struct mlist *mlp)
|
|||
if (changed)
|
||||
writemap(actor);
|
||||
putsect(§);
|
||||
putship(mlp->ship.shp_uid, (s_char *)&mlp->ship);
|
||||
putship(mlp->ship.shp_uid, &mlp->ship);
|
||||
if (!mlp->ship.shp_own)
|
||||
return 1;
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ shp_check_mines(struct emp_qelem *ship_list)
|
|||
if (shp_check_one_mines(mlp)) {
|
||||
stopping = 1;
|
||||
emp_remque(qp);
|
||||
free((s_char *)qp);
|
||||
free(qp);
|
||||
}
|
||||
}
|
||||
return stopping;
|
||||
|
@ -363,7 +363,7 @@ shp_mess(s_char *str, struct mlist *mlp)
|
|||
mlp->ship.shp_mobil = (int)mlp->mobil;
|
||||
putship(mlp->ship.shp_uid, &mlp->ship);
|
||||
emp_remque((struct emp_qelem *)mlp);
|
||||
free((s_char *)mlp);
|
||||
free(mlp);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -417,7 +417,7 @@ shp_damage_one(struct mlist *mlp, int dam)
|
|||
putship(mlp->ship.shp_uid, &mlp->ship);
|
||||
if (!mlp->ship.shp_own) {
|
||||
emp_remque((struct emp_qelem *)mlp);
|
||||
free((s_char *)mlp);
|
||||
free(mlp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1008,8 +1008,8 @@ shp_path(int together, struct shpstr *shp, s_char *buf)
|
|||
return 0;
|
||||
}
|
||||
|
||||
cp = (s_char *)BestShipPath(buf, shp->shp_x, shp->shp_y,
|
||||
d_sect.sct_x, d_sect.sct_y, player->cnum);
|
||||
cp = BestShipPath(buf, shp->shp_x, shp->shp_y,
|
||||
d_sect.sct_x, d_sect.sct_y, player->cnum);
|
||||
if (!cp || shp->shp_mobil <= 0) {
|
||||
mpr(shp->shp_own, "Can't get to '%s' right now.\n",
|
||||
xyas(d_sect.sct_x, d_sect.sct_y, player->cnum));
|
||||
|
@ -1029,7 +1029,7 @@ shp_missdef(struct shpstr *sp, natid victim)
|
|||
|
||||
emp_initque(&list);
|
||||
|
||||
mlp = (struct mlist *)malloc(sizeof(struct mlist));
|
||||
mlp = malloc(sizeof(struct mlist));
|
||||
mlp->mcp = &mchr[(int)sp->shp_type];
|
||||
mlp->ship = *sp;
|
||||
mlp->mobil = (double)sp->shp_mobil;
|
||||
|
|
|
@ -262,7 +262,7 @@ s_commod(int own, int x, int y, i_type type, int total_wanted,
|
|||
/* look for an owned ship in a harbor */
|
||||
snxtitem_dist(&ni, EF_SHIP, x, y, lookrange);
|
||||
|
||||
while (nxtitem(&ni, (s_char *)&ship) && wanted) {
|
||||
while (nxtitem(&ni, &ship) && wanted) {
|
||||
if (ship.shp_own != own)
|
||||
continue;
|
||||
|
||||
|
@ -335,7 +335,7 @@ s_commod(int own, int x, int y, i_type type, int total_wanted,
|
|||
/* look for an owned supply unit */
|
||||
snxtitem_dist(&ni, EF_LAND, x, y, lookrange);
|
||||
|
||||
while (nxtitem(&ni, (s_char *)&land) && wanted) {
|
||||
while (nxtitem(&ni, &land) && wanted) {
|
||||
int min;
|
||||
|
||||
if (land.lnd_own != own)
|
||||
|
|
|
@ -139,7 +139,7 @@ trade_desc(struct trdstr *tp, union trdgenstr *tgp)
|
|||
pr("] #%d", tp->trd_unitid);
|
||||
if (opt_SHOWPLANE) {
|
||||
snxtitem_all(&ni, EF_PLANE);
|
||||
while (nxtitem(&ni, (s_char *)&plane)) {
|
||||
while (nxtitem(&ni, &plane)) {
|
||||
if (plane.pln_ship == sp->shp_uid && plane.pln_own != 0) {
|
||||
pr("\n\t\t\t\t tech %3d %3d%% %s #%d",
|
||||
plane.pln_tech,
|
||||
|
@ -151,7 +151,7 @@ trade_desc(struct trdstr *tp, union trdgenstr *tgp)
|
|||
}
|
||||
}
|
||||
snxtitem_all(&ni, EF_LAND);
|
||||
while (nxtitem(&ni, (s_char *)&land)) {
|
||||
while (nxtitem(&ni, &land)) {
|
||||
if (land.lnd_ship == sp->shp_uid && land.lnd_own != 0) {
|
||||
pr("\n\t\t\t\t tech %3d %3d%% %s #%d",
|
||||
land.lnd_tech,
|
||||
|
@ -159,7 +159,7 @@ trade_desc(struct trdstr *tp, union trdgenstr *tgp)
|
|||
lchr[(int)land.lnd_type].l_name, land.lnd_uid);
|
||||
if (land.lnd_nxlight) {
|
||||
snxtitem_all(&ni, EF_PLANE);
|
||||
while (nxtitem(&ni, (s_char *)&plane)) {
|
||||
while (nxtitem(&ni, &plane)) {
|
||||
if (plane.pln_land == land.lnd_uid) {
|
||||
pr("\n\t\t\t\t tech %3d %3d%% %s #%d",
|
||||
plane.pln_tech,
|
||||
|
@ -197,7 +197,7 @@ trade_desc(struct trdstr *tp, union trdgenstr *tgp)
|
|||
pr("] #%d", tp->trd_unitid);
|
||||
if (opt_SHOWPLANE) {
|
||||
snxtitem_all(&ni, EF_PLANE);
|
||||
while (nxtitem(&ni, (s_char *)&plane)) {
|
||||
while (nxtitem(&ni, &plane)) {
|
||||
if (plane.pln_land == lp->lnd_uid && plane.pln_own != 0) {
|
||||
pr("\n\t\t\t\t tech %3d %3d%% %s #%d",
|
||||
plane.pln_tech,
|
||||
|
@ -233,7 +233,7 @@ trade_desc(struct trdstr *tp, union trdgenstr *tgp)
|
|||
int
|
||||
trade_getitem(struct trdstr *tp, union trdgenstr *tgp)
|
||||
{
|
||||
if (!ef_read(tp->trd_type, tp->trd_unitid, (s_char *)tgp))
|
||||
if (!ef_read(tp->trd_type, tp->trd_unitid, tgp))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ trechk(register natid actor, register natid victim, int provision)
|
|||
for (cn = 0; cn < MAXNOC; cn++)
|
||||
involved[cn] = 0;
|
||||
snxtitem_all(&nstr, EF_TREATY);
|
||||
while (nxtitem(&nstr, (s_char *)&treaty)) {
|
||||
while (nxtitem(&nstr, &treaty)) {
|
||||
if (treaty.trt_status == TS_FREE)
|
||||
continue;
|
||||
if (treaty.trt_exp < now)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue