]> git.pond.sub.org Git - empserver/commitdiff
Make lload require own sector and lunload own land unit
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 5 Jan 2009 14:02:21 +0000 (15:02 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 6 Jan 2009 17:43:07 +0000 (18:43 +0100)
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

index 90b6f483c262e2530c167569faeab11e498ab995..6364540aadacbdf4c15f9add386676b7ca9c8b5a 100644 (file)
@@ -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;