ichrstr member i_vtype instead of pointer arithmetic to map from
`struct ichrstr *' to item type. No functional changes.
struct sctstr sect;
int type;
s_char *ptr;
struct sctstr sect;
int type;
s_char *ptr;
int rval;
int vec[I_MAX + 1];
int rval;
int vec[I_MAX + 1];
vec[I_PETROL] -= pcp->pl_fuel;
rval = 0;
if (!(flags & P_F)) {
vec[I_PETROL] -= pcp->pl_fuel;
rval = 0;
if (!(flags & P_F)) {
needed = 0;
switch (mission) {
case 's':
case 'p':
if (pp->pln_nuketype == -1) {
needed = 0;
switch (mission) {
case 's':
case 'p':
if (pp->pln_nuketype == -1) {
needed = pp->pln_load;
}
break;
case 't':
if ((pcp->pl_flags & P_C) == 0 || ip == 0)
break;
needed = pp->pln_load;
}
break;
case 't':
if ((pcp->pl_flags & P_C) == 0 || ip == 0)
break;
needed = (pp->pln_load * 2) / ip->i_lbs;
break;
case 'd':
if ((pcp->pl_flags & P_C) == 0 || ip == 0)
break;
needed = (pp->pln_load * 2) / ip->i_lbs;
break;
case 'd':
if ((pcp->pl_flags & P_C) == 0 || ip == 0)
break;
needed = (pp->pln_load * 2) / ip->i_lbs;
break;
case 'a':
if ((pcp->pl_flags & (P_V | P_C)) == 0)
break;
needed = (pp->pln_load * 2) / ip->i_lbs;
break;
case 'a':
if ((pcp->pl_flags & (P_V | P_C)) == 0)
break;
needed = pp->pln_load / ip->i_lbs;
break;
case 'n':
needed = pp->pln_load / ip->i_lbs;
break;
case 'n':
break;
case 'i': /* missile interception */
if (pp->pln_load) {
break;
case 'i': /* missile interception */
if (pp->pln_load) {
needed = pp->pln_load;
}
break;
default:
break;
}
needed = pp->pln_load;
}
break;
default:
break;
}
- if (rval < 0 || (item && needed <= 0)) {
+ if (rval < 0 || (itype && needed <= 0)) {
- if ((vec[item] < needed) && (item == I_SHELL))
- vec[item] += supply_commod(plp->plane.pln_own,
- plp->plane.pln_x, plp->plane.pln_y,
- I_SHELL, needed);
- if (vec[item] < needed) {
+ if (vec[itype] < needed && (itype == I_SHELL))
+ vec[itype] += supply_commod(plp->plane.pln_own,
+ plp->plane.pln_x, plp->plane.pln_y,
+ I_SHELL, needed);
+ if (vec[itype] < needed) {
- if (item == I_SHELL && (mission == 's' || mission == 'p'))
+ if (itype == I_SHELL && (mission == 's' || mission == 'p'))
plp->bombs = needed;
else
plp->misc = needed;
plp->bombs = needed;
else
plp->misc = needed;
struct sctstr sect;
int type;
s_char *ptr;
struct sctstr sect;
int type;
s_char *ptr;
int rval;
int vec[I_MAX + 1];
int own;
int rval;
int vec[I_MAX + 1];
int own;
vec[I_PETROL] -= pcp->pl_fuel;
rval = 0;
if ((flags & P_F) == 0) {
vec[I_PETROL] -= pcp->pl_fuel;
rval = 0;
if ((flags & P_F) == 0) {
needed = 0;
switch (mission) {
case 's':
case 'p':
if (pp->pln_nuketype == -1) {
needed = 0;
switch (mission) {
case 's':
case 'p':
if (pp->pln_nuketype == -1) {
needed = pp->pln_load;
}
break;
case 't':
if ((pcp->pl_flags & P_C) == 0 || ip == 0)
break;
needed = pp->pln_load;
}
break;
case 't':
if ((pcp->pl_flags & P_C) == 0 || ip == 0)
break;
needed = (pp->pln_load * 2) / ip->i_lbs;
break;
case 'd':
needed = (pp->pln_load * 2) / ip->i_lbs;
break;
case 'd':
needed = (pp->pln_load * 2) / ip->i_lbs;
/* Is this mine dropping excursion? */
needed = (pp->pln_load * 2) / ip->i_lbs;
/* Is this mine dropping excursion? */
- if ((item == I_SHELL) && (pcp->pl_flags & P_MINE))
+ if (itype == I_SHELL && (pcp->pl_flags & P_MINE))
break;
/* Is this a cargo drop? */
if ((pcp->pl_flags & P_C) == 0 || ip == 0) {
break;
/* Is this a cargo drop? */
if ((pcp->pl_flags & P_C) == 0 || ip == 0) {
case 'a':
if ((pcp->pl_flags & (P_V | P_C)) == 0)
break;
case 'a':
if ((pcp->pl_flags & (P_V | P_C)) == 0)
break;
needed = pp->pln_load / ip->i_lbs;
break;
case 'n':
needed = pp->pln_load / ip->i_lbs;
break;
case 'n':
- if (rval < 0 || (item && needed <= 0)) {
+ if (rval < 0 || (itype && needed <= 0)) {
pr("%s can't contribute to mission\n", prplane(pp));
return -1;
}
#if 0
/* Supply is broken somewhere, so don't use it for now */
pr("%s can't contribute to mission\n", prplane(pp));
return -1;
}
#if 0
/* Supply is broken somewhere, so don't use it for now */
- if ((vec[item] < needed) && (item == I_SHELL))
- vec[item] += supply_commod(plp->plane.pln_own,
- plp->plane.pln_x, plp->plane.pln_y,
- I_SHELL, needed);
+ if (vec[itype] < needed && itype == I_SHELL)
+ vec[itype] += supply_commod(plp->plane.pln_own,
+ plp->plane.pln_x, plp->plane.pln_y,
+ I_SHELL, needed);
- if (vec[item] < needed) {
- pr("Not enough %s for %s\n", ichr[item].i_name, prplane(pp));
+ if (vec[itype] < needed) {
+ pr("Not enough %s for %s\n", ichr[itype].i_name, prplane(pp));
- if (item == I_SHELL && (mission == 's' || mission == 'p'))
+ if (itype == I_SHELL && (mission == 's' || mission == 'p'))
plp->bombs = needed;
else
plp->misc = needed;
plp->bombs = needed;
else
plp->misc = needed;