Collect the test whether a plane fits on a carrier in one place:
(fit_plane_on_ship, fit_plane_on_land): New. (pln_oneway_to_carrier_ok, put_plane_on_ship, count_planes) (put_plane_on_land, count_land_planes): Use them. No functional change. (fit_plane_off_ship, fit_plane_off_land): New. (take_plane_off_ship, take_plane_off_land): Use them. This oopses when the carriers plane counter underflows. (take_plane_off_ship): Document that carrier's plane counters may be screwed up. (take_plane_off_ship, take_plane_off_land): Oops when the plane isn't on the carrier. (take_plane_off_ship, take_plane_off_land): Don't fail when the plane to be taken off can't go on this type of carrier, just take it off. No error condition left, so return void. Callers couldn't do anything useful with the status anyway, and most didn't bother. Change those that did.
This commit is contained in:
parent
ac20e65930
commit
51165cf3fc
3 changed files with 157 additions and 191 deletions
|
@ -441,12 +441,7 @@ load_plane_ship(struct sctstr *sectp, struct shpstr *sp, int noisy,
|
|||
pln.pln_mission = 0;
|
||||
putplane(pln.pln_uid, &pln);
|
||||
} else {
|
||||
if (!take_plane_off_ship(&pln, sp)) {
|
||||
pr("Unable to take plane off ship!\n");
|
||||
logerror("load: plane %d could not be taken off ship %d\n",
|
||||
pln.pln_uid, sp->shp_uid);
|
||||
continue;
|
||||
}
|
||||
take_plane_off_ship(&pln, sp);
|
||||
sprintf(buf, "unloaded in your %s at %s",
|
||||
dchr[sectp->sct_type].d_name,
|
||||
xyas(sectp->sct_x, sectp->sct_y, sectp->sct_own));
|
||||
|
@ -823,12 +818,7 @@ load_plane_land(struct sctstr *sectp, struct lndstr *lp, int noisy,
|
|||
gift(lp->lnd_own, player->cnum, &pln, buf);
|
||||
putplane(pln.pln_uid, &pln);
|
||||
} else {
|
||||
if (!take_plane_off_land(&pln, lp)) {
|
||||
pr("Unable to take plane off unit!\n");
|
||||
logerror("load: plane %d could not be taken off unit %d\n",
|
||||
pln.pln_uid, lp->lnd_uid);
|
||||
continue;
|
||||
}
|
||||
take_plane_off_land(&pln, lp);
|
||||
sprintf(buf, "unloaded at your sector at %s",
|
||||
xyas(sectp->sct_x, sectp->sct_y, sectp->sct_own));
|
||||
gift(sectp->sct_own, player->cnum, &pln, buf);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue