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.
30 * Known contributors to this file:
77 if (player->cnum == 0) {
78 /* Dissolve the Deity??? */
79 /* Probably someone broke in. */
80 /* Send a tele to deity, and abort the session. */
81 wu(0, 0, "Diety dissolve attempted! Session was aborted.\n");
86 p = getstarg(player->argp[1], "Are you SURE you want to do this? (n) ", buf);
87 if (p == 0 || *p != 'y')
89 pr("\nIf you want some problem fixed and hope to force the issue\n");
90 pr("by dissolving, DON'T DO IT. Even if an earlier version of\n");
91 pr("this game is brought up, YOU WILL BE GONE.\n");
92 pr("Forcing the issue makes it less likely that it will be\n");
93 pr("resolved the way you wish it.\n\n");
94 pr("Be part of the solution, not part of the problem.\n\n");
95 pr("If this is a test game, dissolving will not help the test.\n\n");
96 pr("If you are down to 0 sectors, and a 25% fishing vessel with\n");
97 pr("1 mil on it, well, I can see your point. Go ahead.\n\n");
98 pr("But at least pay back your loans, if you can.\n\n");
101 *player->argp[1] = 0;
102 p = getstarg(player->argp[1], "Once again, are you SURE you want to do this? (n) ", buf);
103 if (p == 0 || *p != 'y')
106 np = getnatp(player->cnum);
110 while (nxtsct(&ns, §)) {
113 annoyed = 75 - (random() % (sect.sct_loyal+40));
114 if (annoyed <= 0 || sect.sct_oldown != sect.sct_own) {
115 pr("Populace celebrates in %s\n",
116 xyas(sect.sct_x, sect.sct_y, player->cnum));
117 if (sect.sct_oldown != sect.sct_own) {
118 makelost(EF_SECTOR, sect.sct_own, 0, sect.sct_x, sect.sct_y);
119 makenotlost(EF_SECTOR, sect.sct_oldown, 0, sect.sct_x, sect.sct_y);
120 sect.sct_own = sect.sct_oldown;
121 if(sect.sct_own != 0)
123 "%s reverts back to you!\n",
124 xyas(sect.sct_x, sect.sct_y,
127 } else if (annoyed < 25) {
128 pr("Populace unmoved in %s\n",
129 xyas(sect.sct_x, sect.sct_y, player->cnum));
130 makelost(EF_SECTOR, sect.sct_own, 0, sect.sct_x, sect.sct_y);
134 pr("Rioting breaks out in %s\n",
135 xyas(sect.sct_x, sect.sct_y, player->cnum));
136 sectdamage(§, annoyed, 0);
138 makelost(EF_SECTOR, sect.sct_own, 0, sect.sct_x, sect.sct_y);
144 snxtitem_all(&ni, EF_LAND);
145 while (nxtitem(&ni, (s_char *)&land)) {
149 pr("%s disbands!\n", prland(&land));
151 putland(land.lnd_uid, &land);
153 snxtitem_all(&ni, EF_SHIP);
154 while (nxtitem(&ni, (s_char *)&ship)) {
157 pr("%s ", prship(&ship));
158 switch (random() % 3) {
165 putvar(V_MILIT, 0, (s_char *)&ship, EF_SHIP);
166 putvar(V_CIVIL, 0, (s_char *)&ship, EF_SHIP);
167 putvar(V_UW, 0, (s_char *)&ship, EF_SHIP);
171 damage = (random() % 80) + 10;
172 pr("crew has rioted! (%d damage)\n", damage);
173 shipdamage(&ship, damage);
177 putship(ship.shp_uid, &ship);
179 snxtitem_all(&ni, EF_PLANE);
180 while (nxtitem(&ni, (s_char *)&plane)) {
183 pr("%s ", prplane(&plane));
184 switch (random() % 2) {
191 damage = (random() % 80) + 10;
192 pr("crew has rioted! (%d damage)\n", damage);
193 planedamage(&plane, damage);
197 putplane(plane.pln_uid, &plane);
199 snxtitem_all(&ni, EF_TREATY);
200 while (nxtitem(&ni, (s_char *)&treaty)) {
201 if (treaty.trt_status == TS_FREE)
203 if (treaty.trt_cna != player->cnum &&
204 treaty.trt_cnb != player->cnum)
206 cn = treaty.trt_cna == player->cnum ? treaty.trt_cnb : treaty.trt_cna;
207 pr("No more treaty with %s\n", cname(cn));
208 wu(0, cn, "Treaty #%d with %s voided\n",
209 ni.cur, cname(player->cnum));
210 treaty.trt_status = TS_FREE;
211 puttre(ni.cur, &treaty);
213 snxtitem_all(&ni, EF_LOAN);
214 while (nxtitem(&ni, (s_char *)&loan)) {
215 if (loan.l_status == LS_FREE)
217 if (loan.l_loner != player->cnum && loan.l_lonee != player->cnum)
219 if (loan.l_loner == player->cnum) {
220 pr("Loan #%d to %s will never be repaid\n",
221 ni.cur, cname(loan.l_lonee));
223 "Loan #%d from %s has been voided\n",
224 ni.cur, cname(player->cnum));
226 pr("Loan #%d from %s will never be repaid\n",
227 ni.cur, cname(loan.l_lonee));
229 "Loan #%d to %s has been voided\n",
230 ni.cur, cname(player->cnum));
232 loan.l_status = LS_FREE;
233 putloan(ni.cur, &loan);
235 /* clean up commodity and trade for this nation. */
238 for (n=1; n<I_MAX+1; n++) {
239 val = commamt(player->cnum, n, &dummy);
240 commset(player->cnum, n, -val);
244 snxtitem_all(&ni, EF_TRADE);
245 while (nxtitem(&ni, (s_char *)&trade)) {
246 if (trade.trd_unitid >= 0 && trade.trd_owner == player->cnum) {
247 trade.trd_unitid = -1;
248 (void) puttrade(ni.cur, &trade);
252 n = sctnum > 127 ? 127 : sctnum;
253 nreport(player->cnum, N_RIOT, 0, n);
256 filetruncate(mailbox(buf, player->cnum));
257 np->nat_stat = STAT_INUSE;
260 wu(0, 0, "Country #%d (%s) has dissolved\n",
261 player->cnum, cname(player->cnum));
262 nreport(player->cnum, N_DISS_GOV, 0, 1);