]> git.pond.sub.org Git - empserver/commitdiff
reject: Change nat_accepts()'s first parameter to natid
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 31 Oct 2016 12:58:16 +0000 (13:58 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 18:09:21 +0000 (20:09 +0200)
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
include/nat.h
src/lib/commands/acce.c
src/lib/commands/offe.c
src/lib/commands/rea.c
src/lib/commands/tele.c
src/lib/common/nat.c
src/lib/subs/rej.c
src/lib/subs/wu.c

index 69678b2dbb8e2a21e1ddf38749547942a5d616d4..017778c58ffd34f06639f9dfdf6ab705455e50fe 100644 (file)
@@ -199,7 +199,7 @@ extern char *relatename(struct natstr *np, natid other);
 extern char *natstate(struct natstr *np);
 extern int getrel(struct natstr *np, natid them);
 extern int relations_with(natid, natid);
-extern int nat_accepts(struct natstr *, natid, enum rej_comm);
+extern int nat_accepts(natid, natid, enum rej_comm);
 extern int in_contact(natid, natid);
 extern void putrel(struct natstr *np, natid them, int relate);
 extern void agecontact(struct natstr *np);
index 8ebbcef6e40762909bb585636515998e053c299d..c76c81533eed786a77e97605c037b3ab0b247d3d 100644 (file)
@@ -34,7 +34,7 @@
 
 #include "commands.h"
 
-static void pr_accept(struct natstr *, natid);
+static void pr_accept(natid, natid);
 
 /*
  * report rejection status
@@ -69,15 +69,15 @@ acce(void)
        if (np->nat_stat == STAT_UNUSED)
            continue;
        pr("%3d) %-14.14s ", cn, cname(cn));
-       pr_accept(natp, cn);
-       pr_accept(np, as);
+       pr_accept(as, cn);
+       pr_accept(cn, as);
        pr("\n");
     }
     return RET_OK;
 }
 
 static void
-pr_accept(struct natstr *to, natid from)
+pr_accept(natid to, natid from)
 {
     static char *yes_no[] = { "YES", " NO" };
 
index c302213826dd3a3961b352a59b67500a2f3a2990..1de9c1413510b3c53b241c1c7e0599a2134a7c78 100644 (file)
@@ -77,8 +77,7 @@ do_loan(void)
        pr("You can't loan yourself money!\n");
        return RET_FAIL;
     }
-    natp = getnatp(recipient);
-    if (!nat_accepts(natp, player->cnum, REJ_LOAN)) {
+    if (!nat_accepts(recipient, player->cnum, REJ_LOAN)) {
        pr("%s is rejecting your loans.\n", cname(recipient));
        return RET_SYN;
     }
index cbb0968a5a5edd15158a154ae6470a4b010ee76d..bf5766edcb904f0550030815e8714edefed5b3a2 100644 (file)
@@ -107,7 +107,7 @@ rea(void)
        if (res <= 0)
            break;
        if (*kind == 'a') {
-           if ((!nat_accepts(np, tgm.tel_from, REJ_ANNO))
+           if ((!nat_accepts(player->cnum, tgm.tel_from, REJ_ANNO))
                || tgm.tel_date < then) {
                res = tel_read_body(telfp, mbox, &tgm, NULL, NULL);
                if (res < 0)
index a5e5e904d9b091e227a9ca08cf31afcea9425a6a..0dbe5a063dc96f7fb0f418a4f5829d56426150ae 100644 (file)
@@ -92,7 +92,7 @@ tele(void)
                kk++;
                continue;
            }
-           if (!nat_accepts(natp, player->cnum, REJ_TELE)) {
+           if (!nat_accepts(to, player->cnum, REJ_TELE)) {
                pr("%s is rejecting your telegrams.\n", cname(to));
                return RET_SYN;
            }
index d9c6820c92ce873e2c17782bcc6d4cb6c9ca4cba..8ed75cc4d3481ce29cccdd8eea5dcb3dabf1676d 100644 (file)
@@ -90,10 +90,10 @@ relations_with(natid us, natid them)
 }
 
 int
-nat_accepts(struct natstr *np, natid them, enum rej_comm what)
+nat_accepts(natid us, natid them, enum rej_comm what)
 {
     return getnatp(them)->nat_stat == STAT_GOD
-       || !(getrejectp(np->nat_cnum)->rej_rejects[them] & bit(what));
+       || !(getrejectp(us)->rej_rejects[them] & bit(what));
 }
 
 void
index 33347dba52efbf89ff82b8f2b08a021071a8b287..4135b3b0b2c7f5798d2ba2ed589591a85fbb0569 100644 (file)
@@ -44,7 +44,6 @@ void
 setrel(natid us, natid them, int rel)
 {
     struct natstr *mynp = getnatp(us);
-    struct natstr *themnp = getnatp(them);
     int oldrel;
     char *whichway;
     int n_up = 0;
@@ -55,7 +54,7 @@ setrel(natid us, natid them, int rel)
        rel = AT_WAR;
     if (CANT_HAPPEN(rel > ALLIED))
        rel = ALLIED;
-    if (CANT_HAPPEN(!mynp || !themnp))
+    if (CANT_HAPPEN(!mynp))
        return;
     if (us == them)
        return;
@@ -88,7 +87,7 @@ setrel(natid us, natid them, int rel)
        pr("%s\n", addendum);
     mpr(us, "Diplomatic relations with %s %s to \"%s\".\n",
        cname(them), whichway, relates[rel]);
-    if (nat_accepts(themnp, us, REJ_TELE))
+    if (nat_accepts(them, us, REJ_TELE))
        mpr(them,
            "Country %s has %s their relations with you to \"%s\"!\n",
            prnat(mynp), whichway, relates[rel]);
index 18088cc751725617747e689da5ecd9fabe4ebb4c..21bc31e913c141beae19c7f2cb9f6937faf6e7fc 100644 (file)
@@ -153,7 +153,7 @@ typed_wu(natid from, natid to, char *message, int type)
        for (to = 0; NULL != (np = getnatp(to)); to++) {
            if (np->nat_stat < STAT_SANCT)
                continue;
-           if (!nat_accepts(np, from, REJ_ANNO))
+           if (!nat_accepts(to, from, REJ_ANNO))
                continue;
            if (!np->nat_ann || !tel.tel_cont) {
                np->nat_ann++;