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
|
@ -563,8 +563,8 @@ extern int pln_arm(struct emp_qelem *, int, char, struct ichrstr *,
|
|||
extern int pln_mobcost(int, struct plnstr *, int);
|
||||
extern void pln_put(struct emp_qelem *);
|
||||
extern void pln_removedupes(struct emp_qelem *, struct emp_qelem *);
|
||||
extern int take_plane_off_ship(struct plnstr *, struct shpstr *);
|
||||
extern int take_plane_off_land(struct plnstr *, struct lndstr *);
|
||||
extern void take_plane_off_ship(struct plnstr *, struct shpstr *);
|
||||
extern void take_plane_off_land(struct plnstr *, struct lndstr *);
|
||||
extern void plane_sweep(struct emp_qelem *, coord, coord);
|
||||
extern void count_land_planes(struct lndstr *);
|
||||
extern int count_sect_planes(struct sctstr *);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue