(bzero, bcopy): Obsolete BSDisms; remove. Remove some calls without
effect. Replace calls by struct assignment where possible. Replace clear buffer, copy string to buffer by strncpy(). Use assignment to clear when that's clearer. Replace overlapping copy through bounce buffer by memmove(). Replace rest by standard memset() and memcpy(). Also use sizeof() instead of literal array sizes for robustness, and instead of symbolic array sizes for clarity.
This commit is contained in:
parent
2910da23ea
commit
4ae9c417b3
79 changed files with 172 additions and 256 deletions
|
@ -110,19 +110,18 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
|
|||
a sector, and then overfly some land units or ships, we don't want to
|
||||
potentially intercept 3 times. */
|
||||
|
||||
bzero((s_char *)&head, sizeof(struct shiplook));
|
||||
memset(&head, 0, sizeof(struct shiplook));
|
||||
head.uid = -1;
|
||||
|
||||
plp = (struct plist *)bomb_list->q_forw;
|
||||
plane_owner = plp->plane.pln_own;
|
||||
|
||||
bzero((s_char *)mypath, 1024);
|
||||
bcopy(path, mypath, strlen(path));
|
||||
strncpy(mypath, path, sizeof(mypath));
|
||||
myp = 0;
|
||||
|
||||
bzero((s_char *)overfly, sizeof(overfly));
|
||||
bzero((s_char *)gotilist, sizeof(gotilist));
|
||||
bzero((s_char *)unfriendly, sizeof(unfriendly));
|
||||
memset(overfly, 0, sizeof(overfly));
|
||||
memset(gotilist, 0, sizeof(gotilist));
|
||||
memset(unfriendly, 0, sizeof(unfriendly));
|
||||
for (cn = 1; cn < MAXNOC; cn++) {
|
||||
if ((mynatp = getnatp(cn)) == 0)
|
||||
continue;
|
||||
|
@ -294,7 +293,7 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
|
|||
|
||||
/* Something made it through */
|
||||
/* Go figure out if there are ships in this sector, and who's they are */
|
||||
bzero((s_char *)nats, sizeof(nats));
|
||||
memset(nats, 0, sizeof(nats));
|
||||
snxtitem_xy(&ni, EF_SHIP, x, y);
|
||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
||||
if (mchr[(int)ship.shp_type].m_flags & M_SUB)
|
||||
|
@ -302,7 +301,7 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
|
|||
nats[ship.shp_own]++;
|
||||
}
|
||||
/* Go figure out if there are units in this sector, and who's they are */
|
||||
bzero((s_char *)lnats, sizeof(lnats));
|
||||
memset(lnats, 0, sizeof(lnats));
|
||||
snxtitem_xy(&ni, EF_LAND, x, y);
|
||||
while (nxtitem(&ni, (s_char *)&land)) {
|
||||
lnats[land.lnd_own]++;
|
||||
|
@ -736,7 +735,7 @@ ac_planedamage(struct plist *plp, natid from, int dam, natid other,
|
|||
strcpy(mesg, dmess);
|
||||
return;
|
||||
}
|
||||
bzero(dmess, 255);
|
||||
memset(dmess, 0, sizeof(dmess));
|
||||
eff -= dam;
|
||||
if (eff < 0)
|
||||
eff = 0;
|
||||
|
@ -850,7 +849,7 @@ ac_shipflak(struct emp_qelem *list, coord x, coord y)
|
|||
plp = (struct plist *)list->q_forw;
|
||||
plane_owner = plp->plane.pln_own;
|
||||
|
||||
bzero((s_char *)nats, sizeof(nats));
|
||||
memset(nats, 0, sizeof(nats));
|
||||
guns = 0;
|
||||
snxtitem_xy(&ni, EF_SHIP, x, y);
|
||||
while (!QEMPTY(list) && nxtitem(&ni, (s_char *)&ship)) {
|
||||
|
@ -917,7 +916,7 @@ ac_landflak(struct emp_qelem *list, coord x, coord y)
|
|||
plp = (struct plist *)list->q_forw;
|
||||
plane_owner = plp->plane.pln_own;
|
||||
|
||||
bzero((s_char *)nats, sizeof(nats));
|
||||
memset(nats, 0, sizeof(nats));
|
||||
guns = 0;
|
||||
snxtitem_xy(&ni, EF_LAND, x, y);
|
||||
while (!QEMPTY(list) && nxtitem(&ni, (s_char *)&land)) {
|
||||
|
@ -1112,7 +1111,7 @@ getilist(struct emp_qelem *list, natid own, struct emp_qelem *a,
|
|||
ip->bombs = 0;
|
||||
ip->misc = 0;
|
||||
ip->pcp = &plchr[(int)plane.pln_type];
|
||||
bcopy((s_char *)&plane, (s_char *)&ip->plane, sizeof(plane));
|
||||
ip->plane = plane;
|
||||
emp_insque(&ip->queue, list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ set_have_looked(u_char uid, struct shiplook *head)
|
|||
}
|
||||
|
||||
s = (struct shiplook *)malloc(sizeof(struct shiplook));
|
||||
bzero((s_char *)s, sizeof(struct shiplook));
|
||||
memset(s, 0, sizeof(struct shiplook));
|
||||
s2->next = s;
|
||||
s->uid = uid;
|
||||
s->looked = 1;
|
||||
|
@ -137,7 +137,7 @@ set_have_found(u_char uid, struct shiplook *head)
|
|||
}
|
||||
|
||||
s = (struct shiplook *)malloc(sizeof(struct shiplook));
|
||||
bzero((s_char *)s, sizeof(struct shiplook));
|
||||
memset(s, 0, sizeof(struct shiplook));
|
||||
s2->next = s;
|
||||
s->uid = uid;
|
||||
s->found = 1;
|
||||
|
|
|
@ -115,7 +115,7 @@ static int get_land(int combat_mode, struct combat *def, int uid,
|
|||
int
|
||||
att_combat_init(struct combat *com, int type)
|
||||
{
|
||||
bzero((s_char *)com, sizeof(*com));
|
||||
memset(com, 0, sizeof(*com));
|
||||
com->type = type;
|
||||
return type;
|
||||
}
|
||||
|
@ -429,7 +429,7 @@ put_combat(struct combat *com)
|
|||
if (com->own == player->cnum) {
|
||||
land.lnd_mission = 0;
|
||||
land.lnd_rflags = 0;
|
||||
bzero(land.lnd_rpath, RET_LEN);
|
||||
memset(land.lnd_rpath, 0, sizeof(land.lnd_rpath));
|
||||
}
|
||||
putland(com->lnd_uid, &land);
|
||||
break;
|
||||
|
@ -456,7 +456,7 @@ put_combat(struct combat *com)
|
|||
if (com->own == player->cnum) {
|
||||
ship.shp_mission = 0;
|
||||
ship.shp_rflags = 0;
|
||||
bzero(ship.shp_rpath, RET_LEN);
|
||||
memset(ship.shp_rpath, 0, sizeof(ship.shp_rpath));
|
||||
}
|
||||
putship(com->shp_uid, &ship);
|
||||
}
|
||||
|
@ -832,7 +832,7 @@ att_ask_offense(int combat_mode, struct combat *off, struct combat *def,
|
|||
emp_initque(olist);
|
||||
if (att_abort(combat_mode, off, def))
|
||||
return 0;
|
||||
bzero(land_answer, sizeof(land_answer));
|
||||
memset(land_answer, 0, sizeof(land_answer));
|
||||
for (n = 0; n <= off->last; ++n) {
|
||||
off[n].troops = ask_off(combat_mode, off + n, def);
|
||||
if (att_abort(combat_mode, off, def))
|
||||
|
@ -1126,7 +1126,7 @@ ask_olist(int combat_mode, struct combat *off, struct combat *def,
|
|||
abort_attack();
|
||||
return;
|
||||
}
|
||||
bzero((s_char *)llp, sizeof(struct llist));
|
||||
memset(llp, 0, sizeof(struct llist));
|
||||
emp_insque(&llp->queue, olist);
|
||||
llp->mobil = mobcost;
|
||||
if (!get_land(combat_mode, def, land.lnd_uid, llp, 0))
|
||||
|
@ -1292,7 +1292,7 @@ get_dlist(struct combat *def, struct emp_qelem *list, int a_spy,
|
|||
abort_attack();
|
||||
return 0;
|
||||
}
|
||||
bzero((s_char *)llp, sizeof(struct llist));
|
||||
memset(llp, 0, sizeof(struct llist));
|
||||
emp_insque(&llp->queue, list);
|
||||
llp->supplied = has_supply(&land);
|
||||
if (!get_land(A_DEFEND, def, land.lnd_uid, llp, 1))
|
||||
|
@ -1629,13 +1629,12 @@ att_reacting_units(struct combat *def, struct emp_qelem *list, int a_spy,
|
|||
llp = (struct llist *)
|
||||
malloc(sizeof(struct llist));
|
||||
|
||||
bzero((s_char *)llp, sizeof(struct llist));
|
||||
memset(llp, 0, sizeof(struct llist));
|
||||
llp->supplied = supply_state;
|
||||
llp->x = origx;
|
||||
llp->y = origy;
|
||||
llp->lcp = &lchr[(int)land.lnd_type];
|
||||
bcopy((s_char *)&land, (s_char *)&llp->land,
|
||||
sizeof(struct lndstr));
|
||||
llp->land = land;
|
||||
emp_insque(&llp->queue, list);
|
||||
if (lnd_spyval(&land) > *d_spyp)
|
||||
*d_spyp = lnd_spyval(&land);
|
||||
|
@ -2372,7 +2371,7 @@ ask_move_in(struct combat *off, struct emp_qelem *olist,
|
|||
|
||||
if (QEMPTY(olist))
|
||||
return;
|
||||
bzero(land_answer, sizeof(land_answer));
|
||||
memset(land_answer, 0, sizeof(land_answer));
|
||||
for (qp = olist->q_forw; qp != olist; qp = next) {
|
||||
next = qp->q_forw;
|
||||
llp = (struct llist *)qp;
|
||||
|
|
|
@ -55,7 +55,7 @@ lnd_postread(int n, s_char *ptr)
|
|||
if (llp->lnd_uid != n) {
|
||||
logerror("lnd_postread: Error - %d != %d, zeroing.\n",
|
||||
llp->lnd_uid, n);
|
||||
bzero(ptr, sizeof(struct lndstr));
|
||||
memset(llp, 0, sizeof(struct lndstr));
|
||||
}
|
||||
if (llp->lnd_ship >= 0 && llp->lnd_own
|
||||
&& llp->lnd_effic >= LAND_MINEFF) {
|
||||
|
|
|
@ -383,9 +383,9 @@ intelligence_report(int destination, struct lndstr *lp, int spy,
|
|||
|
||||
lcp = &lchr[(int)lp->lnd_type];
|
||||
|
||||
bzero(buf1, 80);
|
||||
bzero(buf2, 80);
|
||||
bzero(buf3, 80);
|
||||
memset(buf1, 0, sizeof(buf1));
|
||||
memset(buf2, 0, sizeof(buf2));
|
||||
memset(buf3, 0, sizeof(buf3));
|
||||
if (chance((double)(spy + lp->lnd_vis) / 10.0)) {
|
||||
if (destination == player->cnum)
|
||||
pr("%s %s", mess, prland(lp));
|
||||
|
@ -559,12 +559,11 @@ lnd_sel(struct nstr_item *ni, struct emp_qelem *list)
|
|||
land.lnd_mission = 0;
|
||||
land.lnd_rflags = 0;
|
||||
land.lnd_harden = 0;
|
||||
bzero(land.lnd_rpath, RET_LEN);
|
||||
memset(land.lnd_rpath, 0, sizeof(land.lnd_rpath));
|
||||
putland(land.lnd_uid, &land);
|
||||
llp = (struct llist *)malloc(sizeof(struct llist));
|
||||
llp->lcp = lcp;
|
||||
bcopy((s_char *)&land, (s_char *)&llp->land,
|
||||
sizeof(struct lndstr));
|
||||
llp->land = land;
|
||||
llp->mobil = (double)land.lnd_mobil;
|
||||
emp_insque(&llp->queue, list);
|
||||
}
|
||||
|
@ -640,8 +639,7 @@ lnd_mar(struct emp_qelem *list, double *minmobp, double *maxmobp,
|
|||
*minmobp = llp->mobil;
|
||||
if (llp->mobil > *maxmobp)
|
||||
*maxmobp = llp->mobil;
|
||||
bcopy((s_char *)&land, (s_char *)&llp->land,
|
||||
sizeof(struct lndstr));
|
||||
llp->land = land;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ ground_interdict(coord x, coord y, natid victim, s_char *s)
|
|||
struct genlist mi[MAXNOC];
|
||||
int z;
|
||||
|
||||
bzero((s_char *)mi, sizeof(mi));
|
||||
memset(mi, 0, sizeof(mi));
|
||||
for (z = 1; z < MAXNOC; z++)
|
||||
emp_initque((struct emp_qelem *)&mi[z]);
|
||||
|
||||
|
@ -178,7 +178,7 @@ unit_interdict(coord x, coord y, natid victim, s_char *s, int hardtarget,
|
|||
int z;
|
||||
int osubs;
|
||||
|
||||
bzero((s_char *)mi, sizeof(mi));
|
||||
memset(mi, 0, sizeof(mi));
|
||||
for (z = 1; z < MAXNOC; z++)
|
||||
emp_initque((struct emp_qelem *)&mi[z]);
|
||||
|
||||
|
@ -230,7 +230,7 @@ off_support(coord x, coord y, natid victim, natid actee)
|
|||
struct genlist mi[MAXNOC];
|
||||
int z;
|
||||
|
||||
bzero((s_char *)mi, sizeof(mi));
|
||||
memset(mi, 0, sizeof(mi));
|
||||
for (z = 1; z < MAXNOC; z++)
|
||||
emp_initque((struct emp_qelem *)&mi[z]);
|
||||
|
||||
|
@ -251,7 +251,7 @@ def_support(coord x, coord y, natid victim, natid actee)
|
|||
struct genlist mi[MAXNOC];
|
||||
int z;
|
||||
|
||||
bzero((s_char *)mi, sizeof(mi));
|
||||
memset(mi, 0, sizeof(mi));
|
||||
for (z = 1; z < MAXNOC; z++)
|
||||
emp_initque((struct emp_qelem *)&mi[z]);
|
||||
|
||||
|
@ -385,7 +385,7 @@ build_mission_list_type(struct genlist *mi, coord x, coord y, int mission,
|
|||
}
|
||||
|
||||
glp = (struct genlist *)malloc(sizeof(struct genlist));
|
||||
bzero((s_char *)glp, sizeof(struct genlist));
|
||||
memset(glp, 0, sizeof(struct genlist));
|
||||
glp->x = gp->x;
|
||||
glp->y = gp->y;
|
||||
glp->type = type;
|
||||
|
@ -401,7 +401,7 @@ build_mission_list_type(struct genlist *mi, coord x, coord y, int mission,
|
|||
break;
|
||||
}
|
||||
glp->thing = (s_char *)malloc(size);
|
||||
bcopy(block, glp->thing, size);
|
||||
memcpy(glp->thing, block, size);
|
||||
emp_insque(&glp->queue, &mi[gp->own].queue);
|
||||
}
|
||||
}
|
||||
|
@ -428,10 +428,9 @@ find_escorts(coord x, coord y, natid cn, struct emp_qelem *escorts)
|
|||
continue;
|
||||
|
||||
plp = (struct plist *)malloc(sizeof(struct plist));
|
||||
bzero((s_char *)plp, sizeof(struct plist));
|
||||
memset(plp, 0, sizeof(struct plist));
|
||||
plp->pcp = &plchr[(int)plane.pln_type];
|
||||
bcopy((s_char *)&plane, (s_char *)&plp->plane,
|
||||
sizeof(struct plnstr));
|
||||
plp->plane = plane;
|
||||
emp_insque(&plp->queue, escorts);
|
||||
}
|
||||
}
|
||||
|
@ -673,10 +672,9 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
|
|||
/* save planes for later */
|
||||
plp = (struct plist *)malloc(sizeof(struct plist));
|
||||
|
||||
bzero((s_char *)plp, sizeof(struct plist));
|
||||
memset(plp, 0, sizeof(struct plist));
|
||||
plp->pcp = pcp;
|
||||
bcopy(glp->thing, (s_char *)&plp->plane,
|
||||
sizeof(struct plnstr));
|
||||
memcpy(&plp->plane, glp->thing, sizeof(struct plnstr));
|
||||
if (plp->pcp->pl_flags & P_M)
|
||||
emp_insque(&plp->queue, &missiles);
|
||||
else
|
||||
|
@ -1553,7 +1551,7 @@ air_defense(coord x, coord y, natid victim, struct emp_qelem *bomb_list,
|
|||
for (qp = esc_list->q_forw; qp != esc_list; qp = qp->q_forw)
|
||||
count++;
|
||||
|
||||
bzero((s_char *)mi, sizeof(mi));
|
||||
memset(mi, 0, sizeof(mi));
|
||||
for (z = 1; z < MAXNOC; z++)
|
||||
emp_initque((struct emp_qelem *)&mi[z]);
|
||||
|
||||
|
@ -1582,10 +1580,9 @@ 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));
|
||||
bzero((s_char *)plp, sizeof(struct plist));
|
||||
memset(plp, 0, sizeof(struct plist));
|
||||
plp->pcp = (struct plchrstr *)glp->cp;
|
||||
bcopy(glp->thing, (s_char *)&plp->plane,
|
||||
sizeof(struct plnstr));
|
||||
memcpy(&plp->plane, glp->thing, sizeof(struct plnstr));
|
||||
|
||||
/* missiles go one way, so we can use all the range */
|
||||
if (!(plp->pcp->pl_flags & P_M))
|
||||
|
|
|
@ -96,8 +96,7 @@ move_ground(s_char *what, struct sctstr *start, struct sctstr *end,
|
|||
else {
|
||||
pr("Using best path '%s', movement cost %1.3f\n",
|
||||
path, total_mcost);
|
||||
bzero(bpath, 512);
|
||||
bcopy(path, bpath, strlen(path));
|
||||
strncpy(bpath, path, sizeof(bpath));
|
||||
path = bpath;
|
||||
}
|
||||
if ((total_mcost * weight) > mobility) {
|
||||
|
@ -152,8 +151,7 @@ move_ground(s_char *what, struct sctstr *start, struct sctstr *end,
|
|||
} else {
|
||||
pr("Using best path '%s', movement cost %1.3f\n",
|
||||
movstr, mv_cost);
|
||||
bzero(bpath, 512);
|
||||
bcopy(movstr, bpath, strlen(movstr));
|
||||
strncpy(bpath, movstr, sizeof(bpath));
|
||||
movstr = bpath;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,9 +57,9 @@ msl_equip(struct plnstr *pp)
|
|||
{
|
||||
struct plist pl;
|
||||
|
||||
bzero((s_char *)&pl, sizeof(struct plist));
|
||||
memset(&pl, 0, sizeof(struct plist));
|
||||
pl.pcp = plchr + pp->pln_type;
|
||||
bcopy((s_char *)pp, (s_char *)&pl.plane, sizeof(struct plnstr));
|
||||
pl.plane = *pp;
|
||||
return mission_pln_equip(&pl, 0, 0, 'p');
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ msl_sel(struct emp_qelem *list, coord x, coord y, natid victim,
|
|||
irv->bombs = 0;
|
||||
irv->misc = 0;
|
||||
irv->pcp = &plchr[(int)plane.pln_type];
|
||||
bcopy((s_char *)&plane, (s_char *)&irv->plane, sizeof(plane));
|
||||
irv->plane = plane;
|
||||
emp_insque(&irv->queue, list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ nuk_postread(int n, s_char *ptr)
|
|||
if (np->nuk_uid != n) {
|
||||
logerror("nuk_postread: Error - %d != %d, zeroing.\n", np->nuk_uid,
|
||||
n);
|
||||
bzero(ptr, sizeof(struct nukstr));
|
||||
memset(np, 0, sizeof(struct nukstr));
|
||||
}
|
||||
player->owner = (player->god || np->nuk_own == player->cnum);
|
||||
return 1;
|
||||
|
@ -119,7 +119,7 @@ nuk_add(coord x, coord y, int type, int num)
|
|||
nuk_uid = n;
|
||||
if (getnuke(nuk_uid, &nuke) == 0) {
|
||||
ef_extend(EF_NUKE, 10);
|
||||
bzero((s_char *)&nuke, sizeof(struct nukstr));
|
||||
memset(&nuke, 0, sizeof(struct nukstr));
|
||||
nuke.nuk_uid = nuk_uid;
|
||||
nuke.nuk_ship = -1;
|
||||
nuke.nuk_n = 0;
|
||||
|
|
|
@ -55,7 +55,7 @@ pln_postread(int n, s_char *ptr)
|
|||
if (pp->pln_uid != n) {
|
||||
logerror("pln_postread: Error - %d != %d, zeroing.\n", pp->pln_uid,
|
||||
n);
|
||||
bzero(ptr, sizeof(struct plnstr));
|
||||
memset(pp, 0, sizeof(struct plnstr));
|
||||
}
|
||||
|
||||
if (pp->pln_ship >= 0 && pp->pln_own && pp->pln_effic >= PLANE_MINEFF) {
|
||||
|
|
|
@ -460,8 +460,7 @@ pln_sel(struct nstr_item *ni, struct emp_qelem *list, struct sctstr *ap,
|
|||
plp->misc = 0;
|
||||
plp->bombs = 0;
|
||||
plp->pcp = pcp;
|
||||
bcopy((s_char *)&plane, (s_char *)&plp->plane,
|
||||
sizeof(struct plnstr));
|
||||
plp->plane = plane;
|
||||
emp_insque(&plp->queue, list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ radmap2(int owner,
|
|||
return;
|
||||
}
|
||||
|
||||
bzero((s_char *)visbuf, (WORLD_Y * (WORLD_X + 1)));
|
||||
memset(visbuf, 0, (WORLD_Y * (WORLD_X + 1)));
|
||||
range = (int)(range * (eff / 100.0));
|
||||
if (range < 1)
|
||||
range = 1;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "misc.h"
|
||||
#include "player.h"
|
||||
#include "nat.h"
|
||||
|
@ -100,8 +101,8 @@ retreat_ship(struct shpstr *sp, s_char code)
|
|||
s_char buf[2];
|
||||
|
||||
if (sp->shp_rflags & RET_GROUP) {
|
||||
bzero(buf, 2);
|
||||
buf[0] = sp->shp_fleet;
|
||||
buf[1] = 0;
|
||||
snxtitem(&ni, EF_SHIP, buf);
|
||||
while (nxtitem(&ni, (s_char *)&ship))
|
||||
if ((ship.shp_fleet == buf[0]) &&
|
||||
|
@ -149,7 +150,6 @@ retreat_ship1(struct shpstr *sp, s_char code, int orig)
|
|||
struct mchrstr *mcp;
|
||||
int vec[I_MAX + 1];
|
||||
int time_to_stop;
|
||||
s_char buf[RET_LEN - 1];
|
||||
|
||||
sp->shp_mission = 0;
|
||||
if (sp->shp_own == 0)
|
||||
|
@ -247,10 +247,7 @@ retreat_ship1(struct shpstr *sp, s_char code, int orig)
|
|||
return 0;
|
||||
}
|
||||
dir = chkdir(sp->shp_rpath[0], DIR_STOP, DIR_VIEW);
|
||||
bzero(buf, RET_LEN - 1);
|
||||
bcopy(&sp->shp_rpath[1], buf, RET_LEN - 1);
|
||||
bzero(sp->shp_rpath, RET_LEN);
|
||||
bcopy(buf, sp->shp_rpath, RET_LEN - 1);
|
||||
memmove(sp->shp_rpath, sp->shp_rpath+1, sizeof(sp->shp_rpath) - 1);
|
||||
if (dir == -1)
|
||||
continue;
|
||||
if (dir == DIR_STOP)
|
||||
|
@ -397,8 +394,8 @@ retreat_land(struct lndstr *lp, s_char code)
|
|||
s_char buf[2];
|
||||
|
||||
if (lp->lnd_rflags & RET_GROUP) {
|
||||
bzero(buf, 2);
|
||||
buf[0] = lp->lnd_army;
|
||||
buf[1] = 0;
|
||||
snxtitem(&ni, EF_SHIP, buf);
|
||||
while (nxtitem(&ni, (s_char *)&land))
|
||||
if ((land.lnd_army == buf[0]) && (land.lnd_own == lp->lnd_own)) {
|
||||
|
@ -492,10 +489,7 @@ retreat_land1(struct lndstr *lp, s_char code, int orig)
|
|||
return 0;
|
||||
}
|
||||
dir = chkdir(lp->lnd_rpath[0], DIR_STOP, DIR_VIEW);
|
||||
bzero(buf, RET_LEN - 1);
|
||||
bcopy(&lp->lnd_rpath[1], buf, RET_LEN - 1);
|
||||
bzero(lp->lnd_rpath, RET_LEN);
|
||||
bcopy(buf, lp->lnd_rpath, RET_LEN - 1);
|
||||
memmove(lp->lnd_rpath, lp->lnd_rpath+1, sizeof(lp->lnd_rpath) - 1);
|
||||
if (dir == -1)
|
||||
continue;
|
||||
if (dir == DIR_STOP)
|
||||
|
|
|
@ -91,7 +91,7 @@ satmap(int x, int y, int eff, int range, int flags, int type)
|
|||
range = range * (eff / 100.0);
|
||||
pr("%s efficiency %d%%, max range %d\n", xyas(x, y, player->cnum),
|
||||
eff, range);
|
||||
bzero(noise, sizeof(noise));
|
||||
memset(noise, 0, sizeof(noise));
|
||||
if (eff < 100) {
|
||||
pr("Some noise on the transmission...\n");
|
||||
for (n = 0; n < (100 - eff); ++n)
|
||||
|
|
|
@ -55,7 +55,7 @@ shp_postread(int n, s_char *ptr)
|
|||
if (sp->shp_uid != n) {
|
||||
logerror("shp_postread: Error - %d != %d, zeroing.\n", sp->shp_uid,
|
||||
n);
|
||||
bzero(ptr, sizeof(struct shpstr));
|
||||
memset(sp, 0, sizeof(struct shpstr));
|
||||
}
|
||||
|
||||
if (opt_MOB_ACCESS)
|
||||
|
|
|
@ -104,12 +104,11 @@ shp_sel(struct nstr_item *ni, struct emp_qelem *list)
|
|||
*/
|
||||
ship.shp_mission = 0;
|
||||
ship.shp_rflags = 0;
|
||||
bzero(ship.shp_rpath, RET_LEN);
|
||||
memset(ship.shp_rpath, 0, sizeof(ship.shp_rpath));
|
||||
putship(ship.shp_uid, &ship);
|
||||
mlp = (struct mlist *)malloc(sizeof(struct mlist));
|
||||
mlp->mcp = mcp;
|
||||
bcopy((s_char *)&ship, (s_char *)&mlp->ship,
|
||||
sizeof(struct shpstr));
|
||||
mlp->ship = ship;
|
||||
mlp->mobil = (double)ship.shp_mobil;
|
||||
emp_insque(&mlp->queue, list);
|
||||
}
|
||||
|
@ -190,8 +189,7 @@ shp_nav(struct emp_qelem *list, double *minmobp, double *maxmobp,
|
|||
*minmobp = mlp->mobil;
|
||||
if (mlp->mobil > *maxmobp)
|
||||
*maxmobp = mlp->mobil;
|
||||
bcopy((s_char *)&ship, (s_char *)&mlp->ship,
|
||||
sizeof(struct shpstr));
|
||||
mlp->ship = ship;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1051,7 +1049,7 @@ shp_missdef(struct shpstr *sp, natid victim)
|
|||
|
||||
mlp = (struct mlist *)malloc(sizeof(struct mlist));
|
||||
mlp->mcp = &mchr[(int)sp->shp_type];
|
||||
bcopy((s_char *)sp, (s_char *)&mlp->ship, sizeof(struct shpstr));
|
||||
mlp->ship = *sp;
|
||||
mlp->mobil = (double)sp->shp_mobil;
|
||||
emp_insque(&mlp->queue, &list);
|
||||
sprintf(buf, "%s", prship(&mlp->ship));
|
||||
|
|
|
@ -398,7 +398,7 @@ s_commod(int own, int x, int y, int type, int total_wanted,
|
|||
int hold;
|
||||
struct lndstr l2;
|
||||
|
||||
bcopy((s_char *)&land, (s_char *)&l2, sizeof(struct lndstr));
|
||||
l2 = land;
|
||||
hold = vec[type];
|
||||
vec[type] = 0;
|
||||
putvec(VT_ITEM, vec, (s_char *)&land, EF_LAND);
|
||||
|
|
|
@ -69,7 +69,7 @@ takeover(register struct sctstr *sp, natid newown)
|
|||
extern int sect_mob_neg_factor;
|
||||
|
||||
/* Wipe all the distribution info */
|
||||
bzero((s_char *)vec, sizeof(vec));
|
||||
memset(vec, 0, sizeof(vec));
|
||||
putvec(VT_DIST, vec, (s_char *)sp, EF_SECTOR);
|
||||
putvec(VT_DEL, vec, (s_char *)sp, EF_SECTOR);
|
||||
if (sp->sct_own == 0)
|
||||
|
@ -240,7 +240,7 @@ takeover_ship(register struct shpstr *sp, natid newown, int hostile)
|
|||
sp->shp_rflags = 0;
|
||||
/* Keep track of when this was taken over */
|
||||
time(&sp->shp_access);
|
||||
bzero(sp->shp_rpath, RET_LEN);
|
||||
memset(sp->shp_rpath, 0, sizeof(sp->shp_rpath));
|
||||
pp = &p;
|
||||
lp = &llp;
|
||||
/* Take over planes */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue