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) ",
88 if (p == 0 || *p != 'y')
90 pr("\nIf you want some problem fixed and hope to force the issue\n");
91 pr("by dissolving, DON'T DO IT. Even if an earlier version of\n");
92 pr("this game is brought up, YOU WILL BE GONE.\n");
93 pr("Forcing the issue makes it less likely that it will be\n");
94 pr("resolved the way you wish it.\n\n");
95 pr("Be part of the solution, not part of the problem.\n\n");
96 pr("If this is a test game, dissolving will not help the test.\n\n");
97 pr("If you are down to 0 sectors, and a 25% fishing vessel with\n");
98 pr("1 mil on it, well, I can see your point. Go ahead.\n\n");
99 pr("But at least pay back your loans, if you can.\n\n");
102 *player->argp[1] = 0;
103 p = getstarg(player->argp[1],
104 "Once again, are you SURE you want to do this? (n) ",
106 if (p == 0 || *p != 'y')
109 np = getnatp(player->cnum);
113 while (nxtsct(&ns, §)) {
116 annoyed = 75 - (random() % (sect.sct_loyal + 40));
117 if (annoyed <= 0 || sect.sct_oldown != sect.sct_own) {
118 pr("Populace celebrates in %s\n",
119 xyas(sect.sct_x, sect.sct_y, player->cnum));
120 if (sect.sct_oldown != sect.sct_own) {
121 makelost(EF_SECTOR, sect.sct_own, 0, sect.sct_x,
123 makenotlost(EF_SECTOR, sect.sct_oldown, 0, sect.sct_x,
125 sect.sct_own = sect.sct_oldown;
126 if (sect.sct_own != 0)
128 "%s reverts back to you!\n",
129 xyas(sect.sct_x, sect.sct_y, sect.sct_own));
131 } else if (annoyed < 25) {
132 pr("Populace unmoved in %s\n",
133 xyas(sect.sct_x, sect.sct_y, player->cnum));
134 makelost(EF_SECTOR, sect.sct_own, 0, sect.sct_x, sect.sct_y);
138 pr("Rioting breaks out in %s\n",
139 xyas(sect.sct_x, sect.sct_y, player->cnum));
140 sectdamage(§, annoyed, 0);
142 makelost(EF_SECTOR, sect.sct_own, 0, sect.sct_x, sect.sct_y);
148 snxtitem_all(&ni, EF_LAND);
149 while (nxtitem(&ni, (s_char *)&land)) {
153 pr("%s disbands!\n", prland(&land));
155 putland(land.lnd_uid, &land);
157 snxtitem_all(&ni, EF_SHIP);
158 while (nxtitem(&ni, (s_char *)&ship)) {
161 pr("%s ", prship(&ship));
162 switch (random() % 3) {
169 putvar(V_MILIT, 0, (s_char *)&ship, EF_SHIP);
170 putvar(V_CIVIL, 0, (s_char *)&ship, EF_SHIP);
171 putvar(V_UW, 0, (s_char *)&ship, EF_SHIP);
175 damage = (random() % 80) + 10;
176 pr("crew has rioted! (%d damage)\n", damage);
177 shipdamage(&ship, damage);
181 putship(ship.shp_uid, &ship);
183 snxtitem_all(&ni, EF_PLANE);
184 while (nxtitem(&ni, (s_char *)&plane)) {
187 pr("%s ", prplane(&plane));
188 switch (random() % 2) {
195 damage = (random() % 80) + 10;
196 pr("crew has rioted! (%d damage)\n", damage);
197 planedamage(&plane, damage);
201 putplane(plane.pln_uid, &plane);
203 snxtitem_all(&ni, EF_TREATY);
204 while (nxtitem(&ni, (s_char *)&treaty)) {
205 if (treaty.trt_status == TS_FREE)
207 if (treaty.trt_cna != player->cnum &&
208 treaty.trt_cnb != player->cnum)
210 cn = treaty.trt_cna ==
211 player->cnum ? treaty.trt_cnb : treaty.trt_cna;
212 pr("No more treaty with %s\n", cname(cn));
213 wu(0, cn, "Treaty #%d with %s voided\n",
214 ni.cur, cname(player->cnum));
215 treaty.trt_status = TS_FREE;
216 puttre(ni.cur, &treaty);
218 snxtitem_all(&ni, EF_LOAN);
219 while (nxtitem(&ni, (s_char *)&loan)) {
220 if (loan.l_status == LS_FREE)
222 if (loan.l_loner != player->cnum && loan.l_lonee != player->cnum)
224 if (loan.l_loner == player->cnum) {
225 pr("Loan #%d to %s will never be repaid\n",
226 ni.cur, cname(loan.l_lonee));
228 "Loan #%d from %s has been voided\n",
229 ni.cur, cname(player->cnum));
231 pr("Loan #%d from %s will never be repaid\n",
232 ni.cur, cname(loan.l_lonee));
234 "Loan #%d to %s has been voided\n",
235 ni.cur, cname(player->cnum));
237 loan.l_status = LS_FREE;
238 putloan(ni.cur, &loan);
240 /* clean up commodity and trade for this nation. */
243 for (n = 1; n < I_MAX + 1; n++) {
244 val = commamt(player->cnum, n, &dummy);
245 commset(player->cnum, n, -val);
249 snxtitem_all(&ni, EF_TRADE);
250 while (nxtitem(&ni, (s_char *)&trade)) {
251 if (trade.trd_unitid >= 0 && trade.trd_owner == player->cnum) {
252 trade.trd_unitid = -1;
253 (void)puttrade(ni.cur, &trade);
257 n = sctnum > 127 ? 127 : sctnum;
258 nreport(player->cnum, N_RIOT, 0, n);
261 filetruncate(mailbox(buf, player->cnum));
262 np->nat_stat = STAT_INUSE;
265 wu(0, 0, "Country #%d (%s) has dissolved\n",
266 player->cnum, cname(player->cnum));
267 nreport(player->cnum, N_DISS_GOV, 0, 1);