2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2010, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 * Ken Stevens, Steve McClure
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * See files README, COPYING and CREDITS in the root of the source
23 * tree for related information and legal notices. It is expected
24 * that future projects/authors will amend these files as needed.
28 * rej.c: Various relations setting routines
30 * Known contributors to this file:
41 #include "prototypes.h"
45 setrel(natid us, natid them, int rel)
47 struct natstr *mynp = getnatp(us);
48 struct natstr *themnp = getnatp(them);
49 char *myname = cname(us);
55 char *addendum = NULL;
57 if (CANT_HAPPEN(rel < AT_WAR))
59 if (CANT_HAPPEN(rel > ALLIED))
61 if (CANT_HAPPEN(!mynp || !themnp))
65 oldrel = getrel(mynp, them);
68 themname = cname(them);
70 whichway = "upgraded";
72 whichway = "downgraded";
74 addendum = "Congratulations!";
76 } else if (rel == FRIENDLY) {
78 n_down = N_DOWN_FRIENDLY;
79 } else if (rel == NEUTRAL) {
81 n_down = N_DOWN_NEUTRAL;
82 } else if (rel == HOSTILE) {
83 addendum = "Another cold war...";
85 n_down = N_DOWN_HOSTILE;
86 } else if (rel < HOSTILE) {
87 addendum = "Declaration made (give 'em hell).";
91 if (addendum && us == player->cnum && !update_running)
93 mpr(us, "Diplomatic relations with %s %s to \"%s\".\n",
94 themname, whichway, relates[rel]);
95 if (!(getrejects(us, themnp) & REJ_TELE))
97 "Country %s (#%d) has %s their relations with you to \"%s\"!\n",
98 myname, us, whichway, relates[rel]);
100 putrel(mynp, them, rel);
104 if (oldrel == ALLIED)
105 nreport(us, N_DIS_ALLY, them, 1);
106 else if (oldrel < HOSTILE && rel >= HOSTILE)
107 nreport(us, N_DIS_WAR, them, 1);
109 nreport(us, n_up, them, 1);
111 nreport(us, n_down, them, 1);
114 setcont(them, us, FOUND_TELE);
118 setcont(natid us, natid them, int contact)
120 struct natstr *np = getnatp(us);
122 if (CANT_HAPPEN(!np))
124 putcontact(np, them, contact);
129 setrej(natid us, natid them, int how, int what)
131 struct natstr *np = getnatp(us);
133 if (CANT_HAPPEN(!np))
135 putreject(np, them, how, what);