]> git.pond.sub.org Git - empserver/commitdiff
Use relations_with() in lnd_mar_one_sector()
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 30 Jan 2011 15:31:02 +0000 (16:31 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Wed, 16 Feb 2011 06:52:25 +0000 (07:52 +0100)
No functional change, because the value of rel only matters when
sect.sct_own != actor, and then it's the same as before.

The new value of rel permits simplifying sect.sct_own != actor && rel
!= ALLIED to just rel != ALLIED.

src/lib/subs/lndsub.c

index c6bc433607feb1551e12df973ae8273a68562f00..fe06901241aa960abbc75267e227f44c46294a62 100644 (file)
@@ -933,8 +933,8 @@ lnd_mar_one_sector(struct emp_qelem *list, int dir, natid actor,
        newx = xnorm(llp->unit.land.lnd_x + dx);
        newy = ynorm(llp->unit.land.lnd_y + dy);
        getsect(newx, newy, &sect);
        newx = xnorm(llp->unit.land.lnd_x + dx);
        newy = ynorm(llp->unit.land.lnd_y + dy);
        getsect(newx, newy, &sect);
-       rel = getrel(getnatp(sect.sct_own), actor);
-       if ((sect.sct_own != actor && rel != ALLIED &&
+       rel = relations_with(sect.sct_own, actor);
+       if ((rel != ALLIED &&
             !(lchr[(int)llp->unit.land.lnd_type].l_flags & L_SPY) &&
             sect.sct_own) || (sect.sct_type == SCT_WATER ||
                               sect.sct_type == SCT_SANCT ||
             !(lchr[(int)llp->unit.land.lnd_type].l_flags & L_SPY) &&
             sect.sct_own) || (sect.sct_type == SCT_WATER ||
                               sect.sct_type == SCT_SANCT ||
@@ -999,7 +999,7 @@ lnd_mar_one_sector(struct emp_qelem *list, int dir, natid actor,
            mpr(actor, "You no longer own %s\n",
                xyas(osect.sct_x, osect.sct_y, actor));
        }
            mpr(actor, "You no longer own %s\n",
                xyas(osect.sct_x, osect.sct_y, actor));
        }
-       if (rel != ALLIED && sect.sct_own != actor && sect.sct_own) {   /* must be a spy */
+       if (rel != ALLIED && sect.sct_own) {    /* must be a spy */
            /* Always a 10% chance of getting caught. */
            if (chance(LND_SPY_DETECT_CHANCE(llp->unit.land.lnd_effic))) {
                if (rel == NEUTRAL || rel == FRIENDLY) {
            /* Always a 10% chance of getting caught. */
            if (chance(LND_SPY_DETECT_CHANCE(llp->unit.land.lnd_effic))) {
                if (rel == NEUTRAL || rel == FRIENDLY) {