Simplify pln_equip() and mission_pln_equip()

Mission 'n' was removed along with nuke_bomb() many years ago.
Simplify accordingly.
This commit is contained in:
Markus Armbruster 2008-03-23 16:18:51 +01:00
parent feaa2dd938
commit 9e0950456d
2 changed files with 4 additions and 17 deletions

View file

@ -987,7 +987,6 @@ mission_pln_equip(struct plist *plp, struct ichrstr *ip, int flags,
struct shpstr ship; struct shpstr ship;
struct sctstr sect; struct sctstr sect;
i_type itype; i_type itype;
int rval;
short *item; short *item;
pp = &plp->plane; pp = &plp->plane;
@ -1006,7 +1005,6 @@ mission_pln_equip(struct plist *plp, struct ichrstr *ip, int flags,
return -1; return -1;
} }
item[I_PETROL] -= pcp->pl_fuel; item[I_PETROL] -= pcp->pl_fuel;
rval = 0;
if (!(flags & P_F)) { if (!(flags & P_F)) {
load = pln_load(pp); load = pln_load(pp);
itype = I_NONE; itype = I_NONE;
@ -1037,10 +1035,6 @@ mission_pln_equip(struct plist *plp, struct ichrstr *ip, int flags,
itype = I_MILIT; itype = I_MILIT;
needed = load / ip->i_lbs; needed = load / ip->i_lbs;
break; break;
case 'n':
if (pp->pln_nuketype == -1)
rval = -1;
break;
case 'i': /* missile interception */ case 'i': /* missile interception */
if (load) { if (load) {
itype = I_SHELL; itype = I_SHELL;
@ -1050,9 +1044,8 @@ mission_pln_equip(struct plist *plp, struct ichrstr *ip, int flags,
default: default:
break; break;
} }
if (rval < 0 || (itype != I_NONE && needed <= 0)) { if (itype != I_NONE && needed <= 0)
return -1; return -1;
}
if (itype != I_NONE) { if (itype != I_NONE) {
if (itype == I_SHELL && item[itype] < needed) if (itype == I_SHELL && item[itype] < needed)
item[itype] += supply_commod(plp->plane.pln_own, item[itype] += supply_commod(plp->plane.pln_own,
@ -1074,7 +1067,7 @@ mission_pln_equip(struct plist *plp, struct ichrstr *ip, int flags,
putland(land.lnd_uid, &land); putland(land.lnd_uid, &land);
else else
putsect(&sect); putsect(&sect);
return rval; return 0;
} }
/* /*

View file

@ -606,7 +606,6 @@ pln_equip(struct plist *plp, struct ichrstr *ip, int flags, char mission)
struct shpstr ship; struct shpstr ship;
struct sctstr sect; struct sctstr sect;
i_type itype; i_type itype;
int rval;
short *item; short *item;
int own; int own;
int abandon_needed; int abandon_needed;
@ -639,7 +638,6 @@ pln_equip(struct plist *plp, struct ichrstr *ip, int flags, char mission)
return -1; return -1;
} }
item[I_PETROL] -= pcp->pl_fuel; item[I_PETROL] -= pcp->pl_fuel;
rval = 0;
if ((flags & P_F) == 0) { if ((flags & P_F) == 0) {
load = pln_load(pp); load = pln_load(pp);
itype = I_NONE; itype = I_NONE;
@ -671,14 +669,10 @@ pln_equip(struct plist *plp, struct ichrstr *ip, int flags, char mission)
itype = I_MILIT; itype = I_MILIT;
needed = load / ip->i_lbs; needed = load / ip->i_lbs;
break; break;
case 'n':
if (pp->pln_nuketype == -1)
rval = -1;
break;
default: default:
break; break;
} }
if (rval < 0 || (itype != I_NONE && needed <= 0)) { if (itype != I_NONE && needed <= 0) {
pr("%s can't contribute to mission\n", prplane(pp)); pr("%s can't contribute to mission\n", prplane(pp));
return -1; return -1;
} }
@ -725,7 +719,7 @@ pln_equip(struct plist *plp, struct ichrstr *ip, int flags, char mission)
} }
putsect(&sect); putsect(&sect);
} }
return rval; return 0;
} }
void void