00001
00002
00003
00004
00005 #include "copyright.h"
00006 #include "config.h"
00007
00008 #include "db.h"
00009 #include "mudconf.h"
00010 #include "externs.h"
00011 #include "command.h"
00012 #include "flags.h"
00013 #include "alloc.h"
00014 #include "powers.h"
00015
00023 int fh_any(dbref target, dbref player, FLAG flag, int fflags, int reset)
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 }
00043
00052 int fh_god(dbref target, dbref player, FLAG flag, int fflags, int reset)
00053 {
00054 if(!God(player))
00055 return 0;
00056
00057 return (fh_any(target, player, flag, fflags, reset));
00058 }
00059
00068 int fh_wiz(dbref target, dbref player, FLAG flag, int fflags, int reset)
00069 {
00070 if(!Wizard(player) && !God(player))
00071 return 0;
00072
00073 return (fh_any(target, player, flag, fflags, reset));
00074 }
00075
00084 int fh_fixed(dbref target, dbref player, FLAG flag, int fflags, int reset)
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 }
00092
00102 int fh_wizroy(dbref target, dbref player, FLAG flag, int fflags, int reset)
00103 {
00104 if(!WizRoy(player) && !God(player))
00105 return 0;
00106
00107 return (fh_any(target, player, flag, fflags, reset));
00108 }
00109
00118 int fh_inherit(dbref target, dbref player, FLAG flag, int fflags, int reset)
00119 {
00120 if(!Inherits(player))
00121 return 0;
00122
00123 return (fh_any(target, player, flag, fflags, reset));
00124 }
00125
00134 int fh_wiz_bit(dbref target, dbref player, FLAG flag, int fflags, int reset)
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 }
00145
00154 int fh_dark_bit(dbref target, dbref player, FLAG flag, int fflags, int reset)
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 }
00163
00172 int fh_going_bit(dbref target, dbref player, FLAG flag, int fflags, int reset)
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 }
00184
00193 int fh_hear_bit(dbref target, dbref player, FLAG flag, int fflags, int reset)
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 }
00210
00219 int fh_xcode_bit(dbref target, dbref player, FLAG flag, int fflags, int reset)
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 }
00231
00241 FLAGENT gen_flags[] = {
00242 {"ABODE", ABODE, 'A',
00243 FLAG_WORD2, 0, fh_any}
00244 ,
00245 {"ANSI", ANSI, 'X',
00246 FLAG_WORD2, 0, fh_any}
00247 ,
00248 {"ANSIMAP", ANSIMAP, 'P',
00249 FLAG_WORD2, 0, fh_any}
00250 ,
00251 {"AUDIBLE", HEARTHRU, 'a',
00252 0, 0, fh_hear_bit}
00253 ,
00254 {"AUDITORIUM", AUDITORIUM, 'b',
00255 FLAG_WORD2, 0, fh_any}
00256 ,
00257 {"COMPRESS", COMPRESS, '.',
00258 FLAG_WORD2, 0, fh_any}
00259 ,
00260 {"CONNECTED", CONNECTED, 'c',
00261 FLAG_WORD2, CA_NO_DECOMP, fh_god}
00262 ,
00263 {"CHOWN_OK", CHOWN_OK, 'C',
00264 0, 0, fh_any}
00265 ,
00266 {"DARK", DARK, 'D',
00267 0, 0, fh_dark_bit}
00268 ,
00269 {"DESTROY_OK", DESTROY_OK, 'd',
00270 0, 0, fh_any}
00271 ,
00272 {"ENTER_OK", ENTER_OK, 'e',
00273 0, 0, fh_any}
00274 ,
00275 {"FIXED", FIXED, 'f',
00276 FLAG_WORD2, 0, fh_fixed}
00277 ,
00278 {"FLOATING", FLOATING, 'F',
00279 FLAG_WORD2, 0, fh_any}
00280 ,
00281 {"GAGGED", GAGGED, 'j',
00282 FLAG_WORD2, 0, fh_wiz}
00283 ,
00284 {"GOING", GOING, 'G',
00285 0, CA_NO_DECOMP, fh_going_bit}
00286 ,
00287 {"HALTED", HALT, 'h',
00288 0, 0, fh_any}
00289 ,
00290 {"HAS_DAILY", HAS_DAILY, '*',
00291 FLAG_WORD2, CA_GOD | CA_NO_DECOMP, fh_god}
00292 ,
00293 {"HAS_FORWARDLIST", HAS_FWDLIST, '&',
00294 FLAG_WORD2, CA_GOD | CA_NO_DECOMP, fh_god}
00295 ,
00296 {"HAS_HOURLY", HAS_HOURLY, '*',
00297 FLAG_WORD2, CA_GOD | CA_NO_DECOMP, fh_god}
00298 ,
00299 {"HAS_LISTEN", HAS_LISTEN, '@',
00300 FLAG_WORD2, CA_GOD | CA_NO_DECOMP, fh_god}
00301 ,
00302 {"HAS_STARTUP", HAS_STARTUP, '+',
00303 0, CA_GOD | CA_NO_DECOMP, fh_god}
00304 ,
00305 {"HAVEN", HAVEN, 'H',
00306 0, 0, fh_any}
00307 ,
00308 {"HEAD", HEAD_FLAG, '?',
00309 FLAG_WORD2, 0, fh_wiz}
00310 ,
00311 {"BLIND", BLIND, '(',
00312 FLAG_WORD2, 0, fh_any}
00313 ,
00314 {"IMMORTAL", IMMORTAL, 'i',
00315 0, 0, fh_wiz}
00316 ,
00317 {"IN_CHARACTER", IN_CHARACTER, '#',
00318 FLAG_WORD2, 0, fh_wiz}
00319 ,
00320 {"INHERIT", INHERIT, 'I',
00321 0, 0, fh_inherit}
00322 ,
00323 {"JUMP_OK", JUMP_OK, 'J',
00324 0, 0, fh_any}
00325 ,
00326 {"KEY", KEY, 'K',
00327 FLAG_WORD2, 0, fh_any}
00328 ,
00329 {"LIGHT", LIGHT, 'l',
00330 FLAG_WORD2, 0, fh_any}
00331 ,
00332 {"LINK_OK", LINK_OK, 'L',
00333 0, 0, fh_any}
00334 ,
00335 {"MONITOR", MONITOR, 'M',
00336 0, 0, fh_hear_bit}
00337 ,
00338 {"MULTIOK", MULTIOK, 'y',
00339 FLAG_WORD2, CA_WIZARD, fh_wiz}
00340 ,
00341 {"MYOPIC", MYOPIC, 'm',
00342 0, 0, fh_any}
00343 ,
00344 {"NOBLEED", NOBLEED, '-',
00345 FLAG_WORD2, 0, fh_any}
00346 ,
00347 {"NO_COMMAND", NO_COMMAND, 'n',
00348 FLAG_WORD2, 0, fh_any}
00349 ,
00350 {"NOSPOOF", NOSPOOF, 'N',
00351 0, 0, fh_any}
00352 ,
00353 {"OPAQUE", OPAQUE, 'O',
00354 0, 0, fh_any}
00355 ,
00356 {"PARENT_OK", PARENT_OK, 'Y',
00357 FLAG_WORD2, 0, fh_any}
00358 ,
00359 {"PLAYER_MAILS", PLAYER_MAILS, 'B',
00360 FLAG_WORD2, CA_GOD | CA_NO_DECOMP, fh_god}
00361 ,
00362 {"PUPPET", PUPPET, 'p',
00363 0, 0, fh_hear_bit}
00364 ,
00365 {"QUIET", QUIET, 'Q',
00366 0, 0, fh_any}
00367 ,
00368 {"ROBOT", ROBOT, 'r',
00369 0, 0, fh_any}
00370 ,
00371 {"ROYALTY", ROYALTY, 'Z',
00372 0, 0, fh_wiz}
00373 ,
00374 {"SAFE", SAFE, 's',
00375 0, 0, fh_any}
00376 ,
00377 {"SLAVE", SLAVE, 'x',
00378 FLAG_WORD2, CA_WIZARD, fh_wiz}
00379 ,
00380 {"STAFF", STAFF, 'w',
00381 FLAG_WORD2, 0, fh_wiz}
00382 ,
00383 {"STICKY", STICKY, 'S',
00384 0, 0, fh_wiz}
00385 ,
00386 {"SUSPECT", SUSPECT, 'u',
00387 FLAG_WORD2, CA_WIZARD, fh_wiz}
00388 ,
00389 {"TERSE", TERSE, 'q',
00390 0, 0, fh_any}
00391 ,
00392 {"TRACE", TRACE, 'T',
00393 0, 0, fh_any}
00394 ,
00395 {"TRANSPARENT", SEETHRU, 't',
00396 0, 0, fh_any}
00397 ,
00398 {"UNFINDABLE", UNFINDABLE, 'U',
00399 FLAG_WORD2, 0, fh_any}
00400 ,
00401 {"UNINSPECTED", UNINSPECTED, 'g',
00402 FLAG_WORD2, 0, fh_wizroy}
00403 ,
00404 {"VERBOSE", VERBOSE, 'v',
00405 0, 0, fh_any}
00406 ,
00407 {"VISUAL", VISUAL, 'V',
00408 0, 0, fh_any}
00409 ,
00410 {"VACATION", VACATION, '|',
00411 FLAG_WORD2, 0, fh_fixed}
00412 ,
00413 {"WIZARD", WIZARD, 'W',
00414 0, 0, fh_wiz_bit}
00415 ,
00416 {"XCODE", HARDCODE, 'X',
00417 FLAG_WORD2, 0, fh_xcode_bit}
00418 ,
00419 {"ZOMBIE", ZOMBIE, 'z',
00420 FLAG_WORD2, CA_WIZARD, fh_wiz}
00421 ,
00422 {NULL, 0, ' ',
00423 0, 0, NULL}
00424 };
00425
00429 OBJENT object_types[8] = {
00430 {"ROOM", 'R', CA_PUBLIC, OF_CONTENTS | OF_EXITS | OF_DROPTO | OF_HOME}
00431 ,
00432 {"THING", ' ', CA_PUBLIC,
00433 OF_CONTENTS | OF_LOCATION | OF_EXITS | OF_HOME | OF_SIBLINGS}
00434 ,
00435 {"EXIT", 'E', CA_PUBLIC, OF_SIBLINGS}
00436 ,
00437 {"PLAYER", 'P', CA_PUBLIC,
00438 OF_CONTENTS | OF_LOCATION | OF_EXITS | OF_HOME | OF_OWNER | OF_SIBLINGS}
00439 ,
00440 {"TYPE5", '+', CA_GOD, 0}
00441 ,
00442 {"GARBAGE", '-', CA_PUBLIC,
00443 OF_CONTENTS | OF_LOCATION | OF_EXITS | OF_HOME | OF_SIBLINGS}
00444 ,
00445 {"GARBAGE", '#', CA_GOD, 0}
00446 };
00447
00451 void init_flagtab(void)
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 }
00468
00472 void display_flagtab(dbref player)
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 }
00496
00500 FLAGENT *find_flag(dbref thing, char *flagname)
00501 {
00502 char *cp;
00503
00504
00505 for(cp = flagname; *cp; cp++)
00506 *cp = ToLower(*cp);
00507
00508 return (FLAGENT *) hashfind(flagname, &mudstate.flags_htab);
00509 }
00510
00511
00512 char *find_attribute_flag(int flag, NAMETAB *ntab) {
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 }
00527
00535 void flag_set(dbref target, dbref player, char *flag, int key)
00536 {
00537 FLAGENT *fp;
00538 int negate, result;
00539
00540
00541
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
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
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 }
00582
00590 char *decode_flags(dbref player, FLAG flagword, FLAG flag2word,
00591 FLAG flag3word)
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
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 }
00636
00643 int has_flag(dbref player, dbref target, char *flagname)
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
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 }
00675
00681 char *flag_description(dbref player, dbref target)
00682 {
00683 char *buff, *bp;
00684 FLAGENT *fp;
00685 int otype;
00686 FLAG fv;
00687
00688
00689
00690
00691
00692 otype = Typeof(target);
00693 bp = buff = alloc_mbuf("flag_description");
00694
00695
00696
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
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
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
00736
00737
00738 *bp = '\0';
00739 return buff;
00740 }
00741
00746 char *unparse_object_numonly(dbref target)
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 }
00762
00766 char *unparse_object(dbref player, dbref target, int obey_myopic)
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
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
00797
00798 StringCopy(buf, Name(target));
00799 }
00800 }
00801 return buf;
00802 }
00803
00812 int convert_flags(dbref player, char *flaglist, FLAGSET * fset, FLAG * p_type)
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
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
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
00874
00875
00876 (*fset).word1 = flag1mask;
00877 (*fset).word2 = flag2mask;
00878 (*fset).word3 = flag3mask;
00879 *p_type = type;
00880 return 1;
00881 }
00882
00889 void decompile_flags(dbref player, dbref thing, char *thingname)
00890 {
00891 FLAG f1, f2, f3;
00892 FLAGENT *fp;
00893 char new[LBUF_SIZE];
00894
00895
00896
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
00907
00908
00909 if(fp->listperm & CA_NO_DECOMP)
00910 continue;
00911
00912
00913
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
00929
00930
00931 if(!check_access(player, fp->listperm))
00932 continue;
00933
00934
00935
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 }