(genlist): Switch thing to use struct empobj * instead of void *.
Remove type from struct genlist as it can be determined from thing. Users changed.
This commit is contained in:
parent
14ea670fc5
commit
eb54f7b574
1 changed files with 7 additions and 9 deletions
|
@ -51,9 +51,8 @@
|
||||||
|
|
||||||
struct genlist {
|
struct genlist {
|
||||||
struct emp_qelem queue; /* list of units */
|
struct emp_qelem queue; /* list of units */
|
||||||
int type; /* unit type: EF_SHIP, EF_PLANE, EF_LAND */
|
|
||||||
void *cp; /* pointer to desc of thing */
|
void *cp; /* pointer to desc of thing */
|
||||||
void *thing; /* thing's struct */
|
struct empobj *thing; /* thing's struct */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct airport {
|
struct airport {
|
||||||
|
@ -148,7 +147,7 @@ only_subs(struct emp_qelem *list)
|
||||||
for (qp = list->q_forw; qp != list; qp = qp->q_forw) {
|
for (qp = list->q_forw; qp != list; qp = qp->q_forw) {
|
||||||
glp = (struct genlist *)qp;
|
glp = (struct genlist *)qp;
|
||||||
|
|
||||||
if (glp->type != EF_SHIP)
|
if (glp->thing->ef_type != EF_SHIP)
|
||||||
return 0;
|
return 0;
|
||||||
mcp = glp->cp;
|
mcp = glp->cp;
|
||||||
if (!(mcp->m_flags & M_SUB))
|
if (!(mcp->m_flags & M_SUB))
|
||||||
|
@ -361,7 +360,6 @@ build_mission_list_type(struct genlist *mi, coord x, coord y, int mission,
|
||||||
|
|
||||||
glp = malloc(sizeof(struct genlist));
|
glp = malloc(sizeof(struct genlist));
|
||||||
memset(glp, 0, sizeof(struct genlist));
|
memset(glp, 0, sizeof(struct genlist));
|
||||||
glp->type = type;
|
|
||||||
glp->cp = get_empobj_chr(gp);
|
glp->cp = get_empobj_chr(gp);
|
||||||
glp->thing = malloc(sizeof(item));
|
glp->thing = malloc(sizeof(item));
|
||||||
memcpy(glp->thing, &item, sizeof(item));
|
memcpy(glp->thing, &item, sizeof(item));
|
||||||
|
@ -429,8 +427,8 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
|
||||||
|
|
||||||
md = mapdist(x, y, gp->x, gp->y);
|
md = mapdist(x, y, gp->x, gp->y);
|
||||||
|
|
||||||
if (glp->type == EF_LAND) {
|
if (glp->thing->ef_type == EF_LAND) {
|
||||||
lp = glp->thing;
|
lp = (struct lndstr *)glp->thing;
|
||||||
|
|
||||||
if (lp->lnd_effic < LAND_MINFIREEFF)
|
if (lp->lnd_effic < LAND_MINFIREEFF)
|
||||||
continue;
|
continue;
|
||||||
|
@ -478,8 +476,8 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
|
||||||
mpr(victim, "%s %s fires at you at %s\n",
|
mpr(victim, "%s %s fires at you at %s\n",
|
||||||
cname(lp->lnd_own), prland(lp), xyas(x, y, victim));
|
cname(lp->lnd_own), prland(lp), xyas(x, y, victim));
|
||||||
}
|
}
|
||||||
} else if (glp->type == EF_SHIP) {
|
} else if (glp->thing->ef_type == EF_SHIP) {
|
||||||
sp = glp->thing;
|
sp = (struct shpstr *)glp->thing;
|
||||||
mcp = glp->cp;
|
mcp = glp->cp;
|
||||||
|
|
||||||
if (sp->shp_effic < 60)
|
if (sp->shp_effic < 60)
|
||||||
|
@ -606,7 +604,7 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
|
||||||
sp->shp_item[I_SHELL] = shell - gun;
|
sp->shp_item[I_SHELL] = shell - gun;
|
||||||
putship(sp->shp_uid, sp);
|
putship(sp->shp_uid, sp);
|
||||||
}
|
}
|
||||||
} else if (glp->type == EF_PLANE) {
|
} else if (glp->thing->ef_type == EF_PLANE) {
|
||||||
pcp = glp->cp;
|
pcp = glp->cp;
|
||||||
if (pcp->pl_flags & P_M)
|
if (pcp->pl_flags & P_M)
|
||||||
/* units have their own missile interdiction */
|
/* units have their own missile interdiction */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue