(pln_airbase_ok): Plug information leak: carrier owner was checked

last, so when it was (no longer) allied, attempting to fly off it let
you test the conditions checked before that.  Check owner first.
(mission_pln_airbase_ok): Matching change, to avoid diverging from
pln_airbase_ok().
This commit is contained in:
Markus Armbruster 2007-11-03 08:20:54 +00:00
parent 446f19913d
commit 26721aa9d1
2 changed files with 15 additions and 21 deletions

View file

@ -919,12 +919,12 @@ mission_pln_airbase_ok(struct plnstr *pp)
|| !could_be_on_ship(pp, &ship)))
return 0;
/* Can't fly off of inefficient or non-owned, non-allied ships */
if ((ship.shp_effic < SHP_AIROPS_EFF) ||
((ship.shp_own != pp->pln_own) &&
(getrel(getnatp(ship.shp_own), pp->pln_own) != ALLIED))) {
if (ship.shp_own != pp->pln_own
&& getrel(getnatp(ship.shp_own), pp->pln_own) != ALLIED) {
return 0;
}
if (ship.shp_effic < SHP_AIROPS_EFF)
return 0;
} else if (pp->pln_land >= 0) {
if (!getland(pp->pln_land, &land)) {
@ -935,15 +935,12 @@ mission_pln_airbase_ok(struct plnstr *pp)
|| !(pcp->pl_flags & P_E)))
return 0;
/* Can't fly off of inefficient or non-owned, non-allied units */
if ((land.lnd_effic < LND_AIROPS_EFF) ||
((land.lnd_own != pp->pln_own) &&
(getrel(getnatp(land.lnd_own), pp->pln_own) != ALLIED))) {
if (land.lnd_own != pp->pln_own
&& getrel(getnatp(land.lnd_own), pp->pln_own) != ALLIED)
return 0;
}
/* Can't fly off units in ships or other units */
if ((land.lnd_ship >= 0) || (land.lnd_land >= 0)) {
if (land.lnd_effic < LND_AIROPS_EFF)
return 0;
if (land.lnd_ship >= 0 || land.lnd_land >= 0) {
return 0;
}

View file

@ -405,15 +405,14 @@ pln_airbase_ok(struct plnstr *pp, int oneway)
|| !could_be_on_ship(pp, &ship)))
return 0;
if (ship.shp_effic < SHP_AIROPS_EFF)
return 0;
/* Can't fly off non-owned ships or non-allied ship */
if ((ship.shp_own != player->cnum) &&
(getrel(getnatp(ship.shp_own), player->cnum) != ALLIED)) {
pr("(note) An ally does not own the ship %s is on\n",
prplane(pp));
return 0;
}
if (ship.shp_effic < SHP_AIROPS_EFF)
return 0;
} else if (pp->pln_land >= 0) {
if (!getland(pp->pln_land, &land)) {
@ -424,18 +423,16 @@ pln_airbase_ok(struct plnstr *pp, int oneway)
|| !(pcp->pl_flags & P_E)))
return 0;
if (land.lnd_effic < LND_AIROPS_EFF)
return 0;
/* Can't fly off units in ships or other units */
if ((land.lnd_ship >= 0) || (land.lnd_land >= 0))
return 0;
/* Can't fly off non-owned units or non-allied unit */
if ((land.lnd_own != player->cnum) &&
(getrel(getnatp(land.lnd_own), player->cnum) != ALLIED)) {
pr("(note) An ally does not own the unit %s is on\n",
prplane(pp));
return 0;
}
if (land.lnd_effic < LND_AIROPS_EFF)
return 0;
if (land.lnd_ship >= 0 || land.lnd_land >= 0)
return 0;
} else {
if (!getsect(pp->pln_x, pp->pln_y, &sect)) {