#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;
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
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);
}
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;
}