mux/src/flags.cpp File Reference

#include "copyright.h"
#include "autoconf.h"
#include "config.h"
#include "externs.h"
#include "command.h"
#include "powers.h"

Include dependency graph for flags.cpp:

Go to the source code of this file.

Functions

static bool fh_any (dbref target, dbref player, FLAG flag, int fflags, bool reset)
static bool fh_god (dbref target, dbref player, FLAG flag, int fflags, bool reset)
static bool fh_wiz (dbref target, dbref player, FLAG flag, int fflags, bool reset)
static bool fh_wizroy (dbref target, dbref player, FLAG flag, int fflags, bool reset)
static bool fh_restrict_player (dbref target, dbref player, FLAG flag, int fflags, bool reset)
static bool fh_privileged (dbref target, dbref player, FLAG flag, int fflags, bool reset)
static bool fh_inherit (dbref target, dbref player, FLAG flag, int fflags, bool reset)
static bool fh_dark_bit (dbref target, dbref player, FLAG flag, int fflags, bool reset)
static bool fh_going_bit (dbref target, dbref player, FLAG flag, int fflags, bool reset)
static bool fh_hear_bit (dbref target, dbref player, FLAG flag, int fflags, bool reset)
static bool fh_player_bit (dbref target, dbref player, FLAG flag, int fflags, bool reset)
static bool fh_staff (dbref target, dbref player, FLAG flag, int fflags, bool reset)
void init_flagtab (void)
void display_flagtab (dbref player)
char * MakeCanonicalFlagName (const char *pName, int *pnName, bool *pbValid)
static FLAGNAMEENTfind_flag (char *flagname)
void flag_set (dbref target, dbref player, char *flag, int key)
char * decode_flags (dbref player, FLAGSET *fs)
bool has_flag (dbref player, dbref it, char *flagname)
char * flag_description (dbref player, dbref target)
char * unparse_object_numonly (dbref target)
char * unparse_object (dbref player, dbref target, bool obey_myopic)
 CF_HAND (cf_flag_access)
bool convert_flags (dbref player, char *flaglist, FLAGSET *fset, FLAG *p_type)
void decompile_flags (dbref player, dbref thing, char *thingname)
static bool flag_rename (char *alias, char *newname)
void do_flag (dbref executor, dbref caller, dbref enactor, int key, int nargs, char *flag1, char *flag2)
 CF_HAND (cf_flag_name)

Variables

static FLAGBITENT fbeAbode = { ABODE, 'A', FLAG_WORD2, 0, fh_any}
static FLAGBITENT fbeAnsi = { ANSI, 'X', FLAG_WORD2, 0, fh_any}
static FLAGBITENT fbeAudible = { HEARTHRU, 'a', FLAG_WORD1, 0, fh_hear_bit}
static FLAGBITENT fbeAuditorium = { AUDITORIUM, 'b', FLAG_WORD2, 0, fh_any}
static FLAGBITENT fbeBlind = { BLIND, 'B', FLAG_WORD2, 0, fh_wiz}
static FLAGBITENT fbeChownOk = { CHOWN_OK, 'C', FLAG_WORD1, 0, fh_any}
static FLAGBITENT fbeConnected = { CONNECTED, 'c', FLAG_WORD2, CA_NO_DECOMP, fh_god}
static FLAGBITENT fbeDark = { DARK, 'D', FLAG_WORD1, 0, fh_dark_bit}
static FLAGBITENT fbeDestroyOk = { DESTROY_OK, 'd', FLAG_WORD1, 0, fh_any}
static FLAGBITENT fbeEnterOk = { ENTER_OK, 'e', FLAG_WORD1, 0, fh_any}
static FLAGBITENT fbeFixed = { FIXED, 'f', FLAG_WORD2, 0, fh_restrict_player}
static FLAGBITENT fbeFloating = { FLOATING, 'F', FLAG_WORD2, 0, fh_any}
static FLAGBITENT fbeGagged = { GAGGED, 'j', FLAG_WORD2, 0, fh_wiz}
static FLAGBITENT fbeGoing = { GOING, 'G', FLAG_WORD1, CA_NO_DECOMP, fh_going_bit}
static FLAGBITENT fbeHalted = { HALT, 'h', FLAG_WORD1, 0, fh_any}
static FLAGBITENT fbeHasDaily = { HAS_DAILY, '*', FLAG_WORD2, CA_GOD|CA_NO_DECOMP, fh_god}
static FLAGBITENT fbeHasForwardList = { HAS_FWDLIST, '&', FLAG_WORD2, CA_GOD|CA_NO_DECOMP, fh_god}
static FLAGBITENT fbeHasListen = { HAS_LISTEN, '@', FLAG_WORD2, CA_GOD|CA_NO_DECOMP, fh_god}
static FLAGBITENT fbeHasStartup = { HAS_STARTUP, '+', FLAG_WORD1, CA_GOD|CA_NO_DECOMP, fh_god}
static FLAGBITENT fbeHaven = { HAVEN, 'H', FLAG_WORD1, 0, fh_any}
static FLAGBITENT fbeHead = { HEAD_FLAG, '?', FLAG_WORD2, 0, fh_wiz}
static FLAGBITENT fbeHtml = { HTML, '(', FLAG_WORD2, 0, fh_any}
static FLAGBITENT fbeImmortal = { IMMORTAL, 'i', FLAG_WORD1, 0, fh_wiz}
static FLAGBITENT fbeInherit = { INHERIT, 'I', FLAG_WORD1, 0, fh_inherit}
static FLAGBITENT fbeJumpOk = { JUMP_OK, 'J', FLAG_WORD1, 0, fh_any}
static FLAGBITENT fbeKeepAlive = { CKEEPALIVE, 'k', FLAG_WORD2, 0, fh_any}
static FLAGBITENT fbeKey = { KEY, 'K', FLAG_WORD2, 0, fh_any}
static FLAGBITENT fbeLight = { LIGHT, 'l', FLAG_WORD2, 0, fh_any}
static FLAGBITENT fbeLinkOk = { LINK_OK, 'L', FLAG_WORD1, 0, fh_any}
static FLAGBITENT fbeMonitor = { MONITOR, 'M', FLAG_WORD1, 0, fh_hear_bit}
static FLAGBITENT fbeMyopic = { MYOPIC, 'm', FLAG_WORD1, 0, fh_any}
static FLAGBITENT fbeNoCommand = { NO_COMMAND, 'n', FLAG_WORD2, 0, fh_any}
static FLAGBITENT fbeNoAccents = { NOACCENTS, '~', FLAG_WORD2, 0, fh_any}
static FLAGBITENT fbeNoBleed = { NOBLEED, '-', FLAG_WORD2, 0, fh_any}
static FLAGBITENT fbeNoSpoof = { NOSPOOF, 'N', FLAG_WORD1, 0, fh_any}
static FLAGBITENT fbeOpaque = { TM_OPAQUE, 'O', FLAG_WORD1, 0, fh_any}
static FLAGBITENT fbeOpenOk = { OPEN_OK, 'z', FLAG_WORD2, 0, fh_wiz}
static FLAGBITENT fbeParentOk = { PARENT_OK, 'Y', FLAG_WORD2, 0, fh_any}
static FLAGBITENT fbePlayerMails = { PLAYER_MAILS, ' ', FLAG_WORD2, CA_GOD|CA_NO_DECOMP, fh_god}
static FLAGBITENT fbePuppet = { PUPPET, 'p', FLAG_WORD1, 0, fh_hear_bit}
static FLAGBITENT fbeQuiet = { QUIET, 'Q', FLAG_WORD1, 0, fh_any}
static FLAGBITENT fbeRobot = { ROBOT, 'r', FLAG_WORD1, 0, fh_player_bit}
static FLAGBITENT fbeRoyalty = { ROYALTY, 'Z', FLAG_WORD1, 0, fh_wiz}
static FLAGBITENT fbeSafe = { SAFE, 's', FLAG_WORD1, 0, fh_any}
static FLAGBITENT fbeSlave = { SLAVE, 'x', FLAG_WORD2, CA_WIZARD, fh_wiz}
static FLAGBITENT fbeStaff = { STAFF, 'w', FLAG_WORD2, 0, fh_wiz}
static FLAGBITENT fbeSticky = { STICKY, 'S', FLAG_WORD1, 0, fh_any}
static FLAGBITENT fbeSuspect = { SUSPECT, 'u', FLAG_WORD2, CA_WIZARD, fh_wiz}
static FLAGBITENT fbeTerse = { TERSE, 'q', FLAG_WORD1, 0, fh_any}
static FLAGBITENT fbeTrace = { TRACE, 'T', FLAG_WORD1, 0, fh_any}
static FLAGBITENT fbeTransparent = { SEETHRU, 't', FLAG_WORD1, 0, fh_any}
static FLAGBITENT fbeUnfindable = { UNFINDABLE, 'U', FLAG_WORD2, 0, fh_any}
static FLAGBITENT fbeUninspected = { UNINSPECTED, 'g', FLAG_WORD2, 0, fh_wizroy}
static FLAGBITENT fbeVacation = { VACATION, '|', FLAG_WORD2, 0, fh_restrict_player}
static FLAGBITENT fbeVerbose = { VERBOSE, 'v', FLAG_WORD1, 0, fh_any}
static FLAGBITENT fbeVisual = { VISUAL, 'V', FLAG_WORD1, 0, fh_any}
static FLAGBITENT fbeWizard = { WIZARD, 'W', FLAG_WORD1, 0, fh_god}
static FLAGBITENT fbeSitemon = { SITEMON, '$', FLAG_WORD3, 0, fh_wiz}
static FLAGBITENT fbeMarker0 = { MARK_0, '0', FLAG_WORD3, 0, fh_god}
static FLAGBITENT fbeMarker1 = { MARK_1, '1', FLAG_WORD3, 0, fh_god}
static FLAGBITENT fbeMarker2 = { MARK_2, '2', FLAG_WORD3, 0, fh_god}
static FLAGBITENT fbeMarker3 = { MARK_3, '3', FLAG_WORD3, 0, fh_god}
static FLAGBITENT fbeMarker4 = { MARK_4, '4', FLAG_WORD3, 0, fh_god}
static FLAGBITENT fbeMarker5 = { MARK_5, '5', FLAG_WORD3, 0, fh_god}
static FLAGBITENT fbeMarker6 = { MARK_6, '6', FLAG_WORD3, 0, fh_god}
static FLAGBITENT fbeMarker7 = { MARK_7, '7', FLAG_WORD3, 0, fh_god}
static FLAGBITENT fbeMarker8 = { MARK_8, '8', FLAG_WORD3, 0, fh_god}
static FLAGBITENT fbeMarker9 = { MARK_9, '9', FLAG_WORD3, 0, fh_god}
FLAGNAMEENT gen_flag_names []
OBJENT object_types [8]


Function Documentation

CF_HAND ( cf_flag_name   ) 

Definition at line 1259 of file flags.cpp.

References flag_rename(), mux_strtok_ctl(), mux_strtok_parse(), mux_strtok_src(), and UNUSED_PARAMETER.

01260 {
01261     UNUSED_PARAMETER(vp);
01262     UNUSED_PARAMETER(pExtra);
01263     UNUSED_PARAMETER(nExtra);
01264     UNUSED_PARAMETER(player);
01265     UNUSED_PARAMETER(cmd);
01266 
01267     MUX_STRTOK_STATE tts;
01268     mux_strtok_src(&tts, str);
01269     mux_strtok_ctl(&tts, " \t=,");
01270     char *flagstr = mux_strtok_parse(&tts);
01271     char *namestr = mux_strtok_parse(&tts);
01272 
01273     if (  !flagstr
01274        || !*flagstr
01275        || !namestr
01276        || !*namestr)
01277     {
01278         return -1;
01279     }
01280 
01281     if (flag_rename(flagstr, namestr))
01282     {
01283         return 0;
01284     }
01285     else
01286     {
01287         return -1;
01288     }
01289 }

CF_HAND ( cf_flag_access   ) 

Definition at line 943 of file flags.cpp.

References cf_log_notfound(), ENDLOG, flag_name_entry::fbe, fh_any(), fh_god(), fh_privileged(), fh_restrict_player(), fh_staff(), fh_wiz(), fh_wizroy(), find_flag(), flag_name_entry::flagname, flag_bit_entry::handler, LOG_CONFIGMODS, log_text(), mux_strtok_ctl(), mux_strtok_parse(), mux_strtok_src(), STARTLOG, and UNUSED_PARAMETER.

00944 {
00945     UNUSED_PARAMETER(vp);
00946     UNUSED_PARAMETER(pExtra);
00947     UNUSED_PARAMETER(nExtra);
00948 
00949     MUX_STRTOK_STATE tts;
00950     mux_strtok_src(&tts, str);
00951     mux_strtok_ctl(&tts, " \t=,");
00952     char *fstr = mux_strtok_parse(&tts);
00953     char *permstr = mux_strtok_parse(&tts);
00954 
00955     if (!fstr || !*fstr)
00956     {
00957         return -1;
00958     }
00959 
00960     FLAGNAMEENT *fp;
00961     if ((fp = find_flag(fstr)) == NULL)
00962     {
00963         cf_log_notfound(player, cmd, "No such flag", fstr);
00964         return -1;
00965     }
00966     FLAGBITENT *fbe = fp->fbe;
00967 
00968     // Don't change the handlers on special things.
00969     //
00970     if (  (fbe->handler != fh_any)
00971        && (fbe->handler != fh_wizroy)
00972        && (fbe->handler != fh_wiz)
00973        && (fbe->handler != fh_god)
00974        && (fbe->handler != fh_restrict_player)
00975        && (fbe->handler != fh_privileged))
00976     {
00977         STARTLOG(LOG_CONFIGMODS, "CFG", "PERM");
00978         log_text("Cannot change access for flag: ");
00979         log_text(fp->flagname);
00980         ENDLOG;
00981         return -1;
00982     }
00983 
00984     if (!strcmp(permstr, "any"))
00985     {
00986         fbe->handler = fh_any;
00987     }
00988     else if (!strcmp(permstr, "royalty"))
00989     {
00990         fbe->handler = fh_wizroy;
00991     }
00992     else if (!strcmp(permstr, "wizard"))
00993     {
00994         fbe->handler = fh_wiz;
00995     }
00996     else if (!strcmp(permstr, "god"))
00997     {
00998         fbe->handler = fh_god;
00999     }
01000     else if (!strcmp(permstr, "restrict_player"))
01001     {
01002         fbe->handler = fh_restrict_player;
01003     }
01004     else if (!strcmp(permstr, "privileged"))
01005     {
01006         fbe->handler = fh_privileged;
01007     }
01008     else if (!strcmp(permstr, "staff"))
01009     {
01010         fbe->handler = fh_staff;
01011     }
01012     else
01013     {
01014         cf_log_notfound(player, cmd, "Flag access", permstr);
01015         return -1;
01016     }
01017     return 0;
01018 }

bool convert_flags ( dbref  player,
char *  flaglist,
FLAGSET fset,
FLAG p_type 
)

Definition at line 1026 of file flags.cpp.

References flag_name_entry::bPositive, CA_ADMIN, CA_GOD, CA_STAFF, CA_WIZARD, flag_name_entry::fbe, FLAG_WORD1, FLAG_WORD2, FLAG_WORD3, flag_name_entry::flagname, gen_flag_names, God, notify, NOTYPE, object_types, Staff, tprintf(), Wizard, WizRoy, and flagset::word.

Referenced by handle_flaglists(), and search_setup().

01027 {
01028     FLAG type = NOTYPE;
01029     FLAGSET flagmask;
01030     flagmask.word[FLAG_WORD1] = 0;
01031     flagmask.word[FLAG_WORD2] = 0;
01032     flagmask.word[FLAG_WORD3] = 0;
01033     int i;
01034 
01035     char *s;
01036     bool handled;
01037     for (s = flaglist; *s; s++)
01038     {
01039         handled = false;
01040 
01041         // Check for object type.
01042         //
01043         for (i = 0; i <= 7 && !handled; i++)
01044         {
01045             if (  object_types[i].lett == *s
01046                && !(  (  (object_types[i].perm & CA_STAFF)
01047                       && !Staff(player))
01048                    || (  (object_types[i].perm & CA_ADMIN)
01049                       && !WizRoy(player))
01050                    || (  (object_types[i].perm & CA_WIZARD)
01051                       && !Wizard(player))
01052                    || (  (object_types[i].perm & CA_GOD)
01053                       && !God(player))))
01054             {
01055                 if (  type != NOTYPE
01056                    && type != i)
01057                 {
01058                     char *p = tprintf("%c: Conflicting type specifications.",
01059                         *s);
01060                     notify(player, p);
01061                     return false;
01062                 }
01063                 type = i;
01064                 handled = true;
01065             }
01066         }
01067 
01068         // Check generic flags.
01069         //
01070         if (handled)
01071         {
01072             continue;
01073         }
01074         FLAGNAMEENT *fp;
01075         for (fp = gen_flag_names; fp->flagname && !handled; fp++)
01076         {
01077             FLAGBITENT *fbe = fp->fbe;
01078             if (  !fp->bPositive
01079                || fbe->flaglett == ' ')
01080             {
01081                 continue;
01082             }
01083             if (  fbe->flaglett == *s
01084                && !(  (  (fbe->listperm & CA_STAFF)
01085                       && !Staff(player))
01086                    || (  (fbe->listperm & CA_ADMIN)
01087                       && !WizRoy(player))
01088                    || (  (fbe->listperm & CA_WIZARD)
01089                       && !Wizard(player))
01090                    || (  (fbe->listperm & CA_GOD)
01091                       && !God(player))))
01092             {
01093                 flagmask.word[fbe->flagflag] |= fbe->flagvalue;
01094                 handled = true;
01095             }
01096         }
01097 
01098         if (!handled)
01099         {
01100             notify(player,
01101                    tprintf("%c: Flag unknown or not valid for specified object type",
01102                        *s));
01103             return false;
01104         }
01105     }
01106 
01107     // Return flags to search for and type.
01108     //
01109     *fset = flagmask;
01110     *p_type = type;
01111     return true;
01112 }

char* decode_flags ( dbref  player,
FLAGSET fs 
)

Definition at line 661 of file flags.cpp.

References alloc_sbuf, flag_name_entry::bPositive, CA_ADMIN, CA_GOD, CA_STAFF, CA_WIZARD, CONNECTED, DARK, flag_name_entry::fbe, FLAG_WORD1, FLAG_WORD2, flag_name_entry::flagname, gen_flag_names, God, Good_obj, mux_isdigit, object_types, safe_sb_chr, See_Hidden, Staff, TYPE_MASK, TYPE_PLAYER, Wizard, WIZARD, WizRoy, and flagset::word.

Referenced by FUNCTION(), list_df_flags(), shutdownsock(), and unparse_object().

00662 {
00663     char *buf, *bp;
00664     buf = bp = alloc_sbuf("decode_flags");
00665     *bp = '\0';
00666 
00667     if (!Good_obj(player))
00668     {
00669         strcpy(buf, "#-2 ERROR");
00670         return buf;
00671     }
00672     int flagtype = fs->word[FLAG_WORD1] & TYPE_MASK;
00673     bool bNeedColon = true;
00674     if (object_types[flagtype].lett != ' ')
00675     {
00676         safe_sb_chr(object_types[flagtype].lett, buf, &bp);
00677         bNeedColon = false;
00678     }
00679 
00680     FLAGNAMEENT *fp;
00681     for (fp = gen_flag_names; fp->flagname; fp++)
00682     {
00683         FLAGBITENT *fbe = fp->fbe;
00684         if (  !fp->bPositive
00685            || fbe->flaglett == ' ')
00686         {
00687             // Only look at positive-sense entries that have non-space flag
00688             // letters.
00689             //
00690             continue;
00691         }
00692         if (fs->word[fbe->flagflag] & fbe->flagvalue)
00693         {
00694             if (  (  (fbe->listperm & CA_STAFF)
00695                   && !Staff(player))
00696                || (  (fbe->listperm & CA_ADMIN)
00697                   && !WizRoy(player))
00698                || (  (fbe->listperm & CA_WIZARD)
00699                   && !Wizard(player))
00700                || (  (fbe->listperm & CA_GOD)
00701                   && !God(player)))
00702             {
00703                 continue;
00704             }
00705 
00706             // Don't show CONNECT on dark wizards to mortals
00707             //
00708             if (  flagtype == TYPE_PLAYER
00709                && fbe->flagflag == FLAG_WORD2
00710                && fbe->flagvalue == CONNECTED
00711                && (fs->word[FLAG_WORD1] & (WIZARD | DARK)) == (WIZARD | DARK)
00712                && !See_Hidden(player))
00713             {
00714                 continue;
00715             }
00716 
00717             if (  bNeedColon
00718                && mux_isdigit(fbe->flaglett))
00719             {
00720                 // We can't allow numerical digits at the beginning.
00721                 //
00722                 safe_sb_chr(':', buf, &bp);
00723             }
00724             safe_sb_chr(fbe->flaglett, buf, &bp);
00725             bNeedColon = false;
00726         }
00727     }
00728     *bp = '\0';
00729     return buf;
00730 }

void decompile_flags ( dbref  player,
dbref  thing,
char *  thingname 
)

Definition at line 1119 of file flags.cpp.

References flag_name_entry::bPositive, CA_NO_DECOMP, check_access(), db, flag_name_entry::fbe, flag_name_entry::flagname, object::fs, gen_flag_names, notify, strip_ansi(), tprintf(), and flagset::word.

01120 {
01121     // Report generic flags.
01122     //
01123     FLAGNAMEENT *fp;
01124     for (fp = gen_flag_names; fp->flagname; fp++)
01125     {
01126         FLAGBITENT *fbe = fp->fbe;
01127 
01128         // Only handle positive-sense entries.
01129         // Skip if we shouldn't decompile this flag.
01130         // Skip if this flag isn't set.
01131         // Skip if we can't see this flag.
01132         //
01133         if (  !fp->bPositive
01134            || (fbe->listperm & CA_NO_DECOMP)
01135            || (db[thing].fs.word[fbe->flagflag] & fbe->flagvalue) == 0
01136            || !check_access(player, fbe->listperm))
01137         {
01138             continue;
01139         }
01140 
01141         // Report this flag.
01142         //
01143         notify(player, tprintf("@set %s=%s", strip_ansi(thingname),
01144             fp->flagname));
01145     }
01146 }

void display_flagtab ( dbref  player  ) 

Definition at line 483 of file flags.cpp.

References alloc_lbuf, flag_name_entry::bPositive, CA_GOD, CA_WIZARD, flag_name_entry::fbe, flag_name_entry::flagname, free_lbuf, gen_flag_names, God, notify, safe_chr, safe_str, and Wizard.

Referenced by do_list().

00484 {
00485     char *buf, *bp;
00486     FLAGNAMEENT *fp;
00487 
00488     bp = buf = alloc_lbuf("display_flagtab");
00489     safe_str("Flags:", buf, &bp);
00490     for (fp = gen_flag_names; fp->flagname; fp++)
00491     {
00492         FLAGBITENT *fbe = fp->fbe;
00493         if (  (  (fbe->listperm & CA_WIZARD)
00494               && !Wizard(player))
00495            || (  (fbe->listperm & CA_GOD)
00496               && !God(player)))
00497         {
00498             continue;
00499         }
00500         safe_chr(' ', buf, &bp);
00501         safe_str(fp->flagname, buf, &bp);
00502         if (fbe->flaglett != ' ')
00503         {
00504             safe_chr('(', buf, &bp);
00505             if (!fp->bPositive)
00506             {
00507                 safe_chr('!', buf, &bp);
00508             }
00509             safe_chr(fbe->flaglett, buf, &bp);
00510             safe_chr(')', buf, &bp);
00511         }
00512     }
00513     *bp = '\0';
00514     notify(player, buf);
00515     free_lbuf(buf);
00516 }

void do_flag ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
int  nargs,
char *  flag1,
char *  flag2 
)

Definition at line 1201 of file flags.cpp.

References FLAG_REMOVE, flag_rename(), flag_name_entry::flagname, statedata::flags_htab, hashdeleteLEN(), hashfindLEN(), MakeCanonicalFlagName(), MEMFREE, mudstate, mux_stricmp(), notify, flag_name_entry::pOrigName, tprintf(), and UNUSED_PARAMETER.

01203 {
01204     UNUSED_PARAMETER(caller);
01205     UNUSED_PARAMETER(enactor);
01206 
01207     if (key & FLAG_REMOVE)
01208     {
01209         if (nargs == 2)
01210         {
01211             notify(executor, "Extra argument ignored.");
01212         }
01213         int nAlias;
01214         bool bValidAlias;
01215         char *pCheckedAlias = MakeCanonicalFlagName(flag1, &nAlias, &bValidAlias);
01216         if (bValidAlias)
01217         {
01218             FLAGNAMEENT *lookup;
01219             lookup = (FLAGNAMEENT *)hashfindLEN(pCheckedAlias, nAlias, &mudstate.flags_htab);
01220             if (lookup)
01221             {
01222                 if (  lookup->flagname != lookup->pOrigName
01223                    && mux_stricmp(lookup->flagname, pCheckedAlias) == 0)
01224                 {
01225                     MEMFREE(lookup->flagname);
01226                     lookup->flagname = lookup->pOrigName;
01227                     hashdeleteLEN(pCheckedAlias, nAlias, &mudstate.flags_htab);
01228                     notify(executor, tprintf("Flag name '%s' removed from the hash table.", pCheckedAlias));
01229                 }
01230                 else
01231                 {
01232                     notify(executor, "Error: You can't remove the present flag name from the hash table.");
01233                 }
01234             }
01235         }
01236     }
01237     else
01238     {
01239         if (nargs < 2)
01240         {
01241             notify(executor, "You must specify a flag and a name.");
01242             return;
01243         }
01244         if (flag_rename(flag1, flag2))
01245         {
01246             notify(executor, "Flag name changed.");
01247         }
01248         else
01249         {
01250             notify(executor, "Error: Bad flagname given or flag not found.");
01251         }
01252     }
01253 }

static bool fh_any ( dbref  target,
dbref  player,
FLAG  flag,
int  fflags,
bool  reset 
) [static]

Definition at line 18 of file flags.cpp.

References db, FLAG_WORD1, object::fs, God, notify, WIZARD, and flagset::word.

Referenced by CF_HAND(), fh_dark_bit(), fh_god(), fh_going_bit(), fh_hear_bit(), fh_inherit(), fh_player_bit(), fh_privileged(), fh_restrict_player(), fh_staff(), fh_wiz(), and fh_wizroy().

00019 {
00020     // Never let God drop his/her own wizbit.
00021     //
00022     if (  God(target)
00023        && reset
00024        && flag == WIZARD
00025        && fflags == FLAG_WORD1)
00026     {
00027         notify(player, "You cannot make God mortal.");
00028         return false;
00029     }
00030 
00031     // Otherwise we can go do it.
00032     //
00033     if (reset)
00034     {
00035         db[target].fs.word[fflags] &= ~flag;
00036     }
00037     else
00038     {
00039         db[target].fs.word[fflags] |= flag;
00040     }
00041     return true;
00042 }

static bool fh_dark_bit ( dbref  target,
dbref  player,
FLAG  flag,
int  fflags,
bool  reset 
) [static]

Definition at line 154 of file flags.cpp.

References Can_Hide, fh_any(), isPlayer, and Wizard.

00155 {
00156     if (  !reset
00157        && isPlayer(target)
00158        && !(  (target == player)
00159            && Can_Hide(player))
00160        && !Wizard(player))
00161     {
00162         return false;
00163     }
00164     return (fh_any(target, player, flag, fflags, reset));
00165 }

static bool fh_god ( dbref  target,
dbref  player,
FLAG  flag,
int  fflags,
bool  reset 
) [static]

Definition at line 48 of file flags.cpp.

References fh_any(), and God.

Referenced by CF_HAND().

00049 {
00050     if (!God(player))
00051     {
00052         return false;
00053     }
00054     return (fh_any(target, player, flag, fflags, reset));
00055 }

static bool fh_going_bit ( dbref  target,
dbref  player,
FLAG  flag,
int  fflags,
bool  reset 
) [static]

Definition at line 172 of file flags.cpp.

References confdata::default_home, fh_any(), God, Going, confdata::master_room, mudconf, notify, confdata::start_home, confdata::start_room, TYPE_GARBAGE, and Typeof.

00173 {
00174     if (  Going(target)
00175        && reset
00176        && (Typeof(target) != TYPE_GARBAGE))
00177     {
00178         notify(player, "Your object has been spared from destruction.");
00179         return (fh_any(target, player, flag, fflags, reset));
00180     }
00181     if (!God(player))
00182     {
00183         return false;
00184     }
00185 
00186     // Even God should not be allowed set protected dbrefs GOING.
00187     //
00188     if (  !reset
00189        && (  target == 0
00190           || God(target)
00191           || target == mudconf.start_home
00192           || target == mudconf.start_room
00193           || target == mudconf.default_home
00194           || target == mudconf.master_room))
00195     {
00196         return false;
00197     }
00198     return (fh_any(target, player, flag, fflags, reset));
00199 }

static bool fh_hear_bit ( dbref  target,
dbref  player,
FLAG  flag,
int  fflags,
bool  reset 
) [static]

Definition at line 206 of file flags.cpp.

References Can_Monitor, fh_any(), handle_ears(), Hearer(), isPlayer, and MONITOR.

00207 {
00208     if (isPlayer(target) && (flag & MONITOR))
00209     {
00210         if (Can_Monitor(player))
00211         {
00212             return (fh_any(target, player, flag, fflags, reset));
00213         }
00214         else
00215         {
00216             return false;
00217         }
00218     }
00219 
00220     bool could_hear = Hearer(target);
00221     bool result = fh_any(target, player, flag, fflags, reset);
00222     handle_ears(target, could_hear, Hearer(target));
00223     return result;
00224 }

static bool fh_inherit ( dbref  target,
dbref  player,
FLAG  flag,
int  fflags,
bool  reset 
) [static]

Definition at line 140 of file flags.cpp.

References fh_any(), and Inherits.

00141 {
00142     if (!Inherits(player))
00143     {
00144         return false;
00145     }
00146     return (fh_any(target, player, flag, fflags, reset));
00147 }

static bool fh_player_bit ( dbref  target,
dbref  player,
FLAG  flag,
int  fflags,
bool  reset 
) [static]

Definition at line 231 of file flags.cpp.

References fh_any(), and isPlayer.

00238 {
00239     if (isPlayer(target))
00240     {
00241         return false;
00242     }
00243     return (fh_any(target, player, flag, fflags, reset));
00244 }

static bool fh_privileged ( dbref  target,
dbref  player,
FLAG  flag,
int  fflags,
bool  reset 
) [static]

Definition at line 114 of file flags.cpp.

References db, fh_any(), God, isPlayer, and Owner.

Referenced by CF_HAND().

00121 {
00122     if (!God(player))
00123     {
00124         if (  !isPlayer(player)
00125            || player != Owner(player)
00126            || isPlayer(target)
00127            || (db[player].fs.word[fflags] & flag) == 0)
00128         {
00129             return false;
00130         }
00131     }
00132     return (fh_any(target, player, flag, fflags, reset));
00133 }

static bool fh_restrict_player ( dbref  target,
dbref  player,
FLAG  flag,
int  fflags,
bool  reset 
) [static]

Definition at line 92 of file flags.cpp.

References fh_any(), isPlayer, and Wizard.

Referenced by CF_HAND().

00099 {
00100     if (  isPlayer(target)
00101        && !Wizard(player))
00102     {
00103         return false;
00104     }
00105     return (fh_any(target, player, flag, fflags, reset));
00106 }

static bool fh_staff ( dbref  target,
dbref  player,
FLAG  flag,
int  fflags,
bool  reset 
) [static]

Definition at line 251 of file flags.cpp.

References fh_any(), God, and Staff.

Referenced by CF_HAND().

00258 {
00259     if (!Staff(player) && !God(player))
00260     {
00261         return false;
00262     }
00263     return (fh_any(target, player, flag, fflags, reset));
00264 }