TinyMUSH 3.3
TinyMUSH Server
Loading...
Searching...
No Matches
flags.c File Reference

Flag table definitions and utilities for setting/checking object flags. More...

#include "config.h"
#include "constants.h"
#include "typedefs.h"
#include "macros.h"
#include "externs.h"
#include "prototypes.h"
#include <string.h>
#include <ctype.h>
Include dependency graph for flags.c:

Functions

int fh_any (dbref target, dbref player, FLAG flag, int fflags, int reset)
 Set or clear indicated flag bit, no security checking.
 
int fh_god (dbref target, dbref player, FLAG flag, int fflags, int reset)
 Only GOD may set or clear the bit.
 
int fh_wiz (dbref target, dbref player, FLAG flag, int fflags, int reset)
 Only WIZARDS (or GOD) may set or clear the bit.
 
int fh_wizroy (dbref target, dbref player, FLAG flag, int fflags, int reset)
 Only WIZARDS, ROYALTY, (or GOD) may set or clear the bit.
 
int fh_restrict_player (dbref target, dbref player, FLAG flag, int fflags, int reset)
 Only Wizards can set this on players, but ordinary players can set it on other types of objects.
 
int fh_privileged (dbref target, dbref player, FLAG flag, int fflags, int reset)
 You can set this flag on a non-player object, if you yourself have this flag and are a player who owns themselves (i.e., no robots). Only God can set this on a player.
 
int fh_inherit (dbref target, dbref player, FLAG flag, int fflags, int reset)
 Only players may set or clear this bit.
 
int fh_dark_bit (dbref target, dbref player, FLAG flag, int fflags, int reset)
 Manipulate the dark bit. Nonwizards may not set on players.
 
int fh_going_bit (dbref target, dbref player, FLAG flag, int fflags, int reset)
 Manipulate the going bit. Can only be cleared on objects slated for destruction, by non-god. May only be set by god. Even god can't destroy nondestroyable objects.
 
int fh_hear_bit (dbref target, dbref player, FLAG flag, int fflags, int reset)
 Set or clear bits that affect hearing.
 
int fh_player_bit (dbref target, dbref player, FLAG flag, int fflags, int reset)
 Can set and reset this on everything but players.
 
int fh_power_bit (dbref target, dbref player, FLAG flag, int fflags, int reset)
 Check power bit to set/reset.
 
void init_flagtab (void)
 Initialize flag hash tables.
 
void display_flagtab (dbref player)
 Display available flags.
 
FLAGENTfind_flag (dbref thing __attribute__((unused)), char *flagname)
 Search for a flag.
 
void flag_set (dbref target, dbref player, char *flag, int key)
 Set or clear a specified flag on an object.
 
char * decode_flags (dbref player, FLAGSET flagset)
 Converts a flag set into corresponding letters.
 
char * unparse_flags (dbref player, dbref thing)
 Converts a thing's flags into corresponding letters.
 
int has_flag (dbref player, dbref it, char *flagname)
 Does object have flag visible to player?
 
char * flag_description (dbref player, dbref target)
 Return a buffer containing the type and flags on thing.
 
char * unparse_object_numonly (dbref target)
 Return a buffer containing the name and number of an object.
 
char * unparse_object (dbref player, dbref target, int obey_myopic)
 Return a buffer pointing to the object name and possibly the db# and flags.
 
FLAGENTletter_to_flag (char this_letter)
 Given a one-character flag abbrev, return the flag pointer.
 
int cf_flag_access (int *vp __attribute__((unused)), char *str, long extra __attribute__((unused)), dbref player, char *cmd)
 Modify who can set a flag.
 
int cf_flag_name (int *vp __attribute__((unused)), char *str, long extra __attribute__((unused)), dbref player, char *cmd)
 Modify the name of a user-defined flag.
 
int convert_flags (dbref player, char *flaglist, FLAGSET *fset, FLAG *p_type)
 convert a list of flag letters into its bit pattern. Also set the type qualifier if specified and not already set.
 
void decompile_flags (dbref player, dbref thing, char *thingname)
 Produce commands to set flags on target.
 

Variables

FLAGENT gen_flags []
 List of all available flags. All flags names MUST be in uppercase!
 
OBJENT object_types [8]
 

Detailed Description

Flag table definitions and utilities for setting/checking object flags.

Author
TinyMUSH development team (https://github.com/TinyMUSH)
Version
4.0

Function Documentation

◆ cf_flag_access()

int cf_flag_access ( int *vp __attribute__(unused),
char * str,
long extra __attribute__(unused),
dbref player,
char * cmd )

Modify who can set a flag.

Parameters
vp
str
extra
player
cmd
Returns
int

◆ cf_flag_name()

int cf_flag_name ( int *vp __attribute__(unused),
char * str,
long extra __attribute__(unused),
dbref player,
char * cmd )

Modify the name of a user-defined flag.

Parameters
vp
str
extra
player
cmd
Returns
int

Our conditions: The flag name MUST start with an underscore. It must not conflict with the name of any existing flag. There is a KNOWN MEMORY LEAK here – if you name the flag and rename it later, the old bit of memory for the name won't get freed. This should pretty much never happen, since you're not going to run around arbitrarily giving your flags new names all the time.

◆ convert_flags()

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

convert a list of flag letters into its bit pattern. Also set the type qualifier if specified and not already set.

Parameters
player
flaglist
fset
p_type
Returns
int

Check for object type

Check generic flags

return flags to search for and type

◆ decode_flags()

char * decode_flags ( dbref player,
FLAGSET flagset )

Converts a flag set into corresponding letters.

Parameters
player
flagset
Returns
char*

◆ decompile_flags()

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

Produce commands to set flags on target.

Parameters
player
thing
thingname

Skip if we shouldn't decompile this flag

Skip if this flag is not set

Skip if we can't see this flag

We made it this far, report this flag

◆ display_flagtab()

void display_flagtab ( dbref player)

Display available flags.

Parameters
player

◆ fh_any()

int fh_any ( dbref target,
dbref player,
FLAG flag,
int fflags,
int reset )

Set or clear indicated flag bit, no security checking.

Parameters
target
player
flag
fflags
reset
Returns
int

◆ fh_dark_bit()

int fh_dark_bit ( dbref target,
dbref player,
FLAG flag,
int fflags,
int reset )

Manipulate the dark bit. Nonwizards may not set on players.

Parameters
target
player
flag
fflags
reset
Returns
int

◆ fh_god()

int fh_god ( dbref target,
dbref player,
FLAG flag,
int fflags,
int reset )

Only GOD may set or clear the bit.

Parameters
target
player
flag
fflags
reset
Returns
int

◆ fh_going_bit()

int fh_going_bit ( dbref target,
dbref player,
FLAG flag,
int fflags,
int reset )

Manipulate the going bit. Can only be cleared on objects slated for destruction, by non-god. May only be set by god. Even god can't destroy nondestroyable objects.

Parameters
target
player
flag
fflags
reset
Returns
int

◆ fh_hear_bit()

int fh_hear_bit ( dbref target,
dbref player,
FLAG flag,
int fflags,
int reset )

Set or clear bits that affect hearing.

Parameters
target
player
flag
fflags
reset
Returns
int

◆ fh_inherit()

int fh_inherit ( dbref target,
dbref player,
FLAG flag,
int fflags,
int reset )

Only players may set or clear this bit.

Parameters
target
player
flag
fflags
reset
Returns
int

◆ fh_player_bit()

int fh_player_bit ( dbref target,
dbref player,
FLAG flag,
int fflags,
int reset )

Can set and reset this on everything but players.

Parameters
target
player
flag
fflags
reset
Returns
int

◆ fh_power_bit()

int fh_power_bit ( dbref target,
dbref player,
FLAG flag,
int fflags,
int reset )

Check power bit to set/reset.

Parameters
target
player
flag
fflags
reset
Returns
int

◆ fh_privileged()

int fh_privileged ( dbref target,
dbref player,
FLAG flag,
int fflags,
int reset )

You can set this flag on a non-player object, if you yourself have this flag and are a player who owns themselves (i.e., no robots). Only God can set this on a player.

Parameters
target
player
flag
fflags
reset
Returns
int

◆ fh_restrict_player()

int fh_restrict_player ( dbref target,
dbref player,
FLAG flag,
int fflags,
int reset )

Only Wizards can set this on players, but ordinary players can set it on other types of objects.

Parameters
target
player
flag
fflags
reset
Returns
int

◆ fh_wiz()

int fh_wiz ( dbref target,
dbref player,
FLAG flag,
int fflags,
int reset )

Only WIZARDS (or GOD) may set or clear the bit.

Parameters
target
player
flag
fflags
reset
Returns
int

◆ fh_wizroy()

int fh_wizroy ( dbref target,
dbref player,
FLAG flag,
int fflags,
int reset )

Only WIZARDS, ROYALTY, (or GOD) may set or clear the bit.

Parameters
target
player
flag
fflags
reset
Returns
int

◆ find_flag()

FLAGENT * find_flag ( dbref thing __attribute__(unused),
char * flagname )

Search for a flag.

Parameters
thing
flagname
Returns
FLAGENT*

◆ flag_description()

char * flag_description ( dbref player,
dbref target )

Return a buffer containing the type and flags on thing.

Parameters
player
target
Returns
char*

Store the header strings and object type

Don't show CONNECT on dark wizards to mortals

◆ flag_set()

void flag_set ( dbref target,
dbref player,
char * flag,
int key )

Set or clear a specified flag on an object.

Parameters
target
player
flag
key

Trim spaces, and handle the negation character

Make sure a flag name was specified

Invoke the flag handler, and print feedback

◆ has_flag()

int has_flag ( dbref player,
dbref it,
char * flagname )

Does object have flag visible to player?

Parameters
player
it
flagname
Returns
int

◆ letter_to_flag()

FLAGENT * letter_to_flag ( char this_letter)

Given a one-character flag abbrev, return the flag pointer.

Parameters
this_letter
Returns
FLAGENT*

◆ unparse_flags()

char * unparse_flags ( dbref player,
dbref thing )

Converts a thing's flags into corresponding letters.

Parameters
player
thing
Returns
char*

Don't show CONNECT on dark wizards to mortals

Check if this is a marker flag and we're at the beginning of a buffer. If so, we need to insert a separator character first so we don't end up running the dbref number into the flags.

◆ unparse_object()

char * unparse_object ( dbref player,
dbref target,
int obey_myopic )

Return a buffer pointing to the object name and possibly the db# and flags.

Parameters
player
target
obey_myopic
Returns
char*

◆ unparse_object_numonly()

char * unparse_object_numonly ( dbref target)

Return a buffer containing the name and number of an object.

Parameters
target
Returns
char*

Variable Documentation

◆ object_types

OBJENT object_types[8]
Initial value:
= {
{"EXIT", 'E', CA_PUBLIC, OF_SIBLINGS},
{"TYPE5", '+', CA_GOD, 0},
{"GARBAGE", '#', CA_GOD, 0}}
#define OF_DROPTO
Definition constants.h:996
#define OF_CONTENTS
Definition constants.h:992
#define OF_LOCATION
Definition constants.h:993
#define OF_HOME
Definition constants.h:995
#define OF_EXITS
Definition constants.h:994
#define OF_OWNER
Definition constants.h:997
#define OF_SIBLINGS
Definition constants.h:998
#define CA_PUBLIC
Command permission flags.
Definition constants.h:379
#define CA_GOD
Definition constants.h:380

Object types flags