TinyMUSH 3.3
TinyMUSH Server
|
Flag manipulation routines. 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>
Functions | |
int | fh_any (dbref target, dbref player, FLAG flag, int fflags, int reset) |
Set or clear indicated flag bit, no security checking. More... | |
int | fh_god (dbref target, dbref player, FLAG flag, int fflags, int reset) |
Only GOD may set or clear the bit. More... | |
int | fh_wiz (dbref target, dbref player, FLAG flag, int fflags, int reset) |
Only WIZARDS (or GOD) may set or clear the bit. More... | |
int | fh_wizroy (dbref target, dbref player, FLAG flag, int fflags, int reset) |
Only WIZARDS, ROYALTY, (or GOD) may set or clear the bit. More... | |
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. More... | |
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. More... | |
int | fh_inherit (dbref target, dbref player, FLAG flag, int fflags, int reset) |
Only players may set or clear this bit. More... | |
int | fh_dark_bit (dbref target, dbref player, FLAG flag, int fflags, int reset) |
Manipulate the dark bit. Nonwizards may not set on players. More... | |
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. More... | |
int | fh_hear_bit (dbref target, dbref player, FLAG flag, int fflags, int reset) |
Set or clear bits that affect hearing. More... | |
int | fh_player_bit (dbref target, dbref player, FLAG flag, int fflags, int reset) |
Can set and reset this on everything but players. More... | |
int | fh_power_bit (dbref target, dbref player, FLAG flag, int fflags, int reset) |
Check power bit to set/reset. More... | |
void | init_flagtab (void) |
Initialize flag hash tables. More... | |
void | display_flagtab (dbref player) |
Display available flags. More... | |
FLAGENT * | find_flag (dbref thing __attribute__((unused)), char *flagname) |
Search for a flag. More... | |
void | flag_set (dbref target, dbref player, char *flag, int key) |
Set or clear a specified flag on an object. More... | |
char * | decode_flags (dbref player, FLAGSET flagset) |
Converts a flag set into corresponding letters. More... | |
char * | unparse_flags (dbref player, dbref thing) |
Converts a thing's flags into corresponding letters. More... | |
int | has_flag (dbref player, dbref it, char *flagname) |
Does object have flag visible to player? More... | |
char * | flag_description (dbref player, dbref target) |
Return a buffer containing the type and flags on thing. More... | |
char * | unparse_object_numonly (dbref target) |
Return a buffer containing the name and number of an object. More... | |
char * | unparse_object (dbref player, dbref target, int obey_myopic) |
Return a buffer pointing to the object name and possibly the db# and flags. More... | |
FLAGENT * | letter_to_flag (char this_letter) |
Given a one-character flag abbrev, return the flag pointer. More... | |
int | cf_flag_access (int *vp __attribute__((unused)), char *str, long extra __attribute__((unused)), dbref player, char *cmd) |
Modify who can set a flag. More... | |
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. More... | |
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. More... | |
void | decompile_flags (dbref player, dbref thing, char *thingname) |
Produce commands to set flags on target. More... | |
Variables | |
FLAGENT | gen_flags [] |
List of all available flags. All flags names MUST be in uppercase! | |
OBJENT | object_types [8] |
Flag manipulation routines.
int cf_flag_access | ( | int *vp | __attribute__(unused), |
char * | str, | ||
long extra | __attribute__(unused), | ||
dbref | player, | ||
char * | cmd | ||
) |
Modify who can set a flag.
vp | |
str | |
extra | |
player | |
cmd |
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.
vp | |
str | |
extra | |
player | |
cmd |
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.
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.
player | |
flaglist | |
fset | |
p_type |
Check for object type
Check generic flags
return flags to search for and type
char * decode_flags | ( | dbref | player, |
FLAGSET | flagset | ||
) |
Converts a flag set into corresponding letters.
player | |
flagset |
void decompile_flags | ( | dbref | player, |
dbref | thing, | ||
char * | thingname | ||
) |
Produce commands to set flags on target.
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
void display_flagtab | ( | dbref | player | ) |
Display available flags.
player |
int fh_any | ( | dbref | target, |
dbref | player, | ||
FLAG | flag, | ||
int | fflags, | ||
int | reset | ||
) |
Set or clear indicated flag bit, no security checking.
target | |
player | |
flag | |
fflags | |
reset |
int fh_dark_bit | ( | dbref | target, |
dbref | player, | ||
FLAG | flag, | ||
int | fflags, | ||
int | reset | ||
) |
Manipulate the dark bit. Nonwizards may not set on players.
target | |
player | |
flag | |
fflags | |
reset |
int fh_god | ( | dbref | target, |
dbref | player, | ||
FLAG | flag, | ||
int | fflags, | ||
int | reset | ||
) |
Only GOD may set or clear the bit.
target | |
player | |
flag | |
fflags | |
reset |
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.
target | |
player | |
flag | |
fflags | |
reset |
int fh_hear_bit | ( | dbref | target, |
dbref | player, | ||
FLAG | flag, | ||
int | fflags, | ||
int | reset | ||
) |
Set or clear bits that affect hearing.
target | |
player | |
flag | |
fflags | |
reset |
int fh_inherit | ( | dbref | target, |
dbref | player, | ||
FLAG | flag, | ||
int | fflags, | ||
int | reset | ||
) |
Only players may set or clear this bit.
target | |
player | |
flag | |
fflags | |
reset |
int fh_player_bit | ( | dbref | target, |
dbref | player, | ||
FLAG | flag, | ||
int | fflags, | ||
int | reset | ||
) |
Can set and reset this on everything but players.
target | |
player | |
flag | |
fflags | |
reset |
int fh_power_bit | ( | dbref | target, |
dbref | player, | ||
FLAG | flag, | ||
int | fflags, | ||
int | reset | ||
) |
Check power bit to set/reset.
target | |
player | |
flag | |
fflags | |
reset |
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.
target | |
player | |
flag | |
fflags | |
reset |
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.
target | |
player | |
flag | |
fflags | |
reset |
int fh_wiz | ( | dbref | target, |
dbref | player, | ||
FLAG | flag, | ||
int | fflags, | ||
int | reset | ||
) |
Only WIZARDS (or GOD) may set or clear the bit.
target | |
player | |
flag | |
fflags | |
reset |
int fh_wizroy | ( | dbref | target, |
dbref | player, | ||
FLAG | flag, | ||
int | fflags, | ||
int | reset | ||
) |
Only WIZARDS, ROYALTY, (or GOD) may set or clear the bit.
target | |
player | |
flag | |
fflags | |
reset |
FLAGENT * find_flag | ( | dbref thing | __attribute__(unused), |
char * | flagname | ||
) |
Search for a flag.
thing | |
flagname |
char * flag_description | ( | dbref | player, |
dbref | target | ||
) |
Return a buffer containing the type and flags on thing.
player | |
target |
Store the header strings and object type
Don't show CONNECT on dark wizards to mortals
void flag_set | ( | dbref | target, |
dbref | player, | ||
char * | flag, | ||
int | key | ||
) |
Set or clear a specified flag on an object.
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
int has_flag | ( | dbref | player, |
dbref | it, | ||
char * | flagname | ||
) |
Does object have flag visible to player?
player | |
it | |
flagname |
void init_flagtab | ( | void | ) |
Initialize flag hash tables.
FLAGENT * letter_to_flag | ( | char | this_letter | ) |
Given a one-character flag abbrev, return the flag pointer.
this_letter |
char * unparse_flags | ( | dbref | player, |
dbref | thing | ||
) |
Converts a thing's flags into corresponding letters.
player | |
thing |
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.
char * unparse_object | ( | dbref | player, |
dbref | target, | ||
int | obey_myopic | ||
) |
Return a buffer pointing to the object name and possibly the db# and flags.
player | |
target | |
obey_myopic |
char * unparse_object_numonly | ( | dbref | target | ) |
Return a buffer containing the name and number of an object.
target |
OBJENT object_types[8] |
Object types flags