# # Patch name: extra_flags.patch # Patch version: 2 # Author's name: Kurt Fitzner # Author's email: kfitzner@nexus.v-wave.com # Version of PennMUSH: 1.7.2p26 # Date patch made: Sat Jul 31 18:53:07 1999 # Author is willing to support (yes/no): yes # Patch format: diff -u5 # # # This is a contributed PennMUSH patch. Its use is subject to the # same restrictions found in PennMUSH's hdrs/copyrite.h file. # # No warranty is given for this patch. It is not necessarily going # to work on your system, with any version of PennMUSH other than # the one above, etc. # # If the author given above was willing to support the patch, you # should write to the author if you have any questions or problems. Do # *NOT* send email messages to Javelin or any PennMUSH mailing list about # this patch! # # Below this line is the author's description of the patch, # followed by the patch itself. If the patch is in context diff # format, you'll probably apply it by typing: patch < patchfile # in your top-level MUSH directory, unless instructed otherwise # below. # # extra_flags.patch # Adds two extra flags. LISTEN_PARENT and PROTECTED. # # Because of some very hacked code in PennMUSH, these flags are # presented together in one patch. The hacked code is that code # which allows multiple 'toggles' to bear the same name. Trust # me, it's really awful (no offense Jav). I'll fix it some time, # but until then these two flags are in one patch: # # Flag: LISTEN_PARENT (things, rooms) # When set on a thing or room which also has the MONITOR flag set, # this flag causes ^ listen patterns to be checked on the object's # parents as well as on the object. # # PROTECTED (things, rooms, players) # When set on a thing, room, or player, then it becomes totally # unseeable, and uncontrolable by ANYONE except the #1 God char, # or its owner. # # I have found that many mushes have had royals, or others in # positions of trust who have ripped off code via their SEE_ALL # capability. This flag can prevent that. Set this flag on # important parents, and they can't be seen by anyone. # # The flag is currently setable only by GOD (#1). # diff -u5r pennmush-vanilla/game/txt/hlp/pennflag.hlp pennmush-changed/game/txt/hlp/pennflag.hlp --- pennmush-vanilla/game/txt/hlp/pennflag.hlp Sun Jul 18 10:14:27 1999 +++ pennmush-changed/game/txt/hlp/pennflag.hlp Sat Jul 31 18:53:07 1999 @@ -51,11 +51,11 @@ g - Gagged h - Halt j - Jury_Ok l - Light m - Myopic n - No_Command o - On-Vacation p - Puppet r - Royalty s - Suspect t - Transparent u - Uninspected v - Verbose w - No_Warn x - Terse - z - Startup ? - Unregistered + z - Startup ? - Unregistered ^ - Listen_Parent --------------------------------------------------------------------- Some flags may not be enabled on some MUSHes. & ABODE Flag: ABODE (rooms) @@ -657,5 +657,14 @@ player's zone lock. This allows zoning based on ownership rather than on the zone field and is more secure, although it does not allow for the "local globals" ability of standard zones. See also: ZONES, ZONE MASTERS, @chzone, ZONE MASTER ROOMS +& LISTEN_PARENT + Flag: LISTEN_PARENT (things, rooms) + + When set on a thing or room which also has the MONITOR flag set, this + flag causes ^ listen patterns to be checked on the object's parents as + well as on the object. + +See also: MONITOR, LISTENING + diff -u5r pennmush-vanilla/game/txt/hlp/penntop.hlp pennmush-changed/game/txt/hlp/penntop.hlp --- pennmush-vanilla/game/txt/hlp/penntop.hlp Sun Jul 18 10:14:30 1999 +++ pennmush-changed/game/txt/hlp/penntop.hlp Sat Jul 31 18:53:07 1999 @@ -688,15 +688,17 @@ (continued in help listening3) & LISTENING3 Please note that an object CANNOT trigger its own ^-patterns, so they work like @ahear rather than @aahear or @amhear. Additionally, - unlike $-commands, @listen and ^-patterns are NOT inherited via @parent. + unlike $-commands, @listen and ^-patterns are NOT inherited via @parent, + unless the LISTEN_PARENT flag is set on the listener. Listen patterns are checked after the object's normal @listen attribute. -See also: @listen, @ahear, @amhear, @aahear, MONITOR, USER-DEFINED COMMANDS +See also: @listen, @ahear, @amhear, @aahear, MONITOR, + USER-DEFINED COMMANDS, LISTEN_PARENT & LISTS The word "list" is used in the help files to refer to a string that is a series of smaller strings separated by one or more spaces. A list can also have its elements separated by some other kind of character -- the separating character is called the "delimiter". diff -u5r pennmush-vanilla/hdrs/dbdefs.h pennmush-changed/hdrs/dbdefs.h --- pennmush-vanilla/hdrs/dbdefs.h Sun Jul 18 10:12:53 1999 +++ pennmush-changed/hdrs/dbdefs.h Sun Aug 1 14:25:32 1999 @@ -109,10 +109,12 @@ /******* Player toggles */ #define Suspect(x) (IS(x, TYPE_PLAYER, PLAYER_SUSPECT)) /* 0x40 */ #define Connected(x) (IS(x, TYPE_PLAYER, PLAYER_CONNECT)) /* 0x200 */ #define ZMaster(x) (IS(x, TYPE_PLAYER, PLAYER_ZONE)) /* 0x800 */ #define Unregistered(x) (IS(x, TYPE_PLAYER, PLAYER_UNREG)) +#define PlayerProtected(x) \ + (IS(x, TYPE_PLAYER, PLAYER_PROTECTED)) /* 0x100000 */ /* If the FIXED flag isn't compiled in, have the check always fail */ #ifdef FIXED_FLAG #define Fixed(x) (Toggles(Owner(x)) & PLAYER_FIXED) /* 0x4000 */ #else @@ -145,18 +147,25 @@ /******* Thing toggles */ #define DestOk(x) (IS(x, TYPE_THING, THING_DEST_OK)) #define Puppet(x) (IS(x, TYPE_THING, THING_PUPPET)) #define NoLeave(x) (IS(x, TYPE_THING, THING_NOLEAVE)) #define ThingListen(x) (IS(x, TYPE_THING, THING_LISTEN)) +#define ThingInhearit(x) \ + (IS(x, TYPE_THING, THING_INHEARIT)) /* 0x80 */ +#define ThingProtected(x) \ + (IS(x, TYPE_THING, THING_PROTECTED)) /* 0x100 */ /******* Room toggles */ #define Floating(x) (IS(x, TYPE_ROOM, ROOM_FLOATING)) /* 0x8 */ #define Abode(x) (IS(x, TYPE_ROOM, ROOM_ABODE)) /* 0x10 */ #define JumpOk(x) (IS(x, TYPE_ROOM, ROOM_JUMP_OK)) /* 0x20 */ #define NoTel(x) (IS(x, TYPE_ROOM, ROOM_NO_TEL)) /* 0x40 */ #define RoomListen(x) (IS(x, TYPE_ROOM, ROOM_LISTEN)) /* 0x100 */ #define ZTel(x) (IS(x, TYPE_ROOM, ROOM_Z_TEL)) /* 0x200 */ +#define RoomInhearit(x) (IS(x, TYPE_ROOM, ROOM_INHEARIT)) /* 0x400 */ +#define RoomProtected(x) \ + (IS(x, TYPE_ROOM, ROOM_PROTECTED)) /* 0x800 */ #ifdef UNINSPECTED_FLAG #define Uninspected(x) (IS(x, TYPE_ROOM, ROOM_UNINSPECT)) /* 0x1000 */ #else #define Uninspected(x) 0 @@ -192,10 +201,14 @@ #define Sticky(x) (Flags(x) & STICKY) #define Transparented(x) (Flags(x) & TRANSPARENTED) #define Unfind(x) (Flags(x) & UNFIND) #define Verbose(x) (Flags(x) & VERBOSE) #define Visual(x) (Flags(x) & VISUAL) + +/* Flags that some but not all things can have */ +#define Protected(x) (ThingProtected(x) || RoomProtected(x) \ + || PlayerProtected(x)) /* Non-mortal checks */ #define God(x) ((x) == GOD) #ifdef ROYALTY_FLAG #define Royalty(x) (Flags(x) & ROYALTY) diff -u5r pennmush-vanilla/hdrs/flags.h pennmush-changed/hdrs/flags.h --- pennmush-vanilla/hdrs/flags.h Sun Jul 18 10:12:55 1999 +++ pennmush-changed/hdrs/flags.h Sun Aug 1 14:36:43 1999 @@ -127,18 +127,23 @@ #ifdef EXTENDED_ANSI #define PLAYER_COLOR 0x80000 /* ANSI color ok */ #define PLAYER_FORCEWHITE 0x100000 /* Force ansi_white after output */ #endif +#define PLAYER_INCHARACTER 0x200000 /* IC/OOF marker flag */ +#define PLAYER_PROTECTED 0x400000 /* Protected from viewing/changing */ + /*-------------------------------------------------------------------------- * Thing flags */ #define THING_DEST_OK 0x8 /* can be destroyed by anyone */ #define THING_PUPPET 0x10 /* echoes to its owner */ #define THING_LISTEN 0x20 /* checks for ^ patterns */ #define THING_NOLEAVE 0x40 /* Can't be left */ +#define THING_INHEARIT 0x80 /* checks parent chain for ^ patterns */ +#define THING_PROTECTED 0x100 /* Protected from viewing/changing */ /*-------------------------------------------------------------------------- * Room flags */ @@ -155,10 +160,13 @@ #define ROOM_LISTEN 0x100 /* checks for ^ patterns */ #define ROOM_Z_TEL 0x200 /* If set on a room, players may * only @tel to another room in the * same zone */ +#define ROOM_INHEARIT 0x400 /* checks parent chain for ^ patterns */ +#define ROOM_PROTECTED 0x800 /* Protected from viewing/changing */ + #ifdef UNINSPECTED_FLAG #define ROOM_UNINSPECT 0x1000 /* Not inspected */ #endif diff -u5r pennmush-vanilla/hdrs/mushdb.h pennmush-changed/hdrs/mushdb.h --- pennmush-vanilla/hdrs/mushdb.h Sun Jul 18 10:13:02 1999 +++ pennmush-changed/hdrs/mushdb.h Sun Aug 1 14:52:30 1999 @@ -72,11 +72,12 @@ (controls(p,x) || nearby(p,x) || See_All(p) \ || (PLAYER_LOCATE && (IsPlayer(x) && !Unfind(x) \ && !Unfind(Location(x))))) -#define Can_Examine(p,x) (controls(p,x) || See_All(p) || Visual(x)) +#define Can_Examine(p,x) (controls(p,x) || (See_All(p) && !Protected(x)) \ + || Visual(x)) #define can_link(p,x) (controls(p,x) || \ (IsExit(x) && (Location(x) == NOTHING))) /* Can p link an exit to x? */ #define can_link_to(p,x) \ @@ -85,11 +86,11 @@ && (!NO_LINK_TO_OBJECT || IsRoom(x))) /* can p access attribute a on object x? */ #define Can_Read_Attr(p,x,a) \ (!((a)->flags & AF_INTERNAL) && \ - (See_All(p) || \ + ((See_All(p) && !Protected(x)) || \ (!((a)->flags & AF_MDARK) && \ (controls(p,x) || ((a)->flags & AF_VISUAL) || Visual(x) || \ (Owner((a)->creator) == Owner(p)))))) /* can p write attribute a on object x, assuming p may modify x? diff -u5r pennmush-vanilla/src/attrib.c pennmush-changed/src/attrib.c --- pennmush-vanilla/src/attrib.c Sun Jul 18 10:13:10 1999 +++ pennmush-changed/src/attrib.c Sat Jul 31 18:53:07 1999 @@ -746,11 +746,15 @@ if (type == '$') { flag_mask = AF_COMMAND; parent_depth = GoodObject(Parent(thing)); } else { flag_mask = AF_LISTEN; - parent_depth = 0; + if (ThingInhearit(thing) || RoomInhearit(thing)) { + parent_depth = GoodObject(Parent(thing)); + } else { + parent_depth = 0; + } } match = 0; if (!atr_hash_initialized) atr_hash_init(); diff -u5r pennmush-vanilla/src/flags.c pennmush-changed/src/flags.c --- pennmush-vanilla/src/flags.c Sun Jul 18 10:13:25 1999 +++ pennmush-changed/src/flags.c Sun Aug 1 15:52:16 1999 @@ -149,25 +149,31 @@ #ifdef VACATION_FLAG {"ON-VACATION", 'o', TYPE_PLAYER, PLAYER_VACATION, F_ANY, F_ANY}, #endif {"SUSPECT", 's', TYPE_PLAYER, PLAYER_SUSPECT, F_WIZARD | F_MDARK, F_WIZARD | F_MDARK}, + {"IC", 'i', TYPE_PLAYER, PLAYER_INCHARACTER, F_WIZARD, F_WIZARD}, + {"PROTECTED", '+', TYPE_PLAYER, PLAYER_PROTECTED, F_GOD, F_GOD}, {"MONITOR", 'M', TYPE_THING, THING_LISTEN, F_ANY, F_ANY}, {"DESTROY_OK", 'd', TYPE_THING, THING_DEST_OK, F_ANY, F_ANY}, {"PUPPET", 'p', TYPE_THING, THING_PUPPET, F_ANY, F_ANY}, {"NO_LEAVE", 'N', TYPE_THING, THING_NOLEAVE, F_ANY, F_ANY}, + {"LISTEN_PARENT", '^', TYPE_THING, THING_INHEARIT, F_ANY, F_ANY}, + {"PROTECTED", '+', TYPE_THING, THING_PROTECTED, F_GOD, F_GOD}, {"ABODE", 'A', TYPE_ROOM, ROOM_ABODE, F_ANY, F_ANY}, {"FLOATING", 'F', TYPE_ROOM, ROOM_FLOATING, F_ANY, F_ANY}, {"JUMP_OK", 'J', TYPE_ROOM, ROOM_JUMP_OK, F_ANY, F_ANY}, {"MONITOR", 'M', TYPE_ROOM, ROOM_LISTEN, F_ANY, F_ANY}, + {"LISTEN_PARENT", '^', TYPE_ROOM, ROOM_INHEARIT, F_ANY, F_ANY}, {"Z_TEL", 'Z', TYPE_ROOM, ROOM_Z_TEL, F_ANY, F_ANY}, {"NO_TEL", 'N', TYPE_ROOM, ROOM_NO_TEL, F_ANY, F_ANY}, #ifdef UNINSPECTED_FLAG {"UNINSPECTED", 'u', TYPE_ROOM, ROOM_UNINSPECT, F_ROYAL, F_ROYAL}, #endif + {"PROTECTED", '+', TYPE_ROOM, ROOM_PROTECTED, F_GOD, F_GOD}, {"CLOUDY", 'x', TYPE_EXIT, EXIT_CLOUDY, F_ANY, F_ANY}, {"ACCESSED", '\0', NOTYPE, ACCESSED, F_INTERNAL | F_DARK, F_INTERNAL | F_DARK}, @@ -435,10 +441,25 @@ {"UNINSP", "UNINSPECTED"}, {"UNINS", "UNINSPECTED"}, {"UNIN", "UNINSPECTED"}, {"UNI", "UNINSPECTED"}, #endif + {"LISTEN_PAREN", "LISTEN_PARENT"}, + {"LISTEN_PARE", "LISTEN_PARENT"}, + {"LISTEN_PAR", "LISTEN_PARENT"}, + {"LISTEN_PA", "LISTEN_PARENT"}, + {"LISTEN_P", "LISTEN_PARENT"}, + {"LISTEN_", "LISTEN_PARENT"}, + {"^", "LISTEN_PARENT"}, + {"PROTECTE", "PROTECTED"}, + {"PROTECT", "PROTECTED"}, + {"PROTEC", "PROTECTED"}, + {"PROTE", "PROTECTED"}, + {"PROT", "PROTECTED"}, + {"PRO", "PROTECTED"}, + {"PR", "PROTECTED"}, + {"+", "PROTECTED"}, {NULL, NULL} }; /* Name Flag */ @@ -562,11 +583,11 @@ return 0; if ((flagp->type != NOTYPE) && (flagp->type != Typeof(thing))) return 0; - if ((myperms & F_INHERIT) && !Wizard(player) && + if ((myperms & F_INHERIT ) && !Wizard(player) && (!Inheritable(player) || !Owns(player, thing))) return 0; /* You've got to *own* something (or be Wizard) to set it * chown_ok or dest_ok. This prevents subversion of the @@ -968,15 +989,23 @@ *p_toggle = toggle; *p_type = type; return 1; } -static FLAG mon_table[] = +/* + * Extended to allow all multi-type toggles + */ +static FLAG hack_table[] = { {"MONITOR", 'M', TYPE_PLAYER, PLAYER_MONITOR, F_ROYAL}, {"MONITOR", 'M', TYPE_THING, THING_LISTEN, F_ANY}, {"MONITOR", 'M', TYPE_ROOM, ROOM_LISTEN, F_ANY}, + {"LISTEN_PARENT", '^', TYPE_THING, THING_INHEARIT, F_ANY, F_ANY}, + {"LISTEN_PARENT", '^', TYPE_ROOM, ROOM_INHEARIT, F_ANY, F_ANY}, + {"PROTECTED", '+', TYPE_PLAYER, PLAYER_PROTECTED, F_GOD, F_GOD}, + {"PROTECTED", '+', TYPE_THING, THING_PROTECTED, F_GOD, F_GOD}, + {"PROTECTED", '+', TYPE_ROOM, ROOM_PROTECTED, F_GOD, F_GOD}, {NULL, '\0', 0, 0, 0} }; void set_flag(player, thing, flag, negate, hear, listener) @@ -987,23 +1016,25 @@ int hear; int listener; { /* attempt to set a flag on an object */ - FLAG *f; + FLAG *f, *o; char tbuf1[BUFFER_LEN]; if ((f = flag_hash_lookup(strupper(flag))) == NULL) { notify(player, "I don't recognize that flag."); return; } /* HORRIBLE HACK: added to make MONITOR work. This needs to * be fixed in the future, _somehow_... */ - if (!strcmp(f->name, "MONITOR")) { - for (f = mon_table; f->name != NULL; f++) - if (Typeof(thing) == f->type) + if (!strcmp(f->name, "MONITOR") || !strcmp(f->name, "LISTEN_PARENT") + || !strcmp(f->name, "PROTECTED")) { + o = f; + for (f = hack_table; f->name != NULL; f++) + if ((Typeof(thing) == f->type) && !strcmp(f->name, o->name)) break; if (f->name == NULL) { notify(player, "Permission denied."); return; } diff -u5r pennmush-vanilla/src/predicat.c pennmush-changed/src/predicat.c --- pennmush-vanilla/src/predicat.c Sun Jul 18 10:13:43 1999 +++ pennmush-changed/src/predicat.c Sun Aug 1 13:50:38 1999 @@ -315,11 +315,14 @@ */ if (!GoodObject(what)) return 0; - if (God(what) && !God(who)) + if (God(who)) + return 1; + + if (God(what) || (Protected(what) && !Owns(who,what)) ) return 0; if (Wizard(who)) return 1;