From 364b208f289d57b0324270bcca98e9e93e68eaa5 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 18 Feb 2012 13:55:58 +0100 Subject: [PATCH] Drop useless nstat value VIS A player may execute a command when his player->nstat has all the bits in the command's c_permit. All commands require bit(0). All players always have it. Silly; get rid of it. --- include/player.h | 7 ++--- src/lib/player/empmod.c | 62 +++++++++++++++++++------------------- src/lib/player/init_nats.c | 2 +- 3 files changed, 35 insertions(+), 36 deletions(-) diff --git a/include/player.h b/include/player.h index e6ae8d2a5..8c9691be9 100644 --- a/include/player.h +++ b/include/player.h @@ -42,10 +42,9 @@ #include "types.h" /* nstat values */ -#define VIS bit(0) -#define SANCT (bit(1) | VIS) -#define NORM (bit(2) | VIS) -#define GOD (bit(3) | NORM | VIS) +#define SANCT bit(1) +#define NORM bit(2) +#define GOD (bit(3) | NORM) #define EXEC bit(5) #define CAP bit(6) #define MONEY bit(7) diff --git a/src/lib/player/empmod.c b/src/lib/player/empmod.c index 0022ef906..265b02f0b 100644 --- a/src/lib/player/empmod.c +++ b/src/lib/player/empmod.c @@ -32,7 +32,7 @@ * Thomas Ruschak, 1992 * Ken Stevens, 1995 * Steve McClure, 1996-2000 - * Markus Armbruster, 2004-2011 + * Markus Armbruster, 2004-2012 */ #include @@ -45,9 +45,9 @@ struct cmndstr player_coms[] = { /* command form cost addr permit */ {"accept [as-COUNTRY]", 0, acce, C_MOD, NORM}, {"add ", 0, add, C_MOD, GOD}, - {"announce", 0, tele, C_MOD, VIS}, + {"announce", 0, tele, C_MOD, 0}, {"anti ", 3, anti, C_MOD, NORM + MONEY + CAP}, - {"apropos ", 0, apro, 0, VIS}, + {"apropos ", 0, apro, 0, 0}, {"arm ", 3, arm, C_MOD, NORM + MONEY + CAP}, {"army ", 0, army, C_MOD, NORM}, {"assault [ ]", @@ -67,14 +67,14 @@ struct cmndstr player_coms[] = { 1, buil, C_MOD, NORM + MONEY + CAP}, {"buy ", 1, buy, C_MOD, CAP + NORM + MONEY}, - {"bye", 0, quit, 0, VIS}, + {"bye", 0, quit, 0, 0}, {"capital ", 0, capi, C_MOD, NORM}, {"cargo ", 0, carg, 0, NORM}, - {"census ", 0, cens, 0, VIS}, - {"change ", 0, chan, C_MOD, VIS}, + {"census ", 0, cens, 0, 0}, + {"change ", 0, chan, C_MOD, 0}, {"coastwatch ", 1, coas, C_MOD, NORM + CAP}, {"collect ", 2, coll, C_MOD, NORM + MONEY + CAP}, - {"commodity ", 0, comm, 0, VIS}, + {"commodity ", 0, comm, 0, 0}, {"consider ", 1, cons, C_MOD, NORM + CAP}, {"convert [sure?]", 2, conv, C_MOD, NORM + MONEY + CAP}, @@ -97,13 +97,13 @@ struct cmndstr player_coms[] = { 0, edit, C_MOD, GOD}, {"enable", 0, enab, C_MOD, GOD}, {"enlist ", 2, enli, C_MOD, NORM + MONEY + CAP}, - {"execute ", 0, execute, 0, VIS + EXEC}, + {"execute ", 0, execute, 0, EXEC}, {"explore ", 1, explore, C_MOD, NORM + MONEY + CAP}, {"financial", 0, fina, 0, NORM}, {"fire [TO-SECT | SHIP]", 1, multifire, C_MOD, NORM + MONEY + CAP}, - {"flash []", 0, flash, 0, VIS}, + {"flash []", 0, flash, 0, 0}, {"fleetadd ", 0, flee, C_MOD, NORM}, {"fly ", 2, fly, C_MOD, NORM + MONEY + CAP}, @@ -113,11 +113,11 @@ struct cmndstr player_coms[] = { {"give ", 0, give, C_MOD, GOD}, {"grind ", 1, grin, C_MOD, NORM + MONEY + CAP}, {"harden ", 2, hard, C_MOD, NORM + MONEY + CAP}, - {"headlines [days]", 0, head, C_MOD, VIS}, - {"help ", 0, info, 0, VIS}, + {"headlines [days]", 0, head, C_MOD, 0}, + {"help ", 0, info, 0, 0}, {"improve ", 1, improve, C_MOD, NORM + MONEY + CAP}, - {"info ", 0, info, 0, VIS}, + {"info ", 0, info, 0, 0}, {"land ", 0, land, C_MOD, NORM}, {"launch ", 3, laun, C_MOD, NORM + MONEY + CAP}, {"lbmap [s|l|n|p|r|t|*|h]", 0, map, C_MOD, NORM}, @@ -127,7 +127,7 @@ struct cmndstr player_coms[] = { {"ldump []", 0, ldump, 0, NORM}, {"ledger ", 0, ledg, 0, NORM}, {"level ", 0, leve, 0, NORM}, - {"list", 0, explain, 0, VIS}, + {"list", 0, explain, 0, 0}, {"lload ", 1, lload, C_MOD, NORM + CAP}, {"llookout ", 1, llook, 0, NORM + CAP}, @@ -145,26 +145,26 @@ struct cmndstr player_coms[] = { 1, ltend, C_MOD, NORM + CAP}, {"lunload ", 1, lload, C_MOD, NORM + CAP}, - {"map [s|l|n|p|*|h]", 0, map, C_MOD, VIS}, + {"map [s|l|n|p|*|h]", 0, map, C_MOD, 0}, {"march ", 1, march, C_MOD, NORM + CAP}, {"market ", 0, mark, C_MOD, NORM}, {"mine ", 2, mine, C_MOD, NORM + MONEY + CAP}, {"mission []", 2, mission, C_MOD, NORM + CAP}, {"morale ", 1, morale, C_MOD, NORM + CAP}, - {"motd", 0, show_motd, C_MOD, VIS}, + {"motd", 0, show_motd, C_MOD, 0}, {"move ", 1, move, C_MOD, NORM + CAP}, {"mquota ", 2, mobq, C_MOD, NORM + CAP}, {"name ", 0, name, C_MOD, NORM}, - {"nation [as-COUNTRY]", 0, nati, 0, VIS}, + {"nation [as-COUNTRY]", 0, nati, 0, 0}, {"navigate ", 1, navi, C_MOD, NORM + CAP}, {"nbmap [s|l|n|p|r|t|*|h]", 0, map, C_MOD, NORM}, {"ndump ", 0, ndump, 0, NORM}, {"newcap ", 0, new, C_MOD, GOD}, {"neweff ", 0, newe, C_MOD, NORM}, - {"newspaper [days]", 0, news, 0, VIS}, - {"nmap [s|l|n|p|*|h]", 0, map, C_MOD, VIS}, + {"newspaper [days]", 0, news, 0, 0}, + {"nmap [s|l|n|p|*|h]", 0, map, C_MOD, 0}, {"nuke ", 0, nuke, 0, NORM}, {"offer [ ]", 1, offe, C_MOD, NORM + MONEY + CAP}, @@ -179,27 +179,27 @@ struct cmndstr player_coms[] = { {"pdump []", 0, pdump, 0, NORM}, {"peek ", 0, peek, 0, GOD}, {"plane ", 0, plan, 0, NORM}, - {"players", 0, play, 0, VIS}, + {"players", 0, play, 0, 0}, {"pmap [s|l|n|p|*|h]", 0, map, C_MOD, NORM}, {"power [\"new\"|\"update\"] [ | \"country\" ]", - 0, powe, C_MOD, VIS}, + 0, powe, C_MOD, 0}, {"pray", 0, tele, C_MOD, NORM}, {"production ", 0, prod, 0, NORM}, {"pstat ", 0, pstat, 0, NORM}, {"qorder ", 0, qorde, C_MOD, NORM + CAP}, - {"quit", 0, quit, 0, VIS}, + {"quit", 0, quit, 0, 0}, {"radar ", 1, rada, C_MOD, NORM + CAP}, {"range ", 1, range, C_MOD, NORM + CAP}, - {"read [yes|no|]", 0, rea, C_MOD, VIS}, + {"read [yes|no|]", 0, rea, C_MOD, 0}, {"realm []", 0, real, C_MOD, NORM}, {"recon ", 3, reco, C_MOD, NORM + MONEY + CAP}, {"reject ", 2, reje, C_MOD, NORM}, - {"relations [as-COUNTRY]", 0, rela, 0, VIS}, + {"relations [as-COUNTRY]", 0, rela, 0, 0}, {"reload", 0, relo, C_MOD, GOD}, {"repay ", 1, repa, C_MOD, NORM + MONEY + CAP}, - {"report ", 0, repo, 0, VIS}, + {"report ", 0, repo, 0, 0}, {"reset <0|price>", 1, rese, C_MOD, NORM + CAP}, {"resource ", 0, reso, 0, NORM}, {"retreat [i|t|s|h|b|d|u|c]", @@ -227,9 +227,9 @@ struct cmndstr player_coms[] = { {"show <\"build\"|\"stats\"|\"cap\"> []\n" "\tshow \n" "\tshow updates []>", - 0, show, 0, VIS}, + 0, show, 0, 0}, {"shutdown ", 0, shut, 0, GOD}, - {"sinfrastructure ", 0, sinfra, 0, VIS}, + {"sinfrastructure ", 0, sinfra, 0, 0}, {"skywatch ", 1, skyw, C_MOD, NORM + CAP}, {"smap [s|l|n|p|*|h]", 0, map, C_MOD, NORM}, {"sonar ", 1, sona, C_MOD, NORM + CAP}, @@ -253,7 +253,7 @@ struct cmndstr player_coms[] = { 1, move, C_MOD, NORM + CAP}, {"threshold ", 1, thre, C_MOD, NORM}, {"toggle [inform|flash|beep|coastwatch|sonar|techlists] [on|off]", - 0, togg, C_MOD, VIS}, + 0, togg, C_MOD, 0}, {"torpedo ", 3, torp, C_MOD, NORM + MONEY + CAP}, {"trade", 1, trad, C_MOD, NORM + CAP + MONEY}, @@ -264,16 +264,16 @@ struct cmndstr player_coms[] = { {"unload ", 1, load, C_MOD, NORM + CAP}, {"unsail ", 1, sail, C_MOD, NORM + CAP}, - {"update", 0, upda, 0, VIS}, + {"update", 0, upda, 0, 0}, {"upgrade ", 1, upgr, C_MOD, NORM + MONEY + CAP}, - {"version", 0, vers, 0, VIS}, + {"version", 0, vers, 0, 0}, {"wall []", 0, wall, C_MOD, NORM}, {"wingadd ", 1, wing, C_MOD, NORM}, {"wipe ", 1, wipe, C_MOD, NORM}, - {"wire [yes|no|]", 0, rea, C_MOD, VIS}, + {"wire [yes|no|]", 0, rea, C_MOD, 0}, {"work ", 1, work, C_MOD, NORM + MONEY + CAP}, - {"xdump [\"meta\"] []", 0, xdump, 0, VIS}, + {"xdump [\"meta\"] []", 0, xdump, 0, 0}, {"zdone ", 0, zdon, C_MOD, NORM}, {NULL, 0, NULL, 0, 0} }; diff --git a/src/lib/player/init_nats.c b/src/lib/player/init_nats.c index 84b8f68d6..5f83c15c8 100644 --- a/src/lib/player/init_nats.c +++ b/src/lib/player/init_nats.c @@ -70,7 +70,7 @@ player_set_nstat(struct player *pl, struct natstr *np) { static int nstat[] = { /* must match nat_status */ - 0, VIS, VIS, SANCT, NORM, GOD | CAP | MONEY + 0, 0, 0, SANCT, NORM, GOD | CAP | MONEY }; if (CANT_HAPPEN(pl->cnum != np->nat_cnum)) -- 2.43.0