2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2000, 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 the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
23 * related information and legal notices. It is expected that any future
24 * projects/authors will amend these files as needed.
28 * rej.c: Various relations setting routines
30 * Known contributors to this file:
39 #include "prototypes.h"
42 extern s_char *relates[];
43 extern int update_pending;
46 setrel(natid us, natid them, int rel)
49 struct natstr *themnp;
50 s_char *myname = cname(us);
64 if (!(mynp = getnatp(us)))
66 if (!(themnp = getnatp(them)))
68 if ((oldrel = getrel(mynp, them)) == rel)
70 themname = cname(them);
72 whichway = "upgraded";
74 whichway = "downgraded";
76 addendum = "Congratulations!";
78 } else if (rel == FRIENDLY) {
80 n_down = N_DOWN_FRIENDLY;
81 } else if (rel == NEUTRAL) {
83 n_down = N_DOWN_NEUTRAL;
84 } else if (rel == HOSTILE) {
85 addendum = "Another cold war...";
87 n_down = N_DOWN_HOSTILE;
88 } else if (rel < HOSTILE) {
95 theirrel = getrel(natp2,us);
96 if (theirrel <= MOBILIZATION) {
99 } else if (us == player->cnum && !update_pending) {
100 if (mynp->nat_money < War_Cost){
101 mpr(us, "You don't have the money!\n");
106 } else { /* nreport is forcing us to decl war */
110 if (us == player->cnum && !update_pending)
111 mpr(us, "No change required for that!\n");
114 player->dolcost += cost;
117 addendum = "Declaration made (give 'em hell).";
121 if (addendum && us == player->cnum && !update_pending)
122 pr("%s\n", addendum);
123 mpr(us, "Diplomatic relations with %s %s to \"%s\".\n", themname, whichway, relates[rel]);
124 if(!(getrejects(us, themnp) & REJ_TELE))
126 "Country %s (#%d) has %s their relations with you to \"%s\"!\n", myname, us, whichway, relates[rel]);
128 putrel(mynp, them, rel);
132 if (oldrel == ALLIED)
133 nreport(us, N_DIS_ALLY, them, 1);
134 else if (oldrel < HOSTILE && rel >= HOSTILE)
135 nreport(us, N_DIS_WAR, them, 1);
137 nreport(us, n_up, them, 1);
139 nreport(us, n_down, them, 1);
146 setcont(natid us, natid them, int contact)
150 if ((np = getnatp(us)) == 0)
152 putcontact(np, them, contact);
158 setrej(natid us, natid them, int how, int what)
162 if ((np = getnatp(us)) == 0)
164 putreject(np, them, how, what);