#include "copyright.h"
#include "config.h"
#include "db.h"
#include "mudconf.h"
#include "externs.h"
#include "command.h"
#include "flags.h"
#include "alloc.h"
#include "powers.h"
Include dependency graph for flags.c:
Go to the source code of this file.
Functions | |
int | fh_any (dbref target, dbref player, FLAG flag, int fflags, int reset) |
int | fh_god (dbref target, dbref player, FLAG flag, int fflags, int reset) |
int | fh_wiz (dbref target, dbref player, FLAG flag, int fflags, int reset) |
int | fh_fixed (dbref target, dbref player, FLAG flag, int fflags, int reset) |
int | fh_wizroy (dbref target, dbref player, FLAG flag, int fflags, int reset) |
int | fh_inherit (dbref target, dbref player, FLAG flag, int fflags, int reset) |
int | fh_wiz_bit (dbref target, dbref player, FLAG flag, int fflags, int reset) |
int | fh_dark_bit (dbref target, dbref player, FLAG flag, int fflags, int reset) |
int | fh_going_bit (dbref target, dbref player, FLAG flag, int fflags, int reset) |
int | fh_hear_bit (dbref target, dbref player, FLAG flag, int fflags, int reset) |
int | fh_xcode_bit (dbref target, dbref player, FLAG flag, int fflags, int reset) |
void | init_flagtab (void) |
void | display_flagtab (dbref player) |
FLAGENT * | find_flag (dbref thing, char *flagname) |
char * | find_attribute_flag (int flag, NAMETAB *ntab) |
void | flag_set (dbref target, dbref player, char *flag, int key) |
char * | decode_flags (dbref player, FLAG flagword, FLAG flag2word, FLAG flag3word) |
int | has_flag (dbref player, dbref target, char *flagname) |
char * | flag_description (dbref player, dbref target) |
char * | unparse_object_numonly (dbref target) |
char * | unparse_object (dbref player, dbref target, int obey_myopic) |
int | convert_flags (dbref player, char *flaglist, FLAGSET *fset, FLAG *p_type) |
void | decompile_flags (dbref player, dbref thing, char *thingname) |
Variables | |
FLAGENT | gen_flags [] |
OBJENT | object_types [8] |
Converts a list of flag letters into its bit pattern. Also set the type qualifier if specified and not already set.
player | The evoking object | |
flaglist | The list of flags to conver to bit pattern | |
fset | ?? | |
p_type | ?? |
Definition at line 812 of file flags.c.
References CA_GOD, CA_WIZARD, FLAG_WORD2, FLAG_WORD3, flag_entry::flagflag, flag_entry::flaglett, flag_entry::flagname, flag_entry::flagvalue, gen_flags, God, flag_entry::listperm, notify_printf(), NOTYPE, object_types, and Wizard.
Referenced by handle_flaglists(), and search_setup().
00813 { 00814 int i, handled; 00815 char *s; 00816 FLAG flag1mask, flag2mask, flag3mask, type; 00817 FLAGENT *fp; 00818 00819 flag1mask = flag2mask = flag3mask = 0; 00820 type = NOTYPE; 00821 00822 for(s = flaglist; *s; s++) { 00823 handled = 0; 00824 00825 /* 00826 * Check for object type 00827 */ 00828 00829 for(i = 0; (i <= 7) && !handled; i++) { 00830 if((object_types[i].lett == *s) && 00831 !(((object_types[i].perm & CA_WIZARD) && !Wizard(player)) 00832 || ((object_types[i].perm & CA_GOD) && !God(player)))) { 00833 if((type != NOTYPE) && (type != i)) { 00834 notify_printf(player, 00835 "%c: Conflicting type specifications.", *s); 00836 return 0; 00837 } 00838 type = i; 00839 handled = 1; 00840 } 00841 } 00842 00843 /* 00844 * Check generic flags 00845 */ 00846 00847 if(handled) 00848 continue; 00849 for(fp = gen_flags; (fp->flagname) && !handled; fp++) { 00850 if((fp->flaglett == *s) && !(((fp->listperm & CA_WIZARD) && 00851 !Wizard(player)) 00852 || ((fp->listperm & CA_GOD) 00853 && !God(player)))) { 00854 if(fp->flagflag & FLAG_WORD3) 00855 flag3mask |= fp->flagvalue; 00856 else if(fp->flagflag & FLAG_WORD2) 00857 flag2mask |= fp->flagvalue; 00858 else 00859 flag1mask |= fp->flagvalue; 00860 handled = 1; 00861 } 00862 } 00863 00864 if(!handled) { 00865 notify_printf(player, 00866 "%c: Flag unknown or not valid for specified object type", 00867 *s); 00868 return 0; 00869 } 00870 } 00871 00872 /* 00873 * return flags to search for and type 00874 */ 00875 00876 (*fset).word1 = flag1mask; 00877 (*fset).word2 = flag2mask; 00878 (*fset).word3 = flag3mask; 00879 *p_type = type; 00880 return 1; 00881 } /* end convert_flags() */
Converts a flags word into corresponding letters.
player | The invoking object | |
flagword | ?? | |
flag2word | ?? | |
flag3word | ?? |
Definition at line 590 of file flags.c.
References alloc_sbuf, CA_GOD, CA_WIZARD, CONNECTED, DARK, FLAG_WORD2, FLAG_WORD3, flag_entry::flagflag, flag_entry::flaglett, flag_entry::flagname, flag_entry::flagvalue, gen_flags, God, Good_obj, flag_entry::listperm, object_types, safe_sb_chr, StringCopy, TYPE_MASK, TYPE_PLAYER, Wizard, and WIZARD.
Referenced by list_df_flags(), and shutdownsock().
00592 { 00593 char *buf, *bp; 00594 FLAGENT *fp; 00595 int flagtype; 00596 FLAG fv; 00597 00598 buf = bp = alloc_sbuf("decode_flags"); 00599 *bp = '\0'; 00600 00601 if(!Good_obj(player)) { 00602 StringCopy(buf, "#-2 ERROR"); 00603 return buf; 00604 } 00605 00606 flagtype = (flagword & TYPE_MASK); 00607 if(object_types[flagtype].lett != ' ') 00608 safe_sb_chr(object_types[flagtype].lett, buf, &bp); 00609 00610 for(fp = gen_flags; fp->flagname; fp++) { 00611 if(fp->flagflag & FLAG_WORD3) 00612 fv = flag3word; 00613 else if(fp->flagflag & FLAG_WORD2) 00614 fv = flag2word; 00615 else 00616 fv = flagword; 00617 if(fv & fp->flagvalue) { 00618 if((fp->listperm & CA_WIZARD) && !Wizard(player)) 00619 continue; 00620 if((fp->listperm & CA_GOD) && !God(player)) 00621 continue; 00622 /* 00623 * don't show CONNECT on dark wizards to mortals 00624 */ 00625 if((flagtype == TYPE_PLAYER) && (fp->flagvalue == CONNECTED) 00626 && ((flagword & (WIZARD | DARK)) == (WIZARD | DARK)) && 00627 !Wizard(player)) 00628 continue; 00629 safe_sb_chr(fp->flaglett, buf, &bp); 00630 } 00631 } 00632 00633 *bp = '\0'; 00634 return buf; 00635 } /* end decode_flags() */
Produces commands to set flags on target.
player | The evoking object | |
thing | The target object | |
thingname | ?? |
Definition at line 889 of file flags.c.
References CA_NO_DECOMP, FLAG_WORD2, FLAG_WORD3, flag_entry::flagflag, flag_entry::flagname, Flags, Flags2, Flags3, flag_entry::flagvalue, gen_flags, LBUF_SIZE, and flag_entry::listperm.
00890 { 00891 FLAG f1, f2, f3; 00892 FLAGENT *fp; 00893 char new[LBUF_SIZE]; 00894 00895 /* 00896 * Report generic flags 00897 */ 00898 00899 f1 = Flags(thing); 00900 f2 = Flags2(thing); 00901 f3 = Flags3(thing); 00902 00903 for(fp = gen_flags; fp->flagname; fp++) { 00904 00905 /* 00906 * Skip if we shouldn't decompile this flag 00907 */ 00908 00909 if(fp->listperm & CA_NO_DECOMP) 00910 continue; 00911 00912 /* 00913 * Skip if this flag is not set 00914 */ 00915 00916 if(fp->flagflag & FLAG_WORD3) { 00917 if(!(f3 & fp->flagvalue)) 00918 continue; 00919 } else if(fp->flagflag & FLAG_WORD2) { 00920 if(!(f2 & fp->flagvalue)) 00921 continue; 00922 } else { 00923 if(!(f1 & fp->flagvalue)) 00924 continue; 00925 } 00926 00927 /* 00928 * Skip if we can't see this flag 00929 */ 00930 00931 if(!check_access(player, fp->listperm)) 00932 continue; 00933 00934 /* 00935 * We made it this far, report this flag 00936 */ 00937 strncpy(new, thingname, LBUF_SIZE-1); 00938 notify_printf(player, "@set %s=%s", strip_ansi_r(new,thingname,strlen(thingname)), 00939 fp->flagname); 00940 } 00941 } /* end decompile_flags() */
void display_flagtab | ( | dbref | player | ) |
Displays available flags. Used in flags.
Definition at line 472 of file flags.c.
References alloc_lbuf, CA_GOD, CA_WIZARD, flag_entry::flaglett, flag_entry::flagname, free_lbuf, gen_flags, God, flag_entry::listperm, notify, safe_chr, safe_str, and Wizard.
Referenced by do_list().
00473 { 00474 char *buf, *bp; 00475 FLAGENT *fp; 00476 00477 bp = buf = alloc_lbuf("display_flagtab"); 00478 safe_str((char *) "Flags:", buf, &bp); 00479 00480 for(fp = gen_flags; fp->flagname; fp++) { 00481 if((fp->listperm & CA_WIZARD) && !Wizard(player)) 00482 continue; 00483 if((fp->listperm & CA_GOD) && !God(player)) 00484 continue; 00485 safe_chr(' ', buf, &bp); 00486 safe_str((char *) fp->flagname, buf, &bp); 00487 safe_chr('(', buf, &bp); 00488 safe_chr(fp->flaglett, buf, &bp); 00489 safe_chr(')', buf, &bp); 00490 } 00491 00492 *bp = '\0'; 00493 notify(player, buf); 00494 free_lbuf(buf); 00495 } /* end display_flagtab() */
Sets or clears the indicated bit, no security checking.
target | The target object for setting/unsetting | |
player | The object who is setting/unsetting | |
fflags | ?? | |
reset | If 1, we're resetting the flag |
Definition at line 23 of file flags.c.
References FLAG_WORD2, FLAG_WORD3, Flags, Flags2, Flags3, s_Flags, s_Flags2, and s_Flags3.
Referenced by fh_dark_bit(), fh_fixed(), fh_god(), fh_going_bit(), fh_hear_bit(), fh_inherit(), fh_wiz(), fh_wiz_bit(), and fh_wizroy().
00024 { 00025 if(fflags & FLAG_WORD3) { 00026 if(reset) 00027 s_Flags3(target, Flags3(target) & ~flag); 00028 else 00029 s_Flags3(target, Flags3(target) | flag); 00030 } else if(fflags & FLAG_WORD2) { 00031 if(reset) 00032 s_Flags2(target, Flags2(target) & ~flag); 00033 else 00034 s_Flags2(target, Flags2(target) | flag); 00035 } else { 00036 if(reset) 00037 s_Flags(target, Flags(target) & ~flag); 00038 else 00039 s_Flags(target, Flags(target) | flag); 00040 } 00041 return 1; 00042 } /* end fh_and() */
Manipulates the dark bit. Non-Wizards may not set on players.
target | Target object for setting/unsetting | |
player | The object that is setting/unsetting | |
flag | The flag to be manipulated | |
fflags | ?? | |
reset | If 1, we're resetting the flag |
Definition at line 154 of file flags.c.
References Can_Hide, fh_any(), God, isPlayer, and Wizard.
00155 { 00156 if(!reset && isPlayer(target) && !((target == player) && 00157 Can_Hide(player)) && (!Wizard(player) 00158 && !God(player))) 00159 return 0; 00160 00161 return (fh_any(target, player, flag, fflags, reset)); 00162 } /* end fh_dark_bit() */
Only allows the bit to be set on players by WIZARDS.
target | Target object for setting/unsetting | |
player | The object that is setting/unsetting | |
flag | The flag to be manipulated | |
fflags | ?? | |
reset | If 1, we're resetting the flag |
Definition at line 84 of file flags.c.
References fh_any(), God, isPlayer, and Wizard.
00085 { 00086 if(isPlayer(target)) 00087 if(!Wizard(player) && !God(player)) 00088 return 0; 00089 00090 return (fh_any(target, player, flag, fflags, reset)); 00091 } /* end fh_fixed() */
Function to block out non-GOD for setting or clearing a bit.
target | Target object for setting/unsetting | |
player | The object that is setting/unsetting | |
flag | The flag to be manipulated | |
fflags | ?? | |
reset | If 1, we're resetting the flag |
Definition at line 52 of file flags.c.
00053 { 00054 if(!God(player)) 00055 return 0; 00056 00057 return (fh_any(target, player, flag, fflags, reset)); 00058 } /* end fh_god() */
Manipulates the going bit.
target | Target object for setting/unsetting | |
player | The object that is setting/unsetting | |
flag | The flag to be manipulated | |
fflags | ?? | |
reset | If 1, we're resetting the flag |
Definition at line 172 of file flags.c.
References fh_any(), God, Going, notify, TYPE_GARBAGE, and Typeof.
00173 { 00174 if(Going(target) && reset && (Typeof(target) != TYPE_GARBAGE)) { 00175 notify(player, "Your object has been spared from destruction."); 00176 return (fh_any(target, player, flag, fflags, reset)); 00177 } 00178 00179 if(!God(player)) 00180 return 0; 00181 00182 return (fh_any(target, player, flag, fflags, reset)); 00183 } /* end fh_going_bit() */
Sets or clears bits that affect hearing.
target | Target object for setting/unsetting | |
player | The object that is setting/unsetting | |
flag | The flag to be manipulated | |
fflags | ?? | |
reset | If 1, we're resetting the flag |
Definition at line 193 of file flags.c.
References Can_Monitor, fh_any(), handle_ears(), Hearer(), isPlayer, and MONITOR.
00194 { 00195 int could_hear; 00196 00197 if(isPlayer(target) && (flag & MONITOR)) { 00198 if(Can_Monitor(player)) 00199 fh_any(target, player, flag, fflags, reset); 00200 else 00201 return 0; 00202 } 00203 00204 could_hear = Hearer(target); 00205 fh_any(target, player, flag, fflags, reset); 00206 handle_ears(target, could_hear, Hearer(target)); 00207 00208 return 1; 00209 } /* end fh_hear_bit() */
Only allows players to set or clear this bit.
target | Target object for setting/unsetting | |
player | The object that is setting/unsetting | |
flag | The flag to be manipulated | |
fflags | ?? | |
reset | If 1, we're resetting the flag |
Definition at line 118 of file flags.c.
References fh_any(), and Inherits.
00119 { 00120 if(!Inherits(player)) 00121 return 0; 00122 00123 return (fh_any(target, player, flag, fflags, reset)); 00124 } /* end fh_inherit() */
Blocks out non-WIZARDS setting or clearing a bit.
target | Target object for setting/unsetting | |
player | The object that is setting/unsetting | |
flag | The flag to be manipulated | |
fflags | ?? | |
reset | If 1, we're resetting the flag |
Definition at line 68 of file flags.c.
References fh_any(), God, and Wizard.
Referenced by fh_xcode_bit().
00069 { 00070 if(!Wizard(player) && !God(player)) 00071 return 0; 00072 00073 return (fh_any(target, player, flag, fflags, reset)); 00074 } /* end fh_wiz() */
Only allows GOD to set/clear this bit. Used for WIZARD flag.
target | Target object for setting/unsetting | |
player | The object that is setting/unsetting | |
flag | The flag to be manipulated | |
fflags | ?? | |
reset | If 1, we're resetting the flag |
Definition at line 134 of file flags.c.
References fh_any(), God, and notify.
00135 { 00136 if(!God(player)) 00137 return 0; 00138 if(God(target) && reset) { 00139 notify(player, "You cannot make yourself mortal."); 00140 return 0; 00141 } 00142 00143 return (fh_any(target, player, flag, fflags, reset)); 00144 } /* end fh_wiz_bit() */
Only allows WIZARDS, ROYALTY, (or GOD) to set or clear the bit.
target | Target object for setting/unsetting | |
player | The object that is setting/unsetting | |
flag | The flag to be manipulated | |
fflags | ?? | |
reset | If 1, we're resetting the flag |
Definition at line 102 of file flags.c.
References fh_any(), God, and WizRoy.
00103 { 00104 if(!WizRoy(player) && !God(player)) 00105 return 0; 00106 00107 return (fh_any(target, player, flag, fflags, reset)); 00108 } /* end fh_wizroy() */
Sets or clears bits that affect xcode in glue.h.
target | Target object for setting/unsetting | |
player | The object that is setting/unsetting | |
flag | The flag to be manipulated | |
fflags | ?? | |
reset | If 1, we're resetting the flag |
Definition at line 219 of file flags.c.
References fh_wiz(), handle_xcode(), and Hardcode.
00220 { 00221 int got_xcode; 00222 int new_xcode; 00223 00224 got_xcode = Hardcode(target); 00225 fh_wiz(target, player, flag, fflags, reset); 00226 new_xcode = Hardcode(target); 00227 handle_xcode(player, target, got_xcode, new_xcode); 00228 00229 return 1; 00230 } /* end fh_xcode_bit() */
char* find_attribute_flag | ( | int | flag, | |
NAMETAB * | ntab | |||
) |
Definition at line 512 of file flags.c.
References name_table::flag, and name_table::name.
00512 { 00513 00514 NAMETAB *nt; 00515 char *flag_name; 00516 00517 flag_name = NULL; 00518 00519 for (nt = ntab; nt->name; nt++) { 00520 if (flag == nt->flag) { 00521 flag_name = strdup(nt->name); 00522 } 00523 } 00524 00525 return flag_name; 00526 }
??
Definition at line 500 of file flags.c.
References statedata::flags_htab, hashfind(), mudstate, and ToLower.
Referenced by flag_set(), and has_flag().
00501 { 00502 char *cp; 00503 00504 /* Make sure the flag name is valid */ 00505 for(cp = flagname; *cp; cp++) 00506 *cp = ToLower(*cp); 00507 00508 return (FLAGENT *) hashfind(flagname, &mudstate.flags_htab); 00509 } /* end find_flag() */
Returns an mbuf containing the type and flags on thing.
player | The player to send to | |
target | The object whose flags we're checking |
Definition at line 681 of file flags.c.
References alloc_mbuf, CA_GOD, CA_PUBLIC, CA_WIZARD, CONNECTED, DARK, FLAG_WORD2, FLAG_WORD3, flag_entry::flagflag, flag_entry::flagname, Flags, Flags2, Flags3, flag_entry::flagvalue, gen_flags, God, isPlayer, flag_entry::listperm, name, object_types, safe_mb_chr, safe_mb_str, Typeof, Wizard, and WIZARD.
Referenced by debug_examine(), and do_examine().
00682 { 00683 char *buff, *bp; 00684 FLAGENT *fp; 00685 int otype; 00686 FLAG fv; 00687 00688 /* 00689 * Allocate the return buffer 00690 */ 00691 00692 otype = Typeof(target); 00693 bp = buff = alloc_mbuf("flag_description"); 00694 00695 /* 00696 * Store the header strings and object type 00697 */ 00698 00699 safe_mb_str((char *) "Type: ", buff, &bp); 00700 safe_mb_str((char *) object_types[otype].name, buff, &bp); 00701 safe_mb_str((char *) " Flags:", buff, &bp); 00702 if(object_types[otype].perm != CA_PUBLIC) { 00703 *bp = '\0'; 00704 return buff; 00705 } 00706 /* 00707 * Store the type-invariant flags 00708 */ 00709 00710 for(fp = gen_flags; fp->flagname; fp++) { 00711 if(fp->flagflag & FLAG_WORD3) 00712 fv = Flags3(target); 00713 else if(fp->flagflag & FLAG_WORD2) 00714 fv = Flags2(target); 00715 else 00716 fv = Flags(target); 00717 if(fv & fp->flagvalue) { 00718 if((fp->listperm & CA_WIZARD) && !Wizard(player)) 00719 continue; 00720 if((fp->listperm & CA_GOD) && !God(player)) 00721 continue; 00722 /* 00723 * don't show CONNECT on dark wizards to mortals 00724 */ 00725 if(isPlayer(target) && (fp->flagvalue == CONNECTED) && 00726 ((Flags(target) & (WIZARD | DARK)) == (WIZARD | DARK)) && 00727 !Wizard(player)) 00728 continue; 00729 safe_mb_chr(' ', buff, &bp); 00730 safe_mb_str((char *) fp->flagname, buff, &bp); 00731 } 00732 } 00733 00734 /* 00735 * Terminate the string, and return the buffer to the caller 00736 */ 00737 00738 *bp = '\0'; 00739 return buff; 00740 } /* end flag_description() */
Sets or clears a specified flag on an object.
target | Target object | |
player | The object doing the setting flag The flag being set/unset | |
key | Are we /quiet'in? |
Definition at line 535 of file flags.c.
References find_flag(), flag_entry::flagflag, flag_entry::flagname, flag_entry::flagvalue, flag_entry::handler, Name(), notify, notify_printf(), Quiet, and SET_QUIET.
Referenced by do_set(), and fun_set().
00536 { 00537 FLAGENT *fp; 00538 int negate, result; 00539 00540 /* 00541 * Trim spaces, and handle the negation character 00542 */ 00543 00544 negate = 0; 00545 while (*flag && isspace(*flag)) 00546 flag++; 00547 if(*flag == '!') { 00548 negate = 1; 00549 flag++; 00550 } 00551 while (*flag && isspace(*flag)) 00552 flag++; 00553 00554 /* 00555 * Make sure a flag name was specified 00556 */ 00557 00558 if(*flag == '\0') { 00559 if(negate) 00560 notify(player, "You must specify a flag to clear."); 00561 else 00562 notify(player, "You must specify a flag to set."); 00563 return; 00564 } 00565 fp = find_flag(target, flag); 00566 if(fp == NULL) { 00567 notify(player, "I don't understand that flag."); 00568 return; 00569 } 00570 /* 00571 * Invoke the flag handler, and print feedback 00572 */ 00573 00574 result = fp->handler(target, player, fp->flagvalue, fp->flagflag, negate); 00575 if(!result) 00576 notify(player, "Permission denied."); 00577 else if(!(key & SET_QUIET) && !Quiet(player)) 00578 notify_printf(player, "%s - %s %s", Name(target), fp->flagname, 00579 negate ? "cleared." : "set."); 00580 return; 00581 } /* end flag_set() */
Does object have flag visible to player?
player | The player we're looking for | |
target | The object with the flag | |
flagname | The flag in question |
Definition at line 643 of file flags.c.
References CA_GOD, CA_WIZARD, CONNECTED, DARK, find_flag(), FLAG_WORD2, FLAG_WORD3, flag_entry::flagflag, Flags, Flags2, Flags3, flag_entry::flagvalue, God, isPlayer, flag_entry::listperm, Wizard, and WIZARD.
Referenced by fun_hasflag().
00644 { 00645 FLAGENT *fp; 00646 FLAG fv; 00647 00648 fp = find_flag(target, flagname); 00649 if(fp == NULL) 00650 return 0; 00651 00652 if(fp->flagflag & FLAG_WORD3) 00653 fv = Flags3(target); 00654 else if(fp->flagflag & FLAG_WORD2) 00655 fv = Flags2(target); 00656 else 00657 fv = Flags(target); 00658 00659 if(fv & fp->flagvalue) { 00660 if((fp->listperm & CA_WIZARD) && !Wizard(player)) 00661 return 0; 00662 if((fp->listperm & CA_GOD) && !God(player)) 00663 return 0; 00664 /* 00665 * don't show CONNECT on dark wizards to mortals 00666 */ 00667 if(isPlayer(target) && (fp->flagvalue == CONNECTED) && 00668 ((Flags(target) & (WIZARD | DARK)) == (WIZARD | DARK)) && 00669 !Wizard(player)) 00670 return 0; 00671 return 1; 00672 } 00673 return 0; 00674 } /* end has_flag() */
void init_flagtab | ( | void | ) |
Initializes flag hash tables.
Definition at line 451 of file flags.c.
References alloc_sbuf, flag_entry::flagname, statedata::flags_htab, free_sbuf, gen_flags, HASH_FACTOR, hashadd(), hashinit(), mudstate, and ToLower.
Referenced by main().
00452 { 00453 FLAGENT *fp; 00454 char *nbuf, *np, *bp; 00455 00456 hashinit(&mudstate.flags_htab, 100 * HASH_FACTOR); 00457 nbuf = alloc_sbuf("init_flagtab"); 00458 00459 for(fp = gen_flags; fp->flagname; fp++) { 00460 for(np = nbuf, bp = (char *) fp->flagname; *bp; np++, bp++) 00461 *np = ToLower(*bp); 00462 *np = '\0'; 00463 hashadd(nbuf, (int *) fp, &mudstate.flags_htab); 00464 } 00465 00466 free_sbuf(nbuf); 00467 } /* end init_flagtab() */
Returns an lbuf pointing to the object name and possibly the db# and flags.
Definition at line 766 of file flags.c.
References ABODE, alloc_lbuf, CHOWN_OK, DESTROY_OK, Examinable, Flags, Flags2, free_sbuf, Good_obj, HOME, JUMP_OK, LINK_OK, MyopicExam, Name(), NOTHING, StringCopy, and unparse_flags.
Referenced by do_channelwho(), do_chanobj(), do_chown_macro(), do_comwho(), do_entrances(), do_examine(), do_find(), do_inventory(), do_list_macro(), do_malias_create(), do_search(), do_status_macro(), log_name(), look_contents(), look_in(), look_simple(), show_que(), and unparse_boolexp1().
00767 { 00768 char *buf, *fp; 00769 int exam; 00770 00771 buf = alloc_lbuf("unparse_object"); 00772 if(target == NOTHING) { 00773 StringCopy(buf, "*NOTHING*"); 00774 } else if(target == HOME) { 00775 StringCopy(buf, "*HOME*"); 00776 } else if(!Good_obj(target)) { 00777 sprintf(buf, "*ILLEGAL*(#%d)", target); 00778 } else { 00779 if(obey_myopic) 00780 exam = MyopicExam(player, target); 00781 else 00782 exam = Examinable(player, target); 00783 if(exam || 00784 (Flags(target) & (CHOWN_OK | JUMP_OK | LINK_OK | DESTROY_OK)) 00785 || (Flags2(target) & ABODE)) { 00786 00787 /* 00788 * show everything 00789 */ 00790 fp = unparse_flags(player, target); 00791 sprintf(buf, "%s(#%d%s%s)", Name(target), target, 00792 *fp ? ":" : "", fp); 00793 free_sbuf(fp); 00794 } else { 00795 /* 00796 * show only the name. 00797 */ 00798 StringCopy(buf, Name(target)); 00799 } 00800 } 00801 return buf; 00802 } /* end unparse_object() */
char* unparse_object_numonly | ( | dbref | target | ) |
Returns an lbuf containing the name and number of an object.
target | The target object |
Definition at line 746 of file flags.c.
References alloc_lbuf, Good_obj, HOME, Name(), NOTHING, and StringCopy.
Referenced by do_chboot(), and log_name().
00747 { 00748 char *buf; 00749 00750 buf = alloc_lbuf("unparse_object_numonly"); 00751 if(target == NOTHING) { 00752 StringCopy(buf, "*NOTHING*"); 00753 } else if(target == HOME) { 00754 StringCopy(buf, "*HOME*"); 00755 } else if(!Good_obj(target)) { 00756 sprintf(buf, "*ILLEGAL*(#%d)", target); 00757 } else { 00758 sprintf(buf, "%s(#%d)", Name(target), target); 00759 } 00760 return buf; 00761 } /* end unparse_object_numonly() */
Alphabetized flag listing 0 = Flag's visible name 1 = Flag's bit representation 2 = Flag's letter alias 3 = Flag's wordspace 4 = Who may see the flag (0 = all) 5 = Permissions
Definition at line 241 of file flags.c.
Referenced by convert_flags(), decode_flags(), decompile_flags(), display_flagtab(), flag_description(), and init_flagtab().
Initial value:
{ {"ROOM", 'R', CA_PUBLIC, OF_CONTENTS | OF_EXITS | OF_DROPTO | OF_HOME} , {"THING", ' ', CA_PUBLIC, OF_CONTENTS | OF_LOCATION | OF_EXITS | OF_HOME | OF_SIBLINGS} , {"EXIT", 'E', CA_PUBLIC, OF_SIBLINGS} , {"PLAYER", 'P', CA_PUBLIC, OF_CONTENTS | OF_LOCATION | OF_EXITS | OF_HOME | OF_OWNER | OF_SIBLINGS} , {"TYPE5", '+', CA_GOD, 0} , {"GARBAGE", '-', CA_PUBLIC, OF_CONTENTS | OF_LOCATION | OF_EXITS | OF_HOME | OF_SIBLINGS} , {"GARBAGE", '#', CA_GOD, 0} }
Definition at line 429 of file flags.c.
Referenced by convert_flags(), decode_flags(), and flag_description().