Streamline plist initialization
msl_equip(), find_escorts() and perform_mission() memset() the plist, then assign to all members but load. Just zero load instead, like getilists(), msl_sel() and pln_sel() do.
This commit is contained in:
parent
48f3d1c033
commit
bad2fd5aac
2 changed files with 3 additions and 4 deletions
|
@ -354,7 +354,7 @@ msl_equip(struct plnstr *pp, char mission)
|
||||||
{
|
{
|
||||||
struct plist pl;
|
struct plist pl;
|
||||||
|
|
||||||
memset(&pl, 0, sizeof(struct plist));
|
pl.load = 0;
|
||||||
pl.pcp = plchr + pp->pln_type;
|
pl.pcp = plchr + pp->pln_type;
|
||||||
pl.plane = *pp;
|
pl.plane = *pp;
|
||||||
emp_initque(&pl.queue);
|
emp_initque(&pl.queue);
|
||||||
|
|
|
@ -329,7 +329,7 @@ find_escorts(coord x, coord y, natid cn, struct emp_qelem *escorts)
|
||||||
if (!in_oparea((struct empobj *)&plane, x, y))
|
if (!in_oparea((struct empobj *)&plane, x, y))
|
||||||
continue;
|
continue;
|
||||||
plp = malloc(sizeof(struct plist));
|
plp = malloc(sizeof(struct plist));
|
||||||
memset(plp, 0, sizeof(struct plist));
|
plp->load = 0;
|
||||||
plp->pcp = &plchr[(int)plane.pln_type];
|
plp->pcp = &plchr[(int)plane.pln_type];
|
||||||
plp->plane = plane;
|
plp->plane = plane;
|
||||||
emp_insque(&plp->queue, escorts);
|
emp_insque(&plp->queue, escorts);
|
||||||
|
@ -371,8 +371,7 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
|
||||||
else {
|
else {
|
||||||
/* save planes for later */
|
/* save planes for later */
|
||||||
plp = malloc(sizeof(struct plist));
|
plp = malloc(sizeof(struct plist));
|
||||||
|
plp->load = 0;
|
||||||
memset(plp, 0, sizeof(struct plist));
|
|
||||||
plp->pcp = pcp;
|
plp->pcp = pcp;
|
||||||
memcpy(&plp->plane, glp->thing, sizeof(struct plnstr));
|
memcpy(&plp->plane, glp->thing, sizeof(struct plnstr));
|
||||||
if (plp->pcp->pl_flags & P_M)
|
if (plp->pcp->pl_flags & P_M)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue