]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/rej.c
Use relations_with() for getrel(NP, THEM) where NP isn't THEM
[empserver] / src / lib / subs / rej.c
index 544cc35a5fafaf7d32d8ec557be949d39ef250ce..fc1b5efe794d75bf2b262bab3cc9e4599f3ba518 100644 (file)
 #include "prototypes.h"
 #include "server.h"
 
-int
+void
 setrel(natid us, natid them, int rel)
 {
     struct natstr *mynp = getnatp(us);
     struct natstr *themnp = getnatp(them);
-    char *myname = cname(us);
-    char *themname;
     int oldrel;
     char *whichway;
     int n_up = 0;
@@ -59,10 +57,12 @@ setrel(natid us, natid them, int rel)
     if (CANT_HAPPEN(rel > ALLIED))
        rel = ALLIED;
     if (CANT_HAPPEN(!mynp || !themnp))
-       return RET_FAIL;
-    if ((oldrel = getrel(mynp, them)) == rel)
-       return RET_FAIL;
-    themname = cname(them);
+       return;
+    if (us == them)
+       return;
+    oldrel = relations_with(us, them);
+    if (oldrel == rel)
+       return;
     if (rel > oldrel)
        whichway = "upgraded";
     else
@@ -88,11 +88,11 @@ setrel(natid us, natid them, int rel)
     if (addendum && us == player->cnum && !update_running)
        pr("%s\n", addendum);
     mpr(us, "Diplomatic relations with %s %s to \"%s\".\n",
-       themname, whichway, relates[rel]);
+       cname(them), whichway, relates[rel]);
     if (!(getrejects(us, themnp) & REJ_TELE))
        mpr(them,
            "Country %s (#%d) has %s their relations with you to \"%s\"!\n",
-           myname, us, whichway, relates[rel]);
+           cname(us), us, whichway, relates[rel]);
 
     putrel(mynp, them, rel);
     putnat(mynp);
@@ -109,30 +109,26 @@ setrel(natid us, natid them, int rel)
     }
     if (opt_HIDDEN)
        setcont(them, us, FOUND_TELE);
-
-    return RET_OK;
 }
 
-int
+void
 setcont(natid us, natid them, int contact)
 {
     struct natstr *np = getnatp(us);
 
     if (CANT_HAPPEN(!np))
-       return 0;
+       return;
     putcontact(np, them, contact);
     putnat(np);
-    return 1;
 }
 
-int
+void
 setrej(natid us, natid them, int how, int what)
 {
     struct natstr *np = getnatp(us);
 
     if (CANT_HAPPEN(!np))
-       return 0;
+       return;
     putreject(np, them, how, what);
     putnat(np);
-    return 1;
 }