Drop add's obscure sector check and wipe functionality

If you really need to wipe out a country, there's much more to wipe
than just sectors.
This commit is contained in:
Markus Armbruster 2011-10-30 15:51:46 +01:00
parent a9e485b13e
commit 62f0da239f
4 changed files with 9 additions and 61 deletions

View file

@ -1,16 +1,14 @@
.TH Command ADD
.NA add "Add/Remove a country in the game"
.LV Expert
.SY "add <NAT> <NAME> <REP> <visitor|new|active|god|delete> <check|wipe|ignore>"
.EX add 1 bunky mypass n i
.SY "add <NAT> <NAME> <REP> <visitor|new|active|god|delete>"
.EX add 1 bunky mypass n
This adds a new player to the game.
.EX add 2 visitor visitor v i
.EX add 2 visitor visitor v
This adds a visitor country to the game.
.EX add 1 bunky mypass d w
This removes bunky and all his sectors & units from the game.
.EX add 1 bunky mypass d c
Just to make sure that bunky doesn't still have any stuff in the game.
.EX add 36 martian outerspace a i
.EX add 1 bunky mypass d
This removes bunky from the game.
.EX add 36 martian outerspace a
This will add a new country which will be able to send/receive
telegrams but won't have any land. For example, you could give a
newbie helper a country like this.

View file

@ -33,20 +33,12 @@
#include <config.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include "commands.h"
#include "optlist.h"
#include "plague.h"
int
add(void)
{
struct natstr *natp;
struct sctstr sect;
struct nstr_sect nstr;
int i;
char cntryname[sizeof(natp->nat_cnam)];
char pname[sizeof(natp->nat_pnam)];
@ -117,50 +109,8 @@ add(void)
pr("Illegal status\n");
return RET_SYN;
}
p = getstarg(player->argp[5],
"Check, wipe, or ignore existing sectors (c|w|i) ", buf);
if (!p)
return RET_SYN;
strcpy(natp->nat_cnam, cntryname);
strcpy(natp->nat_pnam, pname);
if (*p != 'w' && *p != 'c') {
pr("Any existing sectors ignored\n");
} else {
pr("Checking sectors...\n");
snxtsct_all(&nstr);
while (nxtsct(&nstr, &sect)) {
if (sect.sct_own != coun)
continue;
pr("%s ", xyas(nstr.x, nstr.y, player->cnum));
if (*p == 'w') {
sect.sct_mobil = 0;
sect.sct_effic = 0;
sect.sct_road = 0;
sect.sct_rail = 0;
sect.sct_defense = 0;
sect.sct_own = 0;
sect.sct_oldown = 0;
sect.sct_newtype = sect.sct_type
= dchr[sect.sct_type].d_terrain;
sect.sct_dist_x = sect.sct_x;
sect.sct_dist_y = sect.sct_y;
memset(sect.sct_item, 0, sizeof(sect.sct_item));
memset(sect.sct_del, 0, sizeof(sect.sct_del));
memset(sect.sct_dist, 0, sizeof(sect.sct_dist));
sect.sct_mines = 0;
sect.sct_pstage = PLG_HEALTHY;
sect.sct_ptime = 0;
sect.sct_che = 0;
sect.sct_che_target = 0;
sect.sct_fallout = 0;
putsect(&sect);
pr("wiped\n");
} else {
pr("\n");
}
}
}
if (stat == STAT_NEW || stat == STAT_VIS)
nat_reset(natp, stat, 0, 0);
else {

View file

@ -44,7 +44,7 @@
struct cmndstr player_coms[] = {
/* command form cost addr permit */
{"accept [as-COUNTRY]", 0, acce, C_MOD, NORM},
{"add <NAT> <NAME> <REP> <STATUS> <c|w|i>", 0, add, C_MOD, GOD},
{"add <NAT> <NAME> <REP> <STATUS>", 0, add, C_MOD, GOD},
{"announce", 0, tele, C_MOD, VIS},
{"anti <SECT>", 3, anti, C_MOD, NORM + MONEY + CAP},
{"apropos <topic>", 0, apro, 0, VIS},

View file

@ -1153,12 +1153,12 @@ write_newcap_script(void)
}
for (c = 0; c < nc; ++c) {
fprintf(script, "add %d %d %d n i\n", c + 1, c + 1, c + 1);
fprintf(script, "add %d %d %d n\n", c + 1, c + 1, c + 1);
if (AIRPORT_MARKER)
fprintf(script, "des %d,%d -\n", capx[c], capy[c]);
fprintf(script, "newcap %d %d,%d\n", c + 1, capx[c], capy[c]);
}
fprintf(script, "add %d visitor visitor v i\n", c + 1);
fprintf(script, "add %d visitor visitor v\n", c + 1);
fclose(script);
return 0;
}