Fix relation checks in load, unload, lload, lunload

The check for ship owner's relations to the player was backward: it
checked the player's relations to the ship's owner instead.  Abusable:
you could load and unload any ship by declaring friendly to its owner.
Broken since Chainsaw let you load and unload friendly ships.

The check for land unit owner's relations to the player was similarly
backward, similarly abusable, and also broken since day one.

lload and lunload checked sector owner's relations to the land unit's
owner instead of to the player.  Harmless, because the two must be the
same to reach the check.
This commit is contained in:
Markus Armbruster 2009-01-04 10:49:17 +01:00
parent 1c547f9b42
commit afb512fad7

View file

@ -126,7 +126,7 @@ load(void)
if (ship.shp_own != player->cnum) { if (ship.shp_own != player->cnum) {
if (!noisy) if (!noisy)
continue; continue;
if (getrel(getnatp(player->cnum), ship.shp_own) < FRIENDLY) if (getrel(getnatp(ship.shp_own), player->cnum) < FRIENDLY)
continue; continue;
} }
if (!getsect(ship.shp_x, ship.shp_y, &sect)) /* XXX */ if (!getsect(ship.shp_x, ship.shp_y, &sect)) /* XXX */
@ -250,7 +250,7 @@ lload(void)
continue; continue;
if (player->cnum != land.lnd_own && if (player->cnum != land.lnd_own &&
getrel(getnatp(player->cnum), land.lnd_own) != ALLIED) getrel(getnatp(land.lnd_own), player->cnum) != ALLIED)
continue; continue;
if (!getsect(land.lnd_x, land.lnd_y, &sect)) /* XXX */ if (!getsect(land.lnd_x, land.lnd_y, &sect)) /* XXX */
@ -266,7 +266,7 @@ lload(void)
} }
if (sect.sct_own != player->cnum && if (sect.sct_own != player->cnum &&
getrel(getnatp(sect.sct_own), land.lnd_own) != ALLIED) { getrel(getnatp(sect.sct_own), player->cnum) != ALLIED) {
pr("Sector %s is not yours.\n", pr("Sector %s is not yours.\n",
xyas(land.lnd_x, land.lnd_y, player->cnum)); xyas(land.lnd_x, land.lnd_y, player->cnum));
continue; continue;