From bf2fd042abba571d41d7e5fa3f953475e3de4695 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 5 Jan 2009 15:02:21 +0100 Subject: [PATCH] Make lload require own sector and lunload own land unit This is for consistency with load and unload. Before, you could use lunload for allied land units and lload in allied sectors, but the command failed when stuff was loaded in allied sectors. Doing that with lload no longer fails the command, because the check that does that in load_comm_land() is now masked by the new checks in lload(). Note that loading with lunload still fails the command; that inconsistency will be removed in a later commit. load_plane_land() already refused to load planes from foreign sectors. This commit makes that check redundant, so remove it. Functional change: lload now refuses to load foreign planes silently, unless both land unit and plane were named by number. This is consistent with load. --- src/lib/commands/load.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/lib/commands/load.c b/src/lib/commands/load.c index 90b6f483..6364540a 100644 --- a/src/lib/commands/load.c +++ b/src/lib/commands/load.c @@ -248,6 +248,8 @@ lload(void) while (nxtitem(&nbst, &land)) { if (land.lnd_own == 0) continue; + if (!player->owner && load_unload == UNLOAD) + continue; if (player->cnum != land.lnd_own) { if (!noisy) continue; @@ -267,6 +269,12 @@ lload(void) } } + if (sect.sct_own != player->cnum && load_unload == LOAD) { + if (noisy) + pr("Sector %s is not yours.\n", + xyas(sect.sct_x, sect.sct_y, player->cnum)); + continue; + } if (sect.sct_own != player->cnum && getrel(getnatp(sect.sct_own), player->cnum) != ALLIED) { pr("Sector %s is not yours.\n", @@ -744,12 +752,6 @@ load_plane_land(struct sctstr *sectp, struct lndstr *lp, int noisy, if (noisy && p && *p) noisy = isdigit(*p); - if (sectp->sct_own != player->cnum && load_unload == LOAD) { - pr("Sector %s is not yours.\n", - xyas(lp->lnd_x, lp->lnd_y, player->cnum)); - return 0; - } - while (nxtitem(&ni, &pln)) { if (pln.pln_own != player->cnum) continue;