Replace pln_oneway_to_carrier_ok() by pln_can_land_on_carrier()

Avoids reading the target ship again.
This commit is contained in:
Markus Armbruster 2012-06-23 20:49:48 +02:00
parent d9a915a05b
commit b4acb73fd1
4 changed files with 13 additions and 12 deletions

View file

@ -98,7 +98,8 @@ fly(void)
wantflags, P_M | P_O);
pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target, 1,
wantflags | P_ESC | P_F, P_M | P_O);
if (cno >= 0 && !pln_oneway_to_carrier_ok(&bomb_list, &esc_list, cno)) {
if (cno >= 0
&& !pln_can_land_on_carrier(&bomb_list, &esc_list, &target.ship)) {
pr("Not enough room on ship #%d!\n", cno);
return RET_FAIL;
}

View file

@ -87,7 +87,8 @@ reco(void)
P_M | P_O);
pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target, 1,
wantflags | P_ESC | P_F, P_M | P_O);
if (cno >= 0 && !pln_oneway_to_carrier_ok(&bomb_list, &esc_list, cno)) {
if (cno >= 0
&& !pln_can_land_on_carrier(&bomb_list, &esc_list, &target.ship)) {
pr("Not enough room on ship #%d!\n", cno);
return RET_FAIL;
}