From afb512fad76c9497c3e29e94bfc15a3e19f9a6e8 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 4 Jan 2009 10:49:17 +0100 Subject: [PATCH] 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. --- src/lib/commands/load.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/commands/load.c b/src/lib/commands/load.c index 625c0237..74a26e76 100644 --- a/src/lib/commands/load.c +++ b/src/lib/commands/load.c @@ -126,7 +126,7 @@ load(void) if (ship.shp_own != player->cnum) { if (!noisy) continue; - if (getrel(getnatp(player->cnum), ship.shp_own) < FRIENDLY) + if (getrel(getnatp(ship.shp_own), player->cnum) < FRIENDLY) continue; } if (!getsect(ship.shp_x, ship.shp_y, §)) /* XXX */ @@ -250,7 +250,7 @@ lload(void) continue; if (player->cnum != land.lnd_own && - getrel(getnatp(player->cnum), land.lnd_own) != ALLIED) + getrel(getnatp(land.lnd_own), player->cnum) != ALLIED) continue; if (!getsect(land.lnd_x, land.lnd_y, §)) /* XXX */ @@ -266,7 +266,7 @@ lload(void) } 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", xyas(land.lnd_x, land.lnd_y, player->cnum)); continue;