Revise nation status command permissions
Create new command capability NONVIS. Give it to players in any state except visitors (and STAT_UNUSED, but those must not exist). This makes it possible to have commands available to anyone but visitors. Command change fails when the player is a visitor. Simply make it unavailable instead, by requiring NONVIS. Make read unavailable to visitors, because it's useless: visitors can't receive telegrams (typed_wu() fails). Make census, commodity and sinfra unavailable to visitors. Visitors don't normally have sectors. Make map and nmap unavailable to visitors. Visitors don't have sectors, so their maps are always empty. Make them unavailable to new players (between add and newcap) and players in sanctuary, too. This is consistent with all the other commands to examine the environment. It also prevents people from trying multiple unbroken countries in a blitz to find the one with the nicest vicinity. Make resource available to new players, for consistency with census and commodity. Make country, echo and financial available to anyone.
This commit is contained in:
parent
481d1dabe2
commit
f9fc80e2de
4 changed files with 15 additions and 17 deletions
|
@ -42,6 +42,7 @@
|
|||
#include "types.h"
|
||||
|
||||
/* player command capabilities */
|
||||
#define NONVIS bit(0) /* can execute common commands (visitors can't) */
|
||||
#define SANCT bit(1) /* can execute commands available in sanctuary */
|
||||
#define NORM bit(2) /* can execute active player commands */
|
||||
#define GOD bit(3) /* can execute deity commands */
|
||||
|
|
|
@ -49,10 +49,6 @@ chan(void)
|
|||
if (!p)
|
||||
return RET_SYN;
|
||||
us = getnatp(player->cnum);
|
||||
if (us->nat_stat == STAT_VIS) {
|
||||
pr("Visitor countries can't change their country name or representative.\n");
|
||||
return RET_FAIL;
|
||||
}
|
||||
switch (*p) {
|
||||
case 'n':
|
||||
case 'c':
|
||||
|
|
|
@ -70,15 +70,15 @@ struct cmndstr player_coms[] = {
|
|||
{"bye", 0, quit, 0, 0},
|
||||
{"capital <SECT>", 0, capi, C_MOD, NORM},
|
||||
{"cargo <SHIPS>", 0, carg, 0, NORM},
|
||||
{"census <SECTS>", 0, cens, 0, 0},
|
||||
{"change <country|representative> <NAME>", 0, chan, C_MOD, 0},
|
||||
{"census <SECTS>", 0, cens, 0, NONVIS},
|
||||
{"change <country|representative> <NAME>", 0, chan, C_MOD, NONVIS},
|
||||
{"coastwatch <SECTS>", 1, coas, C_MOD, NORM + CAP},
|
||||
{"collect <LOAN> <SECT>", 2, coll, C_MOD, NORM + MONEY + CAP},
|
||||
{"commodity <SECTS>", 0, comm, 0, 0},
|
||||
{"commodity <SECTS>", 0, comm, 0, NONVIS},
|
||||
{"consider <loan|treaty> <LOAN/TREATY> <acc|decl|post>",
|
||||
1, cons, C_MOD, NORM + CAP},
|
||||
{"convert <SECTS> <NUM> [sure?]", 2, conv, C_MOD, NORM + MONEY + CAP},
|
||||
{"country <NATS>", 0, coun, 0, NORM},
|
||||
{"country <NATS>", 0, coun, 0, 0},
|
||||
{"cutoff <SECTS>", 0, cuto, C_MOD, NORM},
|
||||
{"declare <all|friend|neut|hos|war> <NATS>",
|
||||
2, decl, C_MOD, NORM + CAP},
|
||||
|
@ -92,7 +92,7 @@ struct cmndstr player_coms[] = {
|
|||
{"drop <cargo-PLANES> <fighter-PLANES> <ap-SECT> <PATH|DESTINATION> <COMM>",
|
||||
1, drop, C_MOD, NORM + MONEY + CAP},
|
||||
{"dump <SECTS> [<fields>]", 0, dump, 0, NORM},
|
||||
{"echo [<string>]", 0, echo, 0, NORM},
|
||||
{"echo [<string>]", 0, echo, 0, 0},
|
||||
{"edit <country|land|ship|plane|unit> <NAT|SECT|SHIP|PLANE|LAND> [<KEY> <VALUE>]...",
|
||||
0, edit, C_MOD, GOD},
|
||||
{"enable", 0, enab, C_MOD, GOD},
|
||||
|
@ -100,7 +100,7 @@ struct cmndstr player_coms[] = {
|
|||
{"execute <INPUT FILE>", 0, execute, 0, EXEC},
|
||||
{"explore <c|m> <SECT> <NUM> <PATH|DESTINATION>",
|
||||
1, explore, C_MOD, NORM + MONEY + CAP},
|
||||
{"financial", 0, fina, 0, NORM},
|
||||
{"financial", 0, fina, 0, 0},
|
||||
{"fire <TYPE> <from-SECTS | SHIPS | UNITS> [TO-SECT | SHIP]",
|
||||
1, multifire, C_MOD, NORM + MONEY + CAP},
|
||||
{"flash <COUNTRY> [<message>]", 0, flash, 0, 0},
|
||||
|
@ -145,7 +145,7 @@ struct cmndstr player_coms[] = {
|
|||
1, ltend, C_MOD, NORM + CAP},
|
||||
{"lunload <COMM|\"land\"|\"plane\"> <UNITS> <NUM|UNITS|PLANES>",
|
||||
1, lload, C_MOD, NORM + CAP},
|
||||
{"map <SECTS|SHIP> [s|l|n|p|*|h]", 0, map, C_MOD, 0},
|
||||
{"map <SECTS|SHIP> [s|l|n|p|*|h]", 0, map, C_MOD, NORM},
|
||||
{"march <UNITS> <PATH|DESTINATION>", 1, march, C_MOD, NORM + CAP},
|
||||
{"market <COMM|\"all\">", 0, mark, C_MOD, NORM},
|
||||
{"mine <SHIPS>", 2, mine, C_MOD, NORM + MONEY + CAP},
|
||||
|
@ -164,7 +164,7 @@ struct cmndstr player_coms[] = {
|
|||
{"newcap <NAT> <SECTOR>", 0, new, C_MOD, GOD},
|
||||
{"neweff <SECTS>", 0, newe, C_MOD, NORM},
|
||||
{"newspaper [days]", 0, news, 0, 0},
|
||||
{"nmap <SECTS|NUKE> [s|l|n|p|*|h]", 0, map, C_MOD, 0},
|
||||
{"nmap <SECTS|NUKE> [s|l|n|p|*|h]", 0, map, C_MOD, NORM},
|
||||
{"nuke <SECTS>", 0, nuke, 0, NORM},
|
||||
{"offer <loan|treaty> <NAT> [<NUM> <DAYS> <IRATE>]",
|
||||
1, offe, C_MOD, NORM + MONEY + CAP},
|
||||
|
@ -190,7 +190,7 @@ struct cmndstr player_coms[] = {
|
|||
{"quit", 0, quit, 0, 0},
|
||||
{"radar <SHIPS | SECTS>", 1, rada, C_MOD, NORM + CAP},
|
||||
{"range <PLANES> <range>", 1, range, C_MOD, NORM + CAP},
|
||||
{"read [yes|no|<CNUM/CNAME>]", 0, rea, C_MOD, 0},
|
||||
{"read [yes|no|<CNUM/CNAME>]", 0, rea, C_MOD, NONVIS},
|
||||
{"realm <number> [<SECTS>]", 0, real, C_MOD, NORM},
|
||||
{"recon <spy-PLANES> <fighter-PLANES> <ap-SECT> <PATH|DESTINATION>",
|
||||
3, reco, C_MOD, NORM + MONEY + CAP},
|
||||
|
@ -201,7 +201,7 @@ struct cmndstr player_coms[] = {
|
|||
{"repay <LOAN> <NUM>", 1, repa, C_MOD, NORM + MONEY + CAP},
|
||||
{"report <NATS>", 0, repo, 0, 0},
|
||||
{"reset <lot #> <0|price>", 1, rese, C_MOD, NORM + CAP},
|
||||
{"resource <SECTS>", 0, reso, 0, NORM},
|
||||
{"resource <SECTS>", 0, reso, 0, NONVIS},
|
||||
{"retreat <SHIPS|FLEET> <PATH> [i|t|s|h|b|d|u|c]",
|
||||
1, retr, C_MOD, NORM + CAP},
|
||||
{"route <COMM> <SECTS>", 1, rout, C_MOD, NORM},
|
||||
|
@ -229,7 +229,7 @@ struct cmndstr player_coms[] = {
|
|||
"\tshow updates [<NUM>]>",
|
||||
0, show, 0, 0},
|
||||
{"shutdown <minutes> <disable update?>", 0, shut, 0, GOD},
|
||||
{"sinfrastructure <SECTS>", 0, sinfra, 0, 0},
|
||||
{"sinfrastructure <SECTS>", 0, sinfra, 0, NONVIS},
|
||||
{"skywatch <SECTS>", 1, skyw, C_MOD, NORM + CAP},
|
||||
{"smap <SECTS|SHIP> [s|l|n|p|*|h]", 0, map, C_MOD, NORM},
|
||||
{"sonar <SHIPS> <brief?>", 1, sona, C_MOD, NORM + CAP},
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
* Known contributors to this file:
|
||||
* Dave Pare, 1994
|
||||
* Steve McClure, 2000
|
||||
* Markus Armbruster, 2007
|
||||
* Markus Armbruster, 2007-2012
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -70,7 +70,8 @@ player_set_nstat(struct player *pl, struct natstr *np)
|
|||
{
|
||||
static int nstat[] = {
|
||||
/* must match nat_status */
|
||||
0, 0, 0, SANCT, NORM, GOD | NORM | CAP | MONEY
|
||||
0, NONVIS, 0, SANCT | NONVIS, NORM | NONVIS,
|
||||
GOD | NORM | NONVIS | CAP | MONEY
|
||||
};
|
||||
|
||||
if (CANT_HAPPEN(pl->cnum != np->nat_cnum))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue