(pln_airbase_ok, mission_pln_airbase_ok): Oops when plane's carrier is

bad.  Before, the plane was destroyed, and the player got a message.

(pln_airbase_ok, mission_pln_airbase_ok): Oops when plane's base
sector is bad.

(pln_airbase_ok): Oops when the player doesn't own the plane.  Before,
this was checked only for planes on carriers, and the plane was
destroyed, and the player got a misleading message.
This commit is contained in:
Markus Armbruster 2007-11-03 08:09:38 +00:00
parent 79c2a10b30
commit 446f19913d
2 changed files with 28 additions and 38 deletions

View file

@ -912,17 +912,13 @@ mission_pln_airbase_ok(struct plnstr *pp)
if (pp->pln_ship >= 0) { if (pp->pln_ship >= 0) {
if (!getship(pp->pln_ship, &ship)) { if (!getship(pp->pln_ship, &ship)) {
shipsunk: CANT_REACH();
pp->pln_effic = 0;
putplane(pp->pln_uid, pp);
return 0; return 0;
} }
if (!could_be_on_ship(pp, &ship)) { if (CANT_HAPPEN(ship.shp_effic < SHIP_MINEFF
goto shipsunk; || !could_be_on_ship(pp, &ship)))
} return 0;
if (ship.shp_effic < SHIP_MINEFF) {
goto shipsunk;
}
/* Can't fly off of inefficient or non-owned, non-allied ships */ /* Can't fly off of inefficient or non-owned, non-allied ships */
if ((ship.shp_effic < SHP_AIROPS_EFF) || if ((ship.shp_effic < SHP_AIROPS_EFF) ||
((ship.shp_own != pp->pln_own) && ((ship.shp_own != pp->pln_own) &&
@ -932,15 +928,12 @@ mission_pln_airbase_ok(struct plnstr *pp)
} else if (pp->pln_land >= 0) { } else if (pp->pln_land >= 0) {
if (!getland(pp->pln_land, &land)) { if (!getland(pp->pln_land, &land)) {
landdead: CANT_REACH();
pp->pln_effic = 0;
putplane(pp->pln_uid, pp);
return 0; return 0;
} }
if (!(pcp->pl_flags & P_E)) if (CANT_HAPPEN(land.lnd_effic < LAND_MINEFF
goto landdead; || !(pcp->pl_flags & P_E)))
if (land.lnd_effic < LAND_MINEFF) return 0;
goto landdead;
/* Can't fly off of inefficient or non-owned, non-allied units */ /* Can't fly off of inefficient or non-owned, non-allied units */
if ((land.lnd_effic < LND_AIROPS_EFF) || if ((land.lnd_effic < LND_AIROPS_EFF) ||
@ -955,8 +948,8 @@ mission_pln_airbase_ok(struct plnstr *pp)
} }
} else { } else {
/* If we can't get the sector, we can't check it, and can't fly */
if (!getsect(pp->pln_x, pp->pln_y, &sect)) { if (!getsect(pp->pln_x, pp->pln_y, &sect)) {
CANT_REACH();
return 0; return 0;
} }
/* First, check allied status */ /* First, check allied status */

View file

@ -393,19 +393,18 @@ pln_airbase_ok(struct plnstr *pp, int oneway)
struct sctstr sect; struct sctstr sect;
struct plchrstr *pcp = plchr + pp->pln_type; struct plchrstr *pcp = plchr + pp->pln_type;
if (CANT_HAPPEN(pp->pln_own != player->cnum))
return 0;
if (pp->pln_ship >= 0) { if (pp->pln_ship >= 0) {
if (!getship(pp->pln_ship, &ship) || if (!getship(pp->pln_ship, &ship)) {
pp->pln_own != player->cnum) { CANT_REACH();
shipsunk:
pp->pln_effic = 0;
pr("(note) ship not valid for %s\n", prplane(pp));
putplane(pp->pln_uid, pp);
return 0; return 0;
} }
if (!could_be_on_ship(pp, &ship)) if (CANT_HAPPEN(ship.shp_effic < SHIP_MINEFF
goto shipsunk; || !could_be_on_ship(pp, &ship)))
if (ship.shp_effic < SHIP_MINEFF) return 0;
goto shipsunk;
if (ship.shp_effic < SHP_AIROPS_EFF) if (ship.shp_effic < SHP_AIROPS_EFF)
return 0; return 0;
/* Can't fly off non-owned ships or non-allied ship */ /* Can't fly off non-owned ships or non-allied ship */
@ -417,18 +416,14 @@ pln_airbase_ok(struct plnstr *pp, int oneway)
} }
} else if (pp->pln_land >= 0) { } else if (pp->pln_land >= 0) {
if (!getland(pp->pln_land, &land) || if (!getland(pp->pln_land, &land)) {
(pp->pln_own != player->cnum)) { CANT_REACH();
landdead:
pp->pln_effic = 0;
pr("(note) land unit not valid for %s\n", prplane(pp));
putplane(pp->pln_uid, pp);
return 0; return 0;
} }
if (!(plchr[(int)pp->pln_type].pl_flags & P_E)) if (CANT_HAPPEN(land.lnd_effic < LAND_MINEFF
goto landdead; || !(pcp->pl_flags & P_E)))
if (land.lnd_effic < LAND_MINEFF) return 0;
goto landdead;
if (land.lnd_effic < LND_AIROPS_EFF) if (land.lnd_effic < LND_AIROPS_EFF)
return 0; return 0;
/* Can't fly off units in ships or other units */ /* Can't fly off units in ships or other units */
@ -443,8 +438,10 @@ pln_airbase_ok(struct plnstr *pp, int oneway)
} }
} else { } else {
if (!getsect(pp->pln_x, pp->pln_y, &sect)) if (!getsect(pp->pln_x, pp->pln_y, &sect)) {
CANT_REACH();
return 0; return 0;
}
/* First, check allied status */ /* First, check allied status */
/* Can't fly from non-owned sectors or non-allied sectors */ /* Can't fly from non-owned sectors or non-allied sectors */
if ((sect.sct_own != player->cnum) && if ((sect.sct_own != player->cnum) &&