(diss, player_coms): Command `dissolve' has been disabled at least
since the days of Chainsaw (early '90s), and the code smells bad. Bury it.
This commit is contained in:
parent
3060cabc48
commit
19acc1cd07
4 changed files with 2 additions and 264 deletions
|
@ -90,7 +90,6 @@ int deli(void);
|
||||||
int demo(void);
|
int demo(void);
|
||||||
int desi(void);
|
int desi(void);
|
||||||
int disa(void);
|
int disa(void);
|
||||||
int diss(void);
|
|
||||||
int dist(void);
|
int dist(void);
|
||||||
int drop(void);
|
int drop(void);
|
||||||
int dump(void);
|
int dump(void);
|
||||||
|
|
|
@ -38,7 +38,7 @@ NTLIB = $(SRCDIR)\lib\libcommands.lib
|
||||||
OBJS = acce.o add.o anti.o arm.o army.o assa.o atta.o bdes.o best.o boar.o \
|
OBJS = acce.o add.o anti.o arm.o army.o assa.o atta.o bdes.o best.o boar.o \
|
||||||
bomb.o brea.o budg.o buil.o buy.o capi.o carg.o cede.o cens.o chan.o \
|
bomb.o brea.o budg.o buil.o buy.o capi.o carg.o cede.o cens.o chan.o \
|
||||||
coas.o coll.o comm.o cons.o conv.o coun.o cuto.o decl.o deli.o demo.o \
|
coas.o coll.o comm.o cons.o conv.o coun.o cuto.o decl.o deli.o demo.o \
|
||||||
desi.o disa.o diss.o dist.o drop.o dump.o echo.o edit.o enab.o enli.o \
|
desi.o disa.o dist.o drop.o dump.o echo.o edit.o enab.o enli.o \
|
||||||
expl.o fina.o flash.o flee.o fly.o foll.o forc.o fort.o fuel.o give.o \
|
expl.o fina.o flash.o flee.o fly.o foll.o forc.o fort.o fuel.o give.o \
|
||||||
grin.o hard.o head.o hidd.o improve.o info.o land.o laun.o lboard.o \
|
grin.o hard.o head.o hidd.o improve.o info.o land.o laun.o lboard.o \
|
||||||
ldump.o ledg.o leve.o load.o look.o lost.o lstat.o lten.o map.o \
|
ldump.o ledg.o leve.o load.o look.o lost.o lstat.o lten.o map.o \
|
||||||
|
@ -57,7 +57,7 @@ NTOBJS = acce.obj add.obj anti.obj arm.obj army.obj assa.obj atta.obj \
|
||||||
bdes.obj best.obj boar.obj bomb.obj brea.obj budg.obj buil.obj \
|
bdes.obj best.obj boar.obj bomb.obj brea.obj budg.obj buil.obj \
|
||||||
buy.obj capi.obj carg.obj cede.obj cens.obj chan.obj coas.obj \
|
buy.obj capi.obj carg.obj cede.obj cens.obj chan.obj coas.obj \
|
||||||
coll.obj comm.obj cons.obj conv.obj coun.obj cuto.obj decl.obj \
|
coll.obj comm.obj cons.obj conv.obj coun.obj cuto.obj decl.obj \
|
||||||
deli.obj demo.obj desi.obj disa.obj diss.obj dist.obj drop.obj \
|
deli.obj demo.obj desi.obj disa.obj dist.obj drop.obj \
|
||||||
dump.obj echo.obj edit.obj enab.obj enli.obj expl.obj fina.obj \
|
dump.obj echo.obj edit.obj enab.obj enli.obj expl.obj fina.obj \
|
||||||
flash.obj flee.obj fly.obj foll.obj forc.obj fort.obj fuel.obj \
|
flash.obj flee.obj fly.obj foll.obj forc.obj fort.obj fuel.obj \
|
||||||
give.obj grin.obj hard.obj head.obj hidd.obj improve.obj info.obj \
|
give.obj grin.obj hard.obj head.obj hidd.obj improve.obj info.obj \
|
||||||
|
|
|
@ -1,260 +0,0 @@
|
||||||
/*
|
|
||||||
* Empire - A multi-player, client/server Internet based war game.
|
|
||||||
* Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
|
|
||||||
* Ken Stevens, Steve McClure
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* ---
|
|
||||||
*
|
|
||||||
* See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
|
|
||||||
* related information and legal notices. It is expected that any future
|
|
||||||
* projects/authors will amend these files as needed.
|
|
||||||
*
|
|
||||||
* ---
|
|
||||||
*
|
|
||||||
* diss.c: Dissolve
|
|
||||||
*
|
|
||||||
* Known contributors to this file:
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "misc.h"
|
|
||||||
#include "player.h"
|
|
||||||
#include "var.h"
|
|
||||||
#include "sect.h"
|
|
||||||
#include "ship.h"
|
|
||||||
#include "plane.h"
|
|
||||||
#include "land.h"
|
|
||||||
#include "nat.h"
|
|
||||||
#include "loan.h"
|
|
||||||
#include "treaty.h"
|
|
||||||
#include "news.h"
|
|
||||||
#include "file.h"
|
|
||||||
#include "xy.h"
|
|
||||||
#include "nsc.h"
|
|
||||||
#include "tel.h"
|
|
||||||
#include "nuke.h"
|
|
||||||
#include "trade.h"
|
|
||||||
#include "commands.h"
|
|
||||||
|
|
||||||
int
|
|
||||||
diss(void)
|
|
||||||
{
|
|
||||||
struct sctstr sect;
|
|
||||||
struct lndstr land;
|
|
||||||
struct shpstr ship;
|
|
||||||
struct plnstr plane;
|
|
||||||
struct trtstr treaty;
|
|
||||||
struct trdstr trade;
|
|
||||||
struct lonstr loan;
|
|
||||||
struct nstr_item ni;
|
|
||||||
struct nstr_sect ns;
|
|
||||||
int sctnum;
|
|
||||||
int damage;
|
|
||||||
int annoyed;
|
|
||||||
int n;
|
|
||||||
s_char *p;
|
|
||||||
natid cn;
|
|
||||||
float dummy;
|
|
||||||
int val;
|
|
||||||
s_char buf[1024];
|
|
||||||
struct natstr *np;
|
|
||||||
|
|
||||||
if (player->cnum == 0) {
|
|
||||||
/* Dissolve the Deity??? */
|
|
||||||
/* Probably someone broke in. */
|
|
||||||
/* Send a tele to deity, and abort the session. */
|
|
||||||
wu(0, 0, "Diety dissolve attempted! Session was aborted.\n");
|
|
||||||
quit();
|
|
||||||
}
|
|
||||||
if (player->argp[1])
|
|
||||||
*player->argp[1] = 0;
|
|
||||||
p = getstarg(player->argp[1], "Are you SURE you want to do this? (n) ",
|
|
||||||
buf);
|
|
||||||
if (p == 0 || *p != 'y')
|
|
||||||
return RET_SYN;
|
|
||||||
pr("\nIf you want some problem fixed and hope to force the issue\n");
|
|
||||||
pr("by dissolving, DON'T DO IT. Even if an earlier version of\n");
|
|
||||||
pr("this game is brought up, YOU WILL BE GONE.\n");
|
|
||||||
pr("Forcing the issue makes it less likely that it will be\n");
|
|
||||||
pr("resolved the way you wish it.\n\n");
|
|
||||||
pr("Be part of the solution, not part of the problem.\n\n");
|
|
||||||
pr("If this is a test game, dissolving will not help the test.\n\n");
|
|
||||||
pr("If you are down to 0 sectors, and a 25% fishing vessel with\n");
|
|
||||||
pr("1 mil on it, well, I can see your point. Go ahead.\n\n");
|
|
||||||
pr("But at least pay back your loans, if you can.\n\n");
|
|
||||||
|
|
||||||
if (player->argp[1])
|
|
||||||
*player->argp[1] = 0;
|
|
||||||
p = getstarg(player->argp[1],
|
|
||||||
"Once again, are you SURE you want to do this? (n) ",
|
|
||||||
buf);
|
|
||||||
if (p == 0 || *p != 'y')
|
|
||||||
return RET_SYN;
|
|
||||||
|
|
||||||
np = getnatp(player->cnum);
|
|
||||||
np->nat_stat = VIS;
|
|
||||||
snxtsct_all(&ns);
|
|
||||||
sctnum = 0;
|
|
||||||
while (nxtsct(&ns, §)) {
|
|
||||||
if (!player->owner)
|
|
||||||
continue;
|
|
||||||
annoyed = 75 - (random() % (sect.sct_loyal + 40));
|
|
||||||
if (annoyed <= 0 || sect.sct_oldown != sect.sct_own) {
|
|
||||||
pr("Populace celebrates in %s\n",
|
|
||||||
xyas(sect.sct_x, sect.sct_y, player->cnum));
|
|
||||||
if (sect.sct_oldown != sect.sct_own) {
|
|
||||||
makelost(EF_SECTOR, sect.sct_own, 0, sect.sct_x,
|
|
||||||
sect.sct_y);
|
|
||||||
makenotlost(EF_SECTOR, sect.sct_oldown, 0, sect.sct_x,
|
|
||||||
sect.sct_y);
|
|
||||||
sect.sct_own = sect.sct_oldown;
|
|
||||||
if (sect.sct_own != 0)
|
|
||||||
wu(0, sect.sct_own,
|
|
||||||
"%s reverts back to you!\n",
|
|
||||||
xyas(sect.sct_x, sect.sct_y, sect.sct_own));
|
|
||||||
}
|
|
||||||
} else if (annoyed < 25) {
|
|
||||||
pr("Populace unmoved in %s\n",
|
|
||||||
xyas(sect.sct_x, sect.sct_y, player->cnum));
|
|
||||||
makelost(EF_SECTOR, sect.sct_own, 0, sect.sct_x, sect.sct_y);
|
|
||||||
sect.sct_own = 0;
|
|
||||||
sect.sct_oldown = 0;
|
|
||||||
} else {
|
|
||||||
pr("Rioting breaks out in %s\n",
|
|
||||||
xyas(sect.sct_x, sect.sct_y, player->cnum));
|
|
||||||
sectdamage(§, annoyed, 0);
|
|
||||||
sctnum++;
|
|
||||||
makelost(EF_SECTOR, sect.sct_own, 0, sect.sct_x, sect.sct_y);
|
|
||||||
sect.sct_own = 0;
|
|
||||||
sect.sct_oldown = 0;
|
|
||||||
}
|
|
||||||
putsect(§);
|
|
||||||
}
|
|
||||||
snxtitem_all(&ni, EF_LAND);
|
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
|
||||||
if (!player->owner)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
pr("%s disbands!\n", prland(&land));
|
|
||||||
land.lnd_effic = 0;
|
|
||||||
putland(land.lnd_uid, &land);
|
|
||||||
}
|
|
||||||
snxtitem_all(&ni, EF_SHIP);
|
|
||||||
while (nxtitem(&ni, (s_char *)&ship)) {
|
|
||||||
if (!player->owner)
|
|
||||||
continue;
|
|
||||||
pr("%s ", prship(&ship));
|
|
||||||
switch (random() % 3) {
|
|
||||||
case 0:
|
|
||||||
pr("scuttled!\n");
|
|
||||||
ship.shp_effic = 0;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
pr("abandoned!\n");
|
|
||||||
putvar(V_MILIT, 0, (s_char *)&ship, EF_SHIP);
|
|
||||||
putvar(V_CIVIL, 0, (s_char *)&ship, EF_SHIP);
|
|
||||||
putvar(V_UW, 0, (s_char *)&ship, EF_SHIP);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
default:
|
|
||||||
damage = (random() % 80) + 10;
|
|
||||||
pr("crew has rioted! (%d damage)\n", damage);
|
|
||||||
shipdamage(&ship, damage);
|
|
||||||
sctnum++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
putship(ship.shp_uid, &ship);
|
|
||||||
}
|
|
||||||
snxtitem_all(&ni, EF_PLANE);
|
|
||||||
while (nxtitem(&ni, (s_char *)&plane)) {
|
|
||||||
if (!player->owner)
|
|
||||||
continue;
|
|
||||||
pr("%s ", prplane(&plane));
|
|
||||||
switch (random() % 2) {
|
|
||||||
case 0:
|
|
||||||
pr("blown up!\n");
|
|
||||||
plane.pln_effic = 0;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
default:
|
|
||||||
damage = (random() % 80) + 10;
|
|
||||||
pr("crew has rioted! (%d damage)\n", damage);
|
|
||||||
planedamage(&plane, damage);
|
|
||||||
sctnum++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
putplane(plane.pln_uid, &plane);
|
|
||||||
}
|
|
||||||
snxtitem_all(&ni, EF_TREATY);
|
|
||||||
while (nxtitem(&ni, (s_char *)&treaty)) {
|
|
||||||
if (treaty.trt_status == TS_FREE)
|
|
||||||
continue;
|
|
||||||
if (treaty.trt_cna != player->cnum &&
|
|
||||||
treaty.trt_cnb != player->cnum)
|
|
||||||
continue;
|
|
||||||
cn = treaty.trt_cna ==
|
|
||||||
player->cnum ? treaty.trt_cnb : treaty.trt_cna;
|
|
||||||
pr("No more treaty with %s\n", cname(cn));
|
|
||||||
wu(0, cn, "Treaty #%d with %s voided\n",
|
|
||||||
ni.cur, cname(player->cnum));
|
|
||||||
treaty.trt_status = TS_FREE;
|
|
||||||
puttre(ni.cur, &treaty);
|
|
||||||
}
|
|
||||||
snxtitem_all(&ni, EF_LOAN);
|
|
||||||
while (nxtitem(&ni, (s_char *)&loan)) {
|
|
||||||
if (loan.l_status == LS_FREE)
|
|
||||||
continue;
|
|
||||||
if (loan.l_loner != player->cnum && loan.l_lonee != player->cnum)
|
|
||||||
continue;
|
|
||||||
if (loan.l_loner == player->cnum) {
|
|
||||||
pr("Loan #%d to %s will never be repaid\n",
|
|
||||||
ni.cur, cname(loan.l_lonee));
|
|
||||||
wu(0, loan.l_lonee,
|
|
||||||
"Loan #%d from %s has been voided\n",
|
|
||||||
ni.cur, cname(player->cnum));
|
|
||||||
} else {
|
|
||||||
pr("Loan #%d from %s will never be repaid\n",
|
|
||||||
ni.cur, cname(loan.l_lonee));
|
|
||||||
wu(0, loan.l_loner,
|
|
||||||
"Loan #%d to %s has been voided\n",
|
|
||||||
ni.cur, cname(player->cnum));
|
|
||||||
}
|
|
||||||
loan.l_status = LS_FREE;
|
|
||||||
putloan(ni.cur, &loan);
|
|
||||||
}
|
|
||||||
snxtitem_all(&ni, EF_TRADE);
|
|
||||||
while (nxtitem(&ni, (s_char *)&trade)) {
|
|
||||||
if (trade.trd_unitid >= 0 && trade.trd_owner == player->cnum) {
|
|
||||||
trade.trd_unitid = -1;
|
|
||||||
(void)puttrade(ni.cur, &trade);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (sctnum > 0) {
|
|
||||||
n = sctnum > 127 ? 127 : sctnum;
|
|
||||||
nreport(player->cnum, N_RIOT, 0, n);
|
|
||||||
sctnum -= n;
|
|
||||||
}
|
|
||||||
filetruncate(mailbox(buf, player->cnum));
|
|
||||||
np->nat_stat = STAT_INUSE;
|
|
||||||
np->nat_btu = 0;
|
|
||||||
player->nstat = VIS;
|
|
||||||
wu(0, 0, "Country #%d (%s) has dissolved\n",
|
|
||||||
player->cnum, cname(player->cnum));
|
|
||||||
nreport(player->cnum, N_DISS_GOV, 0, 1);
|
|
||||||
putnat(np);
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
|
@ -92,7 +92,6 @@ struct cmndstr player_coms[] = {
|
||||||
{"designate <SECTS> <type> [sure?]", 1, desi, C_MOD, NORM},
|
{"designate <SECTS> <type> [sure?]", 1, desi, C_MOD, NORM},
|
||||||
{"disable", 0, disa, C_MOD, GOD},
|
{"disable", 0, disa, C_MOD, GOD},
|
||||||
{"disarm <PLANE>", 2, arm, C_MOD, NORM + MONEY + CAP},
|
{"disarm <PLANE>", 2, arm, C_MOD, NORM + MONEY + CAP},
|
||||||
{"dissolve <really dissove?>", 0, diss, C_MOD, GOD},
|
|
||||||
{"distribute <SECTS> <DISTSECT|.|h>", 1, dist, C_MOD, NORM},
|
{"distribute <SECTS> <DISTSECT|.|h>", 1, dist, C_MOD, NORM},
|
||||||
{"drop <cargo-PLANES> <fighter-PLANES> <ap-SECT> <PATH|DESTINATION> <COMM>", 1, drop, C_MOD, NORM + MONEY + CAP},
|
{"drop <cargo-PLANES> <fighter-PLANES> <ap-SECT> <PATH|DESTINATION> <COMM>", 1, drop, C_MOD, NORM + MONEY + CAP},
|
||||||
{"dump <SECTS> [<fields>]", 0, dump, 0, NORM},
|
{"dump <SECTS> [<fields>]", 0, dump, 0, NORM},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue