This is patch28 to PennMUSH 1.7.7. After applying this patch, you will have version 1.7.7p28 To apply this patch, save it to a file in your top-level MUSH directory, and do the following: patch -p1 < 1.7.7-patch28 cp src/local.dst src/local.c (See *** below first) cp src/cmdlocal.dst src/cmdlocal.c (See *** below first) make install If you use GNU patch 2.2, you probably want the above to be 'patch -b -p1', not just 'patch -p1'. *** If you've hacked src/local.c, you know enough not to copy local.dst *** over it, but you'll need to merge the local.dst changes into your *** local.c. Same for cmdlocal.dst Unix (or cygwin) users need not worry about failed hunks in src/switchinc.c, hdrs/switches.h, hdrs/cmds.h, or hdrs/funs.h. These files are automatically rebuilt on compile. On the off chance they appear not to be, simply rm them and re-run make. Then @shutdown and restart your MUSH. - Alan/Javelin In this patch: Major changes: * You can add customized configuration parameters to set in mush.cnf by adding a couple of new lines into the local_configs() function in local.c. (YOU MUST UPDATE YOUR local.c FROM local.dst IN THIS PATCHLEVEL). Patch by grapenut@M*U*S*H. * Object ids: An object id is the string "#dbref:ctime" where #dbref is the object's dbref and ctime is its creation time in integer format. The %: substitution returns this id for the enactor, and the objid() function returns it for an arbitrary object. Object ids can be used in place of softcode that stores dbrefs to insure that a recycled dbref isn't used in place of the intended one. The matcher code will also match objects by id any time it's matching by dbref. * @command/add and @command/del. You can add a custom command (which will have the same precedence as a standard server command), and then @hook it to softcode, effectively promoting the precedence of softcoded globals, and letting them take advantage of some command parser settings. Patch by Walker@M*U*S*H. Functions: * tr() accepts ranges of characters like a-z instead of having to give each one. [SW] * escape() also escapes parens and commas now. Suggested by Philip Mak. [SW] * time() can now take a time offset or object argument (in the latter case, time offset is read from object's TZ attribute). Patch by Walker@M*U*S*H. * vcross() performs cross products of vectors. [SW] * merge() can now take a list of characters. [SW] Minor changes: * You can @set multiple flags at once by giving them as a list. Suggested by Walker@M*U*S*H and others. * Channel names are recognized when surround by <>'s, too. [SW] * 'move' is now a command_alias for 'goto' (in alias.cnf), and not a separate command. * PAGE_LOCK`{,O,A}FAILURE attributes now activated when a page/pemit fails due to the victim's @lock/page. Suggested by Sholevi@M*U*S*H. * Tweaked game message for failing to provide correct password to @password. Suggested by Philip Mak. * New command 'warn_on_missing' (defaults to disabled), aliased to the '[' character. If enabled, players who attempt to write commands starting with functions will get errors. Suggested by [SW] and Cheetah@M*U*S*H. * Renaming something triggers its ONAME and ANAME attributes, if present. The old name is passed as %0; the new as %1. Suggested by Philip Mak. * Owner information on ex/br is reported using the usual object_header() so dbref and flags appear. Suggested by Eratl@M*U*S*H. * Flags that are F_DARK or F_MDARK no longer appear on @flag/list by non-admin. Suggested by Philip Mak. * Warn players who set themselves SHARED with a weak zone lock. Suggested by Philip Mak. [SW] * @halt can now take "here". Suggested by Thor@bDv. * When parsing eqsplit commands, don't evaluate the left side of the equal sign if the command was run with ]. Fixes: * Fixes to robustify file reading on Windows systems. * The 'nofixed' command restriction works as expected now (previously, you had to use 'nofix'). * Exit movements are now translated into explicit GOTO commands, so @hooks and restrictions on GOTO are now applied. Patch by Walker@M*U*S*H. * The AE/ae accent characters can now be produced (accent(a,e)). Patch by Luke@M*U*S*H. * @hook/ignore would double-evaluate arguments. Reported by Ambrosia@M*U*S*H. [SW] * Mingw error in src/Makefile.SH fixed. Report by Thor@bDv. [SW] * Help fixes by Cerekk@bDv, Mike Griffiths, Steve Varley, Thor@bDv, [SW], Dahan, Jason Stover, and Kyieren@M*U*S*H. * cmdlocal.dst now includes flags.h. By Dahan. * Win32 portability fixes by Dahan, Nathan Baum, [EEH]. * utils/mkcmds.sh is now smarter about choosing temp filenames, so parallel make should work. Fixed by Cheetah@M*U*S*H. * The Zone: data in examine could be wrong. Prereq: 1.7.7p27 *** 1_7_7.772/Patchlevel Sun, 25 Jan 2004 20:29:53 -0600 dunemush (pennmush/5_Patchlevel 1.17.1.11.1.29 600) --- 1_7_7.846(w)/Patchlevel Sat, 13 Mar 2004 10:35:42 -0600 dunemush (pennmush/5_Patchlevel 1.17.1.11.1.30 600) *************** *** 1,2 **** Do not edit this file. It is maintained by the official PennMUSH patches. ! This is PennMUSH 1.7.7p27 --- 1,2 ---- Do not edit this file. It is maintained by the official PennMUSH patches. ! This is PennMUSH 1.7.7p28 *** 1_7_7.772/CHANGES.177 Thu, 29 Jan 2004 12:05:49 -0600 dunemush (pennmush/g/23_CHANGES 1.48.1.251 600) --- 1_7_7.846(w)/CHANGES.177 Mon, 15 Mar 2004 14:49:23 -0600 dunemush (pennmush/g/23_CHANGES 1.48.1.258.1.14.1.17 600) *************** *** 18,23 **** --- 18,98 ---- ========================================================================== + Version 1.7.7 patchlevel 28 March 12, 2004 + + Major changes: + * You can add customized configuration parameters to set in mush.cnf + by adding a couple of new lines into the local_configs() function + in local.c. (YOU MUST UPDATE YOUR local.c FROM local.dst IN THIS + PATCHLEVEL). Patch by grapenut@M*U*S*H. + * Object ids: An object id is the string "#dbref:ctime" + where #dbref is the object's dbref and ctime is its creation time + in integer format. The %: substitution returns this + id for the enactor, and the objid() function returns it for an + arbitrary object. Object ids can be used in place of softcode that + stores dbrefs to insure that a recycled dbref isn't used in place + of the intended one. The matcher code will also match objects by + id any time it's matching by dbref. + * @command/add and @command/del. You can add a custom command + (which will have the same precedence as a standard server command), + and then @hook it to softcode, effectively promoting the precedence + of softcoded globals, and letting them take advantage of some + command parser settings. Patch by Walker@M*U*S*H. + Functions: + * tr() accepts ranges of characters like a-z instead of having to + give each one. [SW] + * escape() also escapes parens and commas now. Suggested by Philip Mak. [SW] + * time() can now take a time offset or object argument (in the latter + case, time offset is read from object's TZ attribute). Patch by + Walker@M*U*S*H. + * vcross() performs cross products of vectors. [SW] + * merge() can now take a list of characters. [SW] + Minor changes: + * You can @set multiple flags at once by giving them as a list. + Suggested by Walker@M*U*S*H and others. + * Channel names are recognized when surround by <>'s, too. [SW] + * 'move' is now a command_alias for 'goto' (in alias.cnf), and not + a separate command. + * PAGE_LOCK`{,O,A}FAILURE attributes now activated when a page/pemit fails + due to the victim's @lock/page. Suggested by Sholevi@M*U*S*H. + * Tweaked game message for failing to provide correct password to + @password. Suggested by Philip Mak. + * New command 'warn_on_missing' (defaults to disabled), aliased to the + '[' character. If enabled, players who attempt to write commands + starting with functions will get errors. Suggested by [SW] and + Cheetah@M*U*S*H. + * Renaming something triggers its ONAME and ANAME attributes, if present. + The old name is passed as %0; the new as %1. Suggested by Philip Mak. + * Owner information on ex/br is reported using the usual object_header() + so dbref and flags appear. Suggested by Eratl@M*U*S*H. + * Flags that are F_DARK or F_MDARK no longer appear on @flag/list + by non-admin. Suggested by Philip Mak. + * Warn players who set themselves SHARED with a weak zone lock. + Suggested by Philip Mak. [SW] + * @halt can now take "here". Suggested by Thor@bDv. + * When parsing eqsplit commands, don't evaluate the left side + of the equal sign if the command was run with ]. + Fixes: + * Fixes to robustify file reading on Windows systems. + * The 'nofixed' command restriction works as expected now (previously, + you had to use 'nofix'). + * Exit movements are now translated into explicit GOTO commands, + so @hooks and restrictions on GOTO are now applied. Patch by + Walker@M*U*S*H. + * The AE/ae accent characters can now be produced (accent(a,e)). + Patch by Luke@M*U*S*H. + * @hook/ignore would double-evaluate arguments. Reported by + Ambrosia@M*U*S*H. [SW] + * Mingw error in src/Makefile.SH fixed. Report by Thor@bDv. [SW] + * Help fixes by Cerekk@bDv, Mike Griffiths, Steve Varley, Thor@bDv, [SW], + Dahan, Jason Stover, and Kyieren@M*U*S*H. + * cmdlocal.dst now includes flags.h. By Dahan. + * Win32 portability fixes by Dahan, Nathan Baum, [EEH]. + * utils/mkcmds.sh is now smarter about choosing temp filenames, so + parallel make should work. Fixed by Cheetah@M*U*S*H. + * The Zone: data in examine could be wrong. + + Version 1.7.7 patchlevel 27 January 25, 2004 Minor Changes: *** 1_7_7.772/game/txt/hlp/penntop.hlp Sat, 11 Oct 2003 12:41:43 -0500 dunemush (pennmush/13_penntop.hl 1.2.1.27.1.3.1.2.1.2.1.1.1.1.1.1.1.1.1.12.1.1.1.1.1.5 600) --- 1_7_7.846(w)/game/txt/hlp/penntop.hlp Thu, 26 Feb 2004 16:12:59 -0600 dunemush (pennmush/13_penntop.hl 1.2.1.27.1.3.1.2.1.2.1.1.1.1.1.1.1.1.1.12.1.1.1.1.1.8 600) *************** *** 458,473 **** See also: @link, STICKY, LINK_OK, @lock & %# & %N & ENACTOR The enactor is the object that does something (enacts something :). This is an important concept in MUSH, because the way many commands work will depend on who enters the command (ie, who the enactor is). Any type of object can be an enactor. ! There are two %-substitutions that involve the enactor: %# and %N. The ! first returns the enactor's dbref # and the second returns the enactor's ! name. If, for example, you have an @osucc on an object that includes the ! %N symbol, whenever someone picks up the object, that %N will be replaced with the name of the enactor (the person who typed 'get ' in this case). --- 458,479 ---- See also: @link, STICKY, LINK_OK, @lock & %# & %N + & %~ & ENACTOR The enactor is the object that does something (enacts something :). This is an important concept in MUSH, because the way many commands work will depend on who enters the command (ie, who the enactor is). Any type of object can be an enactor. ! There are five %-substitutions that involve the enactor: ! %# = the enactor's dbref ! %N = the enactor's name, first letter capitalized ! %n = the enactor's name, first letter as-is ! %~ = the enactor's accented name ! %: = the enactor's unique identifier, equivalent to %#:[convtime(ctime(%#))] ! ! If, for example, you have an @osucc on an object that includes the ! %n symbol, whenever someone picks up the object, that %n will be replaced with the name of the enactor (the person who typed 'get ' in this case). *************** *** 586,598 **** take a player or thing, and you don't pass their @lock, you will set off their @fail/@ofail/@afail attributes. If you try to go through an exit, and you don't pass its @lock, you will similarly ! set off its @fail/@ofail/@afail. Many other things can also be locked -- see @lock and locktypes for more information. However, there are failure messages at this time ! only for the above, for failing to enter an object ! (@efail/@oefail/@aefail), and for failing to leave an object ! (@lfail/@lefail/@alfail). See also: @lock, @fail, @efail, @lfail & GENDER --- 592,607 ---- take a player or thing, and you don't pass their @lock, you will set off their @fail/@ofail/@afail attributes. If you try to go through an exit, and you don't pass its @lock, you will similarly ! set off its @fail/@ofail/@afail. Other failure sets include: ! ! Failing to enter an object (@efail, @oefail, @aefail) ! Failing to leave an object (@lfail, @lefail, @alfail) ! Other failures (&`FAILURE, &`OFAILURE, &`AFAILURE) ! where the can be: FOLLOW_LOCK, PAGE_LOCK Many other things can also be locked -- see @lock and locktypes for more information. However, there are failure messages at this time ! only for the above. See also: @lock, @fail, @efail, @lfail & GENDER *************** *** 1491,1498 **** %B = a single space (just like [space(1)]) %R = a blank line %T = A tab. Note that this may not look right on some screens. ! %N = name of the ENACTOR (object that set off the command) ! %# = the ENACTOR's database reference number (continued in help SUBSTITUTIONS2) & SUBSTITUTIONS2 --- 1500,1509 ---- %B = a single space (just like [space(1)]) %R = a blank line %T = A tab. Note that this may not look right on some screens. ! %# = dbref of the ENACTOR (object that set off the command) ! %N = the ENACTOR's name, first letter capitalized ! %n = the ENACTOR's name, first letter as-is ! %~ = the ENACTOR's accented name (continued in help SUBSTITUTIONS2) & SUBSTITUTIONS2 *** 1_7_7.772/game/txt/hlp/pennfunc.hlp Sat, 24 Jan 2004 13:22:12 -0600 dunemush (pennmush/16_pennfunc.h 1.2.1.50.1.1.1.1.1.2.1.7.1.8.1.1.1.1.1.1.1.1.1.1.1.1.1.3.1.1.1.1.1.1.1.1.1.1.1.1.1.9.1.1.1.1.1.3.1.1.1.1.1.1.1.1.1.1.1.1.1.29 600) --- 1_7_7.846(w)/game/txt/hlp/pennfunc.hlp Mon, 15 Mar 2004 14:50:11 -0600 dunemush (pennmush/16_pennfunc.h 1.2.1.50.1.1.1.1.1.2.1.7.1.8.1.1.1.1.1.1.1.1.1.1.1.1.1.3.1.1.1.1.1.1.1.1.1.1.1.1.1.9.1.1.1.1.1.3.1.1.1.1.1.1.1.1.1.1.1.1.1.37 600) *************** *** 126,140 **** See also: DBREF & Information functions ! Information functions return values related to objects. andflags() andlflags() config() controls() ctime() elock() findable() flags() fullname() hasattr() hasattrp() hasflag() haspower() hastype() iname() lflags() lock() lstats() money() mtime() ! name() nattr() nearby() objmem() orflags() ! orlflags() playermem() poll() powers() quota() ! type() visible() & Mail functions Mail functions work with @mail. --- 126,141 ---- See also: DBREF & Information functions ! Information functions return values related to objects or the game. andflags() andlflags() config() controls() ctime() elock() findable() flags() fullname() hasattr() hasattrp() hasflag() haspower() hastype() iname() lflags() lock() lstats() money() mtime() ! mudname() name() nattr() nearby() objid() ! objmem() orflags() orlflags() playermem() poll() ! powers() quota() restarts() type() version() ! visible() & Mail functions Mail functions work with @mail. *************** *** 175,182 **** These functions operate on n-dimensional vectors. A vector is a delimiter-separated list of numbers (space-separated, by default): ! vadd() vdim() vdot() vmag() vmax() ! vmin() vmul() vsub() vunit() & Regular expression functions This functions take a regular expression (regexp, or re) and match it against assorted things. --- 176,183 ---- These functions operate on n-dimensional vectors. A vector is a delimiter-separated list of numbers (space-separated, by default): ! vadd() vcross() vdim() vdot() vmag() ! vmax() vmin() vmul() vsub() vunit() & Regular expression functions This functions take a regular expression (regexp, or re) and match it against assorted things. *************** *** 208,215 **** These functions return times or format times. convsecs() convutcsecs() convtime() ctime() etimefmt() ! isdaylight() mtime() restarts() restarttime() secs() ! starttime() time() timefmt() timestring() utctime() & Utility functions These functions don't quite fit into any other category. --- 209,216 ---- These functions return times or format times. convsecs() convutcsecs() convtime() ctime() etimefmt() ! isdaylight() mtime() restarttime() secs() starttime() ! time() timefmt() timestring() utctime() & Utility functions These functions don't quite fit into any other category. *************** *** 217,227 **** allof() ansi() atrlock() beep() checkpass() clone() create() die() dig() firstof() functions() isdbref() isint() isnum() isword() ! localize() link() list() lnum() mudname() ! null() objeval() open() pcreate() r-function ! rand() restarts() s-function scan() set() ! setq() setr() soundex() soundslike() tel() ! textfile() valid() version() wipe() @@() & @@() & NULL() --- 218,228 ---- allof() ansi() atrlock() beep() checkpass() clone() create() die() dig() firstof() functions() isdbref() isint() isnum() isword() ! localize() link() list() lnum() null() ! objeval() open() pcreate() r-function rand() ! s-function scan() set() setq() setr() ! soundex() soundslike() tel() textfile() valid() ! wipe() @@() & @@() & NULL() *************** *** 1087,1093 **** preventing function evaluation in the next pass of the parser. It returns after adding the escape character ('\') at the beginning of the string, and before the following characters: ! % ; [ ] { } \ This function prevents strings entered by players from causing side effects, such as performing an unintended GET() of an attribute. It --- 1088,1094 ---- preventing function evaluation in the next pass of the parser. It returns after adding the escape character ('\') at the beginning of the string, and before the following characters: ! % ; [ ] { } \ ( ) , This function prevents strings entered by players from causing side effects, such as performing an unintended GET() of an attribute. It *************** *** 1493,1499 **** HASTYPE() function. If an attribute is given, checks to see if the attribute has the ! given attribute flag. See help @set2 for attribute flag names. See also: orlflags(), andlflags(), orflags(), andflags() & HASPOWER() --- 1494,1500 ---- HASTYPE() function. If an attribute is given, checks to see if the attribute has the ! given attribute flag. See help attribute flags for attribute flag names. See also: orlflags(), andlflags(), orflags(), andflags() & HASPOWER() *************** *** 2303,2326 **** member() is case-sensitive and requires an exact match. For wild card patterns, use match(). & MERGE() ! merge(, , ) ! This function merges and , depending on . ! If a character in is the same as , it is replaced ! by the character in the corresponding position in . The two ! strings must be of the same length. Example: > say [merge(AB--EF,abcdef,-)] You say, "ABcdEF" ! Spaces need to be treated specially. A null character is considered to ! equal a space, for . Example: > say [merge(AB[space(2)]EF,abcdef,)] You say, "ABcdEF" ! & MID() mid(, , ) --- 2304,2328 ---- member() is case-sensitive and requires an exact match. For wild card patterns, use match(). & MERGE() ! merge(, , ) ! This function merges and , depending on . ! If a character in is the same as one in , it is ! replaced by the character in the corresponding position in . The ! two strings must be of the same length. Example: > say [merge(AB--EF,abcdef,-)] You say, "ABcdEF" ! Spaces need to be treated specially. An empty argument is considered to ! equal a space, for . Example: > say [merge(AB[space(2)]EF,abcdef,)] You say, "ABcdEF" ! ! See also: TR() & MID() mid(, , ) *************** *** 2571,2576 **** --- 2573,2590 ---- This function is useful for securing objects which need to evaluate attributes on things owned by others. + & OBJID() + objid() + + This function returns the object id, a value which uniquely identifies + it for the life of the MUSH. The object id is the object's dbref, + a colon character, and the object's creation time, in seconds since + the epoch. + + The object id can be used nearly anywhere the dbref can, and ensures + that if an object's dbref is recycled, the new object won't be mistaken + for the old object. + & OBJMEM() objmem() *************** *** 3570,3575 **** --- 3584,3591 ---- & UTCTIME() time([utc]) utctime() + time() + time() time() gives you the current time on the MUSH. WARNING! This is the time on the machine that the mush is running *************** *** 3578,3583 **** --- 3594,3607 ---- utctime() and time(utc) give the same time in UTC (Aka GMT), not the server's local timezone. + If a timezone (-24 to +24) is given, it adds that many hours to UTC + to return the correct timezone. Timezone may contain decimals (-1.5) + + If is given, and is a valid object containing an attribute + TZ, it modifies the resulting time according to said timezone. time() + on a player will always return a time, and if TZ is not a number between + -24 and +24 inclusive, the time returned is UTC. + See also: timefmt(), timestring(), convsecs(), convtime() & ETIMEFMT() etimefmt([, ]) *************** *** 3678,3694 **** tr(,,) This function translates every character in that exists in ! to the character at an identical position in . ! and must be the same length. If a character exists more than ! once in , only the first instance will be counted. The example ! below is the common ROT-13 algorithm for lower case strings. Examples: > say tr(hello,abcdefghijklmnopqrstuvwxyz,nopqrstuvwxyzabcdefghijklm) You say, "uryyb" ! > say tr(uryyb,abcdefghijklmnopqrstuvwxyz,nopqrstuvwxyzabcdefghijklm) You say, "hello" & TRIM() trim([,][,]) trimpenn([,][,]) --- 3702,3723 ---- tr(,,) This function translates every character in that exists in ! to the character at an identical position in . Ranges of ! characters seperated by -'s are accepted. and must be the ! same length after expansion of ranges. If a character exists more than ! once in , only the last instance will be counted. The example ! below is the common ROT-13 algorithm for lower case strings, demonstrated ! with every letter explicitly listed, and with the equivalent but briefer ! character ranges. Literal -'s can be in and if they are the ! first or last characters in the arguments. Examples: > say tr(hello,abcdefghijklmnopqrstuvwxyz,nopqrstuvwxyzabcdefghijklm) You say, "uryyb" ! > say tr(uryyb, a-z, n-za-m) You say, "hello" + See also: MERGE() & TRIM() trim([,][,]) trimpenn([,][,]) *************** *** 3888,3894 **** --- 3917,3934 ---- 1 > think valid(attrname,Foo bar) 0 + & VCROSS() + vcross(, [, ]) + + Returns the 3-dimensional vector that is the cross product of its + 3-dimensional argument vectors. The cross product is defined as: + + x = Ay * Bz - By * Az + y = Az * Bx - Bz * Ax + z = Ax * By - Bx * Ay + > think vcross(4 5 6, 7 8 9) + -3 6 -3 & VDIM() vdim([,]) *************** *** 3922,3928 **** corresponding pair of numbers from the two vectors. The vectors must be of the same length. ! > think vmin(1 2 3, 4 1 2) 4 2 3 & VERSION() --- 3962,3968 ---- corresponding pair of numbers from the two vectors. The vectors must be of the same length. ! > think vmax(1 2 3, 4 1 2) 4 2 3 & VERSION() *** 1_7_7.772/game/txt/hlp/pennflag.hlp Sun, 19 Oct 2003 10:34:41 -0500 dunemush (pennmush/17_pennflag.h 1.1.1.1.1.2.1.1.1.2.1.1.1.2.1.1.2.1.2.1.1.1.1.2.1.4.1.2.2.9 600) --- 1_7_7.846(w)/game/txt/hlp/pennflag.hlp Wed, 10 Mar 2004 16:38:03 -0600 dunemush (pennmush/17_pennflag.h 1.1.1.1.1.2.1.1.1.2.1.1.1.2.1.1.2.1.2.1.1.1.1.2.1.4.1.2.2.13 600) *************** *** 41,51 **** A - Abode, Ansi C - Chown_Ok, Color D - Dark E - Exit (type) F - Floating, Fixed G - Going H - Haven I - Trust/Inherit J - Jump_Ok, Judge ! L - Link_Ok M - Monitor N - Nospoof, No_Tel, No_Leave O - Opaque P - Player (type) Q - Quiet ! R - Room (type) S - Sticky U - Unfindable ! V - Visual W - Wizard X - Safe ! Z - Shared, Z_Tel a - Audible b - Debug c - Connected d - Destroy_Ok e - Enter_Ok g - Gagged --- 41,51 ---- A - Abode, Ansi C - Chown_Ok, Color D - Dark E - Exit (type) F - Floating, Fixed G - Going H - Haven I - Trust/Inherit J - Jump_Ok, Judge ! L - Link_Ok M - Monitor N - No_Tel, No_Leave O - Opaque P - Player (type) Q - Quiet ! R - Room (type) S - Sticky T - Thing (type) ! U - Unfindable V - Visual W - Wizard ! X - Safe Z - Shared, Z_Tel a - Audible b - Debug c - Connected d - Destroy_Ok e - Enter_Ok g - Gagged *************** *** 55,60 **** --- 55,61 ---- s - Suspect t - Transparent u - Uninspected v - Verbose w - No_Warn x - Terse, Cloudy ? - Unregistered ^ - Listen_Parent ~ - Noaccents + " - NoSpoof --------------------------------------------------------------------- Some flags may not be enabled on some MUSHes. @flag/list will show which are available. *************** *** 211,223 **** Because the parser does recursive evaluations, you will see successive messages evaluating specific parts of an expression. This enables you to pinpoint exactly which evaluation is going wrong. Objects run under this flag are computationally expensive. Avoid leaving it set on objects. It can also generate huge amounts of spam from the output. - - See "help DEBUG2" for more. - & DEBUG2 Create test, and set it DEBUG. --- 212,226 ---- Because the parser does recursive evaluations, you will see successive messages evaluating specific parts of an expression. This enables you to pinpoint exactly which evaluation is going wrong. + + To add a target to an object's DEBUGFORWARDLIST, the object must + pass the target's @lock/forward, or control the target. + See "help DEBUG2" for more. + & DEBUG2 Objects run under this flag are computationally expensive. Avoid leaving it set on objects. It can also generate huge amounts of spam from the output. Create test, and set it DEBUG. *************** *** 555,563 **** Flag: QUIET (all types) This flag when set on yourself prevents you from hearing ! the 'set', 'triggered', or 'Teleported.' messages from any objects ! you own. When set on an object, only that object will not relay ! its messages. & ROOM Flag: ROOM (rooms) --- 558,566 ---- Flag: QUIET (all types) This flag when set on yourself prevents you from hearing ! the 'set', 'triggered', 'Teleported.', and several other messages ! from any objects you own. When set on an object, only that object ! will not relay its messages. & ROOM Flag: ROOM (rooms) *** 1_7_7.772/game/txt/hlp/penncmd.hlp Mon, 15 Dec 2003 13:55:13 -0600 dunemush (pennmush/18_penncmd.hl 1.2.1.1.1.47.1.1.1.1.1.3.1.4.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.10.1.1.1.1.1.1.1.1.1.1.1.12 600) --- 1_7_7.846(w)/game/txt/hlp/penncmd.hlp Mon, 15 Mar 2004 12:34:12 -0600 dunemush (pennmush/18_penncmd.hl 1.2.1.1.1.47.1.1.1.1.1.3.1.4.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.10.1.1.1.1.1.1.1.1.1.1.1.18 600) *************** *** 569,576 **** --- 569,622 ---- /enable : Enable the /on : Synonym for /enable /quiet : Don't make noisy output when doing one of the above + /add : Creates a useless command. @hook/override it. + /delete : Deletes a command added by @command/add See HELP RESTRICT for more. + (continued in help @command2) + & @command2 + @command/add and @command/delete are powerful tools in that they let + you write $-commands which may or may not parse their arguments, and + have the precedence of a built-in command, being checked before + $-commands on objects. Only God may use these switches. + + Additional switches are used in @command that only apply when used + with @command/add. These switches are: + + /noeval : The command does not evaluate arguments passed to it. + /eqsplit : The parser parses leftside and rightside + /lsargs : Comma-separated arguments on the left side are parsed. + /rsargs : In conjunction with eqsplit, the right-side arguments, + comma-separated, are parsed individually and passed + to the $-command in @hook/override. + + Any command added without the /noeval switch is provided with the + /noeval switch itself, so if you @command/add foo, then foo's arguments + are parsed by default, but you can call foo/noeval. Note: the $-command + needs to make allowances for the /noeval switch in it's matching. + + (examples in help @command3) + & @command3 + Examples: + + > @create Dining Machine + > &eat dining=$eat *:@remit %L=%N takes a bite of %0. + > @command/add/noeval eat + > @hook/override eat=dining machine,eat + > eat meat loaf + Walker takes a bite of meat loaf. + > eat randword(apple tomato pear) + Walker takes a bite of randword(apple tomato pear) + + > &drink dining=$^drink(/noeval)? (.*)$:@remit %L=%N drinks %1. + > @set dining/drink=regexp + > @command/add drink + > @hook/override drink=dining machine,drink + > drink reverse(tea) + Walker drinks aet. + > drink/noeval reverse(tea) + Walker drinks reverse(tea). + & @comment @comment = *************** *** 1677,1684 **** Switches include: /motd : Alias for @listmotd, shows current messages of the day. /functions : Alias for @config/functions, shows all functions ! /commands : Alias for @config/commands, shows all commands ! /attribs : Alias for @config/attribs, shows all standard attribs /lowercase : Show whatever you're showing in lowercase, rather than upper. & @listmotd @listmotd --- 1723,1731 ---- Switches include: /motd : Alias for @listmotd, shows current messages of the day. /functions : Alias for @config/functions, shows all functions ! /commands : Alias for @config/commands, shows all commands ! /attribs : Alias for @config/attribs, shows all standard attribs ! /flags : Alias for @flag/list, shows all flags /lowercase : Show whatever you're showing in lowercase, rather than upper. & @listmotd @listmotd *************** *** 2094,2099 **** --- 2141,2149 ---- names, the name should be enclosed in quotes: @name me = "James Bond" + Changing the name of will cause object to execute its + ONAME and ANAME. The old name will be passed at %0 to these; + the new name will be passed as %1. & @newpassword @newpassword = *************** *** 2741,2754 **** See also: @switch, switch() & @set ! @set =[!] @ = @set =: @set /=[!] ! The first form sets (or unsets) a flag on . See 'help flags'. Ex: @set me=VISUAL Flags may be specified by full name (recommended) or by flag character. The second form sets a pre-defined attribute on Ex: @fail Heavy Box=You can't pick that up. --- 2791,2805 ---- See also: @switch, switch() & @set ! @set =[!] [[!] ...] @ = @set =: @set /=[!] ! The first form sets (or unsets) flag(s) on . See 'help flags'. Ex: @set me=VISUAL Flags may be specified by full name (recommended) or by flag character. + Flags are set or reset in the order supplied. The second form sets a pre-defined attribute on Ex: @fail Heavy Box=You can't pick that up. *************** *** 3696,3701 **** --- 3747,3754 ---- will send the message to the last person paged. You cannot page a player if they are set HAVEN or if you do not pass their @lock/page. + In the latter case, the player's PAGE_LOCK`FAILURE, PAGE_LOCK`OFAILURE, + and PAGE_LOCK`AFAILURE attributes will be activated if set. Examples: > page airwolf=hi there! *** 1_7_7.772/game/mushcnf.dst Thu, 13 Nov 2003 07:48:17 -0600 dunemush (pennmush/41_mushcnf.ds 1.1.1.19.1.1.1.2.1.1.1.8.1.1.1.1.1.20 600) --- 1_7_7.846(w)/game/mushcnf.dst Tue, 17 Feb 2004 15:45:19 -0600 dunemush (pennmush/41_mushcnf.ds 1.1.1.19.1.1.1.2.1.1.1.8.1.1.1.1.1.21 600) *************** *** 350,359 **** # How often should we run a dbck to check db consistency? (seconds) dbck_interval 9m59s ! # If you've got USE_WARNINGS defined, set this to the number ! # of seconds between MUSH-wide topology ! # warning checks. Default is 3600 (1 hour). If you set this to 0, ! # timed MUSH-wide checks will be disabled. warn_interval 1h # If compiled with FLOATING_POINTS support, this controls the --- 350,358 ---- # How often should we run a dbck to check db consistency? (seconds) dbck_interval 9m59s ! # How often should we perform topology warning checks? ! # Default is 1 hour. If you set this to 0, timed MUSH-wide checks ! # will be disabled, but players can still use @wcheck. warn_interval 1h # If compiled with FLOATING_POINTS support, this controls the *** 1_7_7.772/utils/mkcmds.sh.SH Tue, 23 Sep 2003 20:11:09 -0500 dunemush (pennmush/g/16_mkcmds.sh. 1.3.1.3 750) --- 1_7_7.846(w)/utils/mkcmds.sh.SH Sun, 29 Feb 2004 21:02:58 -0600 dunemush (pennmush/g/16_mkcmds.sh. 1.3.1.4 750) *************** *** 64,87 **** pat=`$echo $pat` fi ! rm -f ../hdrs/temp.h ! rm -f ../src/temp.c ! $echo "/* AUTOGENERATED FILE. DO NOT EDIT */" > ../hdrs/temp.h ! $echo "#ifndef _PATCH_H" >> ../hdrs/temp.h ! $echo "#define _PATCH_H" >> ../hdrs/temp.h if [ "X$pat" = "X" ]; then ! $echo "#undef PATCHES" >> ../hdrs/temp.h else ! $echo "#define PATCHES \"$pat\"" >> ../hdrs/temp.h fi ! $echo "#endif /* _PATCH_H */" >> ../hdrs/temp.h ! cmp -s ../hdrs/patches.h ../hdrs/temp.h cmpstat=$? if [ $cmpstat -eq 0 ]; then ! rm -f ../hdrs/temp.h else ! mv -f ../hdrs/temp.h ../hdrs/patches.h fi ;; --- 64,87 ---- pat=`$echo $pat` fi ! rm -f ../hdrs/temp.$$.h ! rm -f ../src/temp.$$.c ! $echo "/* AUTOGENERATED FILE. DO NOT EDIT */" > ../hdrs/temp.$$.h ! $echo "#ifndef _PATCH_H" >> ../hdrs/temp.$$.h ! $echo "#define _PATCH_H" >> ../hdrs/temp.$$.h if [ "X$pat" = "X" ]; then ! $echo "#undef PATCHES" >> ../hdrs/temp.$$.h else ! $echo "#define PATCHES \"$pat\"" >> ../hdrs/temp.$$.h fi ! $echo "#endif /* _PATCH_H */" >> ../hdrs/temp.$$.h ! cmp -s ../hdrs/patches.h ../hdrs/temp.$$.h cmpstat=$? if [ $cmpstat -eq 0 ]; then ! rm -f ../hdrs/temp.$$.h else ! mv -f ../hdrs/temp.$$.h ../hdrs/patches.h fi ;; *************** *** 89,108 **** $echo "Rebuilding command switch file" snum=1 ! $echo "/* AUTOGENERATED FILE. DO NOT EDIT */" > ../src/temp.c ! $echo "/* AUTOGENERATED FILE. DO NOT EDIT */" > ../hdrs/temp.h ! $echo "SWITCH_VALUE switch_list[] = {" >> ../src/temp.c for s in `cat ../src/SWITCHES | sort`; do ! $echo "#define SWITCH_$s $snum" >> ../hdrs/temp.h ! $echo $n " {$c" >> ../src/temp.c ! $echo $n "\"$s\", SWITCH_$s$c" >> ../src/temp.c ! $echo $n "}$c" >> ../src/temp.c ! $echo "," >> ../src/temp.c $echo $n "." snum=`expr $snum + 1` done ! $echo " {NULL, 0}" >> ../src/temp.c ! $echo "};" >> ../src/temp.c $echo "" # NUM_BYTES from command.h * 8. --- 89,108 ---- $echo "Rebuilding command switch file" snum=1 ! $echo "/* AUTOGENERATED FILE. DO NOT EDIT */" > ../src/temp.$$.c ! $echo "/* AUTOGENERATED FILE. DO NOT EDIT */" > ../hdrs/temp.$$.h ! $echo "SWITCH_VALUE switch_list[] = {" >> ../src/temp.$$.c for s in `cat ../src/SWITCHES | sort`; do ! $echo "#define SWITCH_$s $snum" >> ../hdrs/temp.$$.h ! $echo $n " {$c" >> ../src/temp.$$.c ! $echo $n "\"$s\", SWITCH_$s$c" >> ../src/temp.$$.c ! $echo $n "}$c" >> ../src/temp.$$.c ! $echo "," >> ../src/temp.$$.c $echo $n "." snum=`expr $snum + 1` done ! $echo " {NULL, 0}" >> ../src/temp.$$.c ! $echo "};" >> ../src/temp.$$.c $echo "" # NUM_BYTES from command.h * 8. *************** *** 110,134 **** $echo "You have too many switches defined!" fi ! mv -f ../hdrs/temp.h ../hdrs/switches.h ! mv -f ../src/temp.c ../src/switchinc.c ;; commands) $echo "Rebuilding command prototype file" ! $echo "/* AUTOGENERATED FILE. DO NOT EDIT */" > ../hdrs/temp.h for c in `grep "^COMMAND *(" ../src/*.c | grep -v cmd_local_silly | cut -f2 -d\( | cut -f1 -d\) | sort | uniq`; do ! $echo >>../hdrs/temp.h "COMMAND_PROTO($c);" $echo $n "." done $echo "" ! cmp -s ../hdrs/cmds.h ../hdrs/temp.h cmpstat=$? if [ $cmpstat -eq 0 ]; then ! rm -f ../hdrs/temp.h else ! mv -f ../hdrs/temp.h ../hdrs/cmds.h fi if [ -d "../win32" ]; then --- 110,134 ---- $echo "You have too many switches defined!" fi ! mv -f ../hdrs/temp.$$.h ../hdrs/switches.h ! mv -f ../src/temp.$$.c ../src/switchinc.c ;; commands) $echo "Rebuilding command prototype file" ! $echo "/* AUTOGENERATED FILE. DO NOT EDIT */" > ../hdrs/temp.$$.h for c in `grep "^COMMAND *(" ../src/*.c | grep -v cmd_local_silly | cut -f2 -d\( | cut -f1 -d\) | sort | uniq`; do ! $echo >>../hdrs/temp.$$.h "COMMAND_PROTO($c);" $echo $n "." done $echo "" ! cmp -s ../hdrs/cmds.h ../hdrs/temp.$$.h cmpstat=$? if [ $cmpstat -eq 0 ]; then ! rm -f ../hdrs/temp.$$.h else ! mv -f ../hdrs/temp.$$.h ../hdrs/cmds.h fi if [ -d "../win32" ]; then *************** *** 139,156 **** functions) $echo "Rebuilding function prototype file" ! $echo "/* AUTOGENERATED FILE. DO NOT EDIT */" > ../hdrs/temp.h for c in `grep "^FUNCTION *(" ../src/*.c | grep -v local_fun_silly | cut -f2 -d\( | cut -f1 -d\) | sort | uniq`; do ! $echo >>../hdrs/temp.h "FUNCTION_PROTO($c);" $echo $n "." done $echo "" ! cmp -s ../hdrs/funs.h ../hdrs/temp.h cmpstat=$? if [ $cmpstat -eq 0 ]; then ! rm -f ../hdrs/temp.h else ! mv -f ../hdrs/temp.h ../hdrs/funs.h fi if [ -d "../win32" ]; then --- 139,156 ---- functions) $echo "Rebuilding function prototype file" ! $echo "/* AUTOGENERATED FILE. DO NOT EDIT */" > ../hdrs/temp.$$.h for c in `grep "^FUNCTION *(" ../src/*.c | grep -v local_fun_silly | cut -f2 -d\( | cut -f1 -d\) | sort | uniq`; do ! $echo >>../hdrs/temp.$$.h "FUNCTION_PROTO($c);" $echo $n "." done $echo "" ! cmp -s ../hdrs/funs.h ../hdrs/temp.$$.h cmpstat=$? if [ $cmpstat -eq 0 ]; then ! rm -f ../hdrs/temp.$$.h else ! mv -f ../hdrs/temp.$$.h ../hdrs/funs.h fi if [ -d "../win32" ]; then *** 1_7_7.772/src/local.dst Tue, 06 May 2003 17:27:48 -0500 dunemush (pennmush/b/19_local.dst 1.16 660) --- 1_7_7.846(w)/src/local.dst Mon, 15 Mar 2004 16:22:02 -0600 dunemush (pennmush/b/19_local.dst 1.19 660) *************** *** 13,18 **** --- 13,19 ---- #include #include "externs.h" #include "parse.h" + #include "conf.h" #include "htab.h" #include "command.h" #include "confmagic.h" *************** *** 28,33 **** --- 29,67 ---- local_startup(void) { } + + /* Add you own runtime configuration options here, and you can set + * them in mush.cnf. + */ + void + local_configs() + { + #ifdef EXAMPLE + /* For each config parameter you add, you should initialize it as a + * static variable here (or a global variable elsewhere in your + * code) + */ + static int config_example = 1; + static char config_string[BUFFER_LEN]; + #endif + + /* Initial size of this hashtable should be close to the number of + * add_config()'s you plan to do. + */ + hashinit(&local_options, 4, sizeof(CONF)); + + #ifdef EXAMPLE + /* Call add_config for each config parameter you want to add. + * Note the use of &config_example for simple types (bool, int), + * but just config_string for strings. + */ + add_config("use_example", cf_bool, &config_example, sizeof config_example, + "cosmetic"); + add_config("some_string", cf_str, config_string, sizeof config_string, + "cosmetic"); + #endif + } + /* Wrap any calls to stdio functions in local_dump_database() and stuff * it calls in the OUTPUT() macro, which does error checking so we can *** 1_7_7.772/src/cmdlocal.dst Mon, 27 Jan 2003 09:40:07 -0600 dunemush (pennmush/b/21_cmdlocal.d 1.13 660) --- 1_7_7.846(w)/src/cmdlocal.dst Mon, 15 Mar 2004 16:22:02 -0600 dunemush (pennmush/b/21_cmdlocal.d 1.14 660) *************** *** 13,18 **** --- 13,19 ---- #include "externs.h" #include "parse.h" #include "htab.h" + #include "flags.h" #include "command.h" #include "cmds.h" #include "confmagic.h" *** 1_7_7.772/src/SWITCHES Sun, 07 Dec 2003 11:07:54 -0600 dunemush (pennmush/b/22_SWITCHES 1.12.1.3.1.11 600) --- 1_7_7.846(w)/src/SWITCHES Mon, 15 Mar 2004 16:22:05 -0600 dunemush (pennmush/b/22_SWITCHES 1.12.1.3.1.12 600) *************** *** 37,42 **** --- 37,43 ---- DSTATS EMIT ENABLE + EQSPLIT ERR EXITS FILE *************** *** 63,68 **** --- 64,70 ---- LETTER LIST LOWERCASE + LSARGS ME MEMBERS MOD *************** *** 106,111 **** --- 108,114 ---- RETROACTIVE ROOM ROOMS + RSARGS SEE SEEFLAG SELF *** 1_7_7.772/src/wiz.c Mon, 17 Nov 2003 12:37:34 -0600 dunemush (pennmush/b/23_wiz.c 1.44.1.1.1.1.1.2.1.7.1.1.1.1.1.1.1.1.1.1.1.8.1.2.2.2.1.2.1.1.1.1.1.1.1.2.1.1.1.2.2.17.1.9 660) --- 1_7_7.846(w)/src/wiz.c Mon, 15 Mar 2004 16:22:04 -0600 dunemush (pennmush/b/23_wiz.c 1.44.1.1.1.1.1.2.1.7.1.1.1.1.1.1.1.1.1.1.1.8.1.2.2.2.1.2.1.1.1.1.1.1.1.2.1.1.1.2.2.17.1.9.1.3 660) *************** *** 1415,1436 **** sclass = S_NAME; } else if (string_prefix("parent", class)) { sclass = S_PARENT; ! if (!is_dbref(restriction)) { notify(player, T("Unknown parent.")); return -1; } ! restrict_obj = parse_dbref(restriction); if (!GoodObject(restrict_obj)) { notify(player, T("Unknown parent.")); return -1; } } else if (string_prefix("zone", class)) { sclass = S_ZONE; ! if (!is_dbref(restriction)) { notify(player, T("Unknown zone.")); return -1; } ! restrict_obj = parse_dbref(restriction); if (!GoodObject(restrict_obj)) { notify(player, T("Unknown zone.")); return -1; --- 1415,1436 ---- sclass = S_NAME; } else if (string_prefix("parent", class)) { sclass = S_PARENT; ! if (!is_objid(restriction)) { notify(player, T("Unknown parent.")); return -1; } ! restrict_obj = parse_objid(restriction); if (!GoodObject(restrict_obj)) { notify(player, T("Unknown parent.")); return -1; } } else if (string_prefix("zone", class)) { sclass = S_ZONE; ! if (!is_objid(restriction)) { notify(player, T("Unknown zone.")); return -1; } ! restrict_obj = parse_objid(restriction); if (!GoodObject(restrict_obj)) { notify(player, T("Unknown zone.")); return -1; *************** *** 1846,1852 **** } else { notify(player, T("Any name matching these wildcard patterns is banned:")); while (fgets(buffer, sizeof buffer, fp)) { ! if ((p = strchr(buffer, '\n')) != NULL) *p = '\0'; notify(player, buffer); } --- 1846,1854 ---- } else { notify(player, T("Any name matching these wildcard patterns is banned:")); while (fgets(buffer, sizeof buffer, fp)) { ! if ((p = strchr(buffer, '\r')) != NULL) ! *p = '\0'; ! else if ((p = strchr(buffer, '\n')) != NULL) *p = '\0'; notify(player, buffer); } *************** *** 1859,1865 **** fclose(fp); } else { while (fgets(buffer, sizeof buffer, fp)) { ! if ((p = strchr(buffer, '\n')) != NULL) *p = '\0'; if (strcasecmp(buffer, name + 1) == 0) /* Replace the name with #NAME, to allow things like --- 1861,1869 ---- fclose(fp); } else { while (fgets(buffer, sizeof buffer, fp)) { ! if ((p = strchr(buffer, '\r')) != NULL) ! *p = '\0'; ! else if ((p = strchr(buffer, '\n')) != NULL) *p = '\0'; if (strcasecmp(buffer, name + 1) == 0) /* Replace the name with #NAME, to allow things like *************** *** 1898,1904 **** commented[0] = '#'; strcpy(commented + 1, name); while (fgets(buffer, sizeof buffer, fp) != NULL) { ! if ((p = strchr(buffer, '\n')) != NULL) *p = '\0'; if (strcasecmp(commented, buffer) == 0) { fprintf(fptmp, "%s\n", name); --- 1902,1910 ---- commented[0] = '#'; strcpy(commented + 1, name); while (fgets(buffer, sizeof buffer, fp) != NULL) { ! if ((p = strchr(buffer, '\r')) != NULL) ! *p = '\0'; ! else if ((p = strchr(buffer, '\n')) != NULL) *p = '\0'; if (strcasecmp(commented, buffer) == 0) { fprintf(fptmp, "%s\n", name); *** 1_7_7.772/src/switchinc.c Sun, 07 Dec 2003 11:07:54 -0600 dunemush (pennmush/b/32_switchinc. 1.3.1.2.1.6.1.18.1.2.1.2.2.5.1.4.2.4.1.1.1.2.1.5.1.2.1.5.2.1.1.31.3.4.1.5.1.4.1.1.1.1.1.1.1.7.1.1.1.4 660) --- 1_7_7.846(w)/src/switchinc.c Mon, 15 Mar 2004 16:22:04 -0600 dunemush (pennmush/b/32_switchinc. 1.3.1.2.1.6.1.18.1.2.1.2.2.5.1.4.2.4.1.1.1.2.1.5.1.2.1.5.2.1.1.31.3.4.1.5.1.4.1.1.1.1.1.1.1.7.1.1.1.5 660) *************** *** 39,44 **** --- 39,45 ---- {"DSTATS", SWITCH_DSTATS}, {"EMIT", SWITCH_EMIT}, {"ENABLE", SWITCH_ENABLE}, + {"EQSPLIT", SWITCH_EQSPLIT}, {"ERR", SWITCH_ERR}, {"EXITS", SWITCH_EXITS}, {"FILE", SWITCH_FILE}, *************** *** 65,70 **** --- 66,72 ---- {"LETTER", SWITCH_LETTER}, {"LIST", SWITCH_LIST}, {"LOWERCASE", SWITCH_LOWERCASE}, + {"LSARGS", SWITCH_LSARGS}, {"ME", SWITCH_ME}, {"MEMBERS", SWITCH_MEMBERS}, {"MOD", SWITCH_MOD}, *************** *** 108,113 **** --- 110,116 ---- {"RETROACTIVE", SWITCH_RETROACTIVE}, {"ROOM", SWITCH_ROOM}, {"ROOMS", SWITCH_ROOMS}, + {"RSARGS", SWITCH_RSARGS}, {"SEE", SWITCH_SEE}, {"SEEFLAG", SWITCH_SEEFLAG}, {"SELF", SWITCH_SELF}, *** 1_7_7.772/src/strutil.c Wed, 29 Oct 2003 14:21:02 -0600 dunemush (pennmush/b/33_strutil.c 1.28.1.3.1.3.1.7.2.1.1.2.1.1.1.1.1.1.1.21.1.2.1.2.1.8 660) --- 1_7_7.846(w)/src/strutil.c Mon, 15 Mar 2004 16:22:04 -0600 dunemush (pennmush/b/33_strutil.c 1.28.1.3.1.3.1.7.2.1.1.2.1.1.1.1.1.1.1.21.1.2.1.2.1.12 660) *************** *** 272,277 **** --- 272,281 ---- case 'o': c = 197; break; + case 'e': + case 'E': + c = 198; + break; default: c = 'A'; } *************** *** 296,301 **** --- 300,309 ---- case 'o': c = 229; break; + case 'e': + case 'E': + c = 230; + break; default: c = 'a'; } *************** *** 1177,1183 **** } ! /** Strip all ansi and html markup from a string. * \param orig string to strip. * \param s_len address to store length of stripped string, if provided. * \return pointer to static buffer containing stripped string. --- 1185,1194 ---- } ! /** Strip all ansi and html markup from a string. As a side effect, ! * stores the length of the stripped string in a provided address. ! * NOTE! Length returned is length *including* the terminating NULL, ! * because we usually memcpy the result. * \param orig string to strip. * \param s_len address to store length of stripped string, if provided. * \return pointer to static buffer containing stripped string. *************** *** 1190,1197 **** const char *q; size_t len = 0; ! if (!orig) return NULL; for (q = orig; *q;) { switch (*q) { --- 1201,1211 ---- const char *q; size_t len = 0; ! if (!orig) { ! if (s_len) ! *s_len = 0; return NULL; + } for (q = orig; *q;) { switch (*q) { *** 1_7_7.772/src/speech.c Sun, 07 Dec 2003 11:32:19 -0600 dunemush (pennmush/b/35_speech.c 1.21.1.2.1.3.1.5.1.1.1.7.1.3.1.1.1.8.1.1.1.1.1.1.1.10.1.2.1.13.2.4.1.1.3.1.1.5.1.1.1.6 660) --- 1_7_7.846(w)/src/speech.c Mon, 15 Mar 2004 16:22:04 -0600 dunemush (pennmush/b/35_speech.c 1.21.1.2.1.3.1.5.1.1.1.7.1.3.1.1.1.8.1.1.1.1.1.1.1.10.1.2.1.13.2.4.1.1.3.1.1.5.1.1.1.6.1.1 660) *************** *** 70,81 **** { if (Pemit_All(player)) return 1; ! if ((player != target) && ! (IsPlayer(target) && ! (Haven(target) || !eval_lock(player, target, Page_Lock)))) return 0; ! else ! return 1; } static dbref --- 70,82 ---- { if (Pemit_All(player)) return 1; ! if (IsPlayer(target) && Haven(target)) return 0; ! if (!eval_lock(player, target, Page_Lock)) { ! fail_lock(player, target, Page_Lock, NULL, NOTHING); ! return 0; ! } ! return 1; } static dbref *************** *** 653,658 **** --- 654,661 ---- char *current; int i; int repage = 0; + int fails_lock; + int is_haven; ATTR *a; tp2 = tbuf2 = (char *) mush_malloc(BUFFER_LEN, "string"); *************** *** 717,747 **** T("I'm not sure who you want to page with: %s"), current); safe_chr(' ', tbuf, &tp); safe_str_space(current, tbuf, &tp); - } else if (!Connected(target) || (Dark(target) && !override && - (Haven(target) - || - (!eval_lock - (player, target, Page_Lock))))) { - /* A player isn't connected if they aren't connected, or if - * they're DARK and HAVEN, or DARK and the pagelock fails. */ - page_return(player, target, "Away", "AWAY", - tprintf(T("%s is not connected."), Name(target))); - safe_chr(' ', tbuf, &tp); - safe_str_space(current, tbuf, &tp); - } else if (Haven(target) && !override) { - page_return(player, target, "Haven", "HAVEN", - tprintf(T("%s is not accepting any pages."), Name(target))); - safe_chr(' ', tbuf, &tp); - safe_str_space(Name(target), tbuf, &tp); - } else if (!eval_lock(player, target, Page_Lock) && !override) { - page_return(player, target, "Haven", "HAVEN", - tprintf(T("%s is not accepting your pages."), Name(target))); - safe_chr(' ', tbuf, &tp); - safe_str_space(Name(target), tbuf, &tp); } else { ! /* This is a good page */ ! good[gcount] = target; ! gcount++; } } --- 720,754 ---- T("I'm not sure who you want to page with: %s"), current); safe_chr(' ', tbuf, &tp); safe_str_space(current, tbuf, &tp); } else { ! fails_lock = !(override || eval_lock(player, target, Page_Lock)); ! is_haven = !override && Haven(target); ! if (!Connected(target) || (Dark(target) && (is_haven || fails_lock))) { ! /* A player isn't connected if they aren't connected, or if ! * they're DARK and HAVEN, or DARK and the pagelock fails. */ ! page_return(player, target, "Away", "AWAY", ! tprintf(T("%s is not connected."), Name(target))); ! if (fails_lock) ! fail_lock(player, target, Page_Lock, NULL, NOTHING); ! safe_chr(' ', tbuf, &tp); ! safe_str_space(current, tbuf, &tp); ! } else if (is_haven) { ! page_return(player, target, "Haven", "HAVEN", ! tprintf(T("%s is not accepting any pages."), Name(target))); ! safe_chr(' ', tbuf, &tp); ! safe_str_space(Name(target), tbuf, &tp); ! } else if (fails_lock) { ! page_return(player, target, "Haven", "HAVEN", ! tprintf(T("%s is not accepting your pages."), ! Name(target))); ! fail_lock(player, target, Page_Lock, NULL, NOTHING); ! safe_chr(' ', tbuf, &tp); ! safe_str_space(Name(target), tbuf, &tp); ! } else { ! /* This is a good page */ ! good[gcount] = target; ! gcount++; ! } } } *** 1_7_7.772/src/set.c Sun, 25 Jan 2004 20:29:53 -0600 dunemush (pennmush/b/38_set.c 1.26.1.5.1.1.2.1.1.1.1.1.1.11.1.1.1.1.1.1.1.1.1.1.1.1.1.20 660) --- 1_7_7.846(w)/src/set.c Mon, 15 Mar 2004 16:22:04 -0600 dunemush (pennmush/b/38_set.c 1.26.1.5.1.1.2.1.1.1.1.1.1.11.1.1.1.1.1.1.1.1.1.1.1.1.1.27 660) *************** *** 71,76 **** --- 71,78 ---- { dbref thing; char *password; + char *myenv[10]; + int i; newname = trim_space_sep(newname, ' '); *************** *** 135,146 **** flag_broadcast("WIZARD", 0, T("Broadcast: Suspect %s changed name to %s."), Name(thing), newname); ! delete_player(thing, NULL); ! set_name(thing, newname); ! add_player(thing, NULL); ! if (!AreQuiet(player, thing)) ! notify(player, T("Name set.")); ! return; } else { if (!ok_name(newname)) { notify(player, T("That is not a reasonable name.")); --- 137,143 ---- flag_broadcast("WIZARD", 0, T("Broadcast: Suspect %s changed name to %s."), Name(thing), newname); ! /* everything ok, we can fall through to change the name */ } else { if (!ok_name(newname)) { notify(player, T("That is not a reasonable name.")); *************** *** 149,157 **** --- 146,171 ---- } /* everything ok, change the name */ + myenv[0] = (char *) mush_malloc(BUFFER_LEN, "string"); + myenv[1] = (char *) mush_malloc(BUFFER_LEN, "string"); + strncpy(myenv[0], Name(thing), BUFFER_LEN - 1); + myenv[0][BUFFER_LEN - 1] = '\0'; + strcpy(myenv[1], newname); + for (i = 2; i < 10; i++) + myenv[i] = NULL; + + if (IsPlayer(thing)) + delete_player(thing, NULL); set_name(thing, newname); + if (IsPlayer(thing)) + add_player(thing, NULL); + if (!AreQuiet(player, thing)) notify(player, T("Name set.")); + real_did_it(player, thing, NULL, NULL, "ONAME", NULL, "ANAME", NOTHING, + myenv, NA_INTER_PRESENCE); + mush_free(myenv[0], "string"); + mush_free(myenv[1], "string"); } } *************** *** 404,431 **** * If no lock is set, set a default lock (warn if zmo are used for control) * This checks for many trivial elocks (canuse/1, where &canuse=1) */ ! if (zone != NOTHING) { ! boolexp key = getlock(zone, Zone_Lock); ! if (key == TRUE_BOOLEXP) { ! add_lock(GOD, zone, Zone_Lock, parse_boolexp(zone, "=me", Zone_Lock), -1); ! if (noisy && !ZONE_CONTROL_ZMP) ! notify(player, ! T("Unlocked ZMO - automatically zone-locking ZMO to its owner")); ! } else if (eval_lock(Location(player), zone, Zone_Lock)) { ! /* Does #0 and #2 pass it? If so, probably trivial elock */ ! if (eval_lock(PLAYER_START, zone, Zone_Lock) && ! eval_lock(MASTER_ROOM, zone, Zone_Lock)) { ! if (noisy) ! notify(player, ! T("ZMO requires a more secure zone-lock before you @chzone!")); ! return 0; ! } ! /* Probably inexact zone lock */ ! notify(player, ! T ! ("Warning: ZMO may have loose zone lock. Lock ZMOs to =player, not player")); ! } ! } /* Warn Wiz/Royals when they zone their stuff */ if ((zone != NOTHING) && Hasprivs(Owner(thing))) { if (noisy) --- 418,426 ---- * If no lock is set, set a default lock (warn if zmo are used for control) * This checks for many trivial elocks (canuse/1, where &canuse=1) */ ! if (zone != NOTHING) ! check_zone_lock(player, zone, noisy); ! /* Warn Wiz/Royals when they zone their stuff */ if ((zone != NOTHING) && Hasprivs(Owner(thing))) { if (noisy) *************** *** 567,574 **** do_set(dbref player, const char *name, char *flag) { dbref thing; ! int her, listener; ! char *p; /* check for attribute flag set first */ if ((p = strchr(name, '/')) != NULL) { --- 562,570 ---- do_set(dbref player, const char *name, char *flag) { dbref thing; ! int her, listener, negate; ! char *p, *f; ! char flagbuff[BUFFER_LEN]; /* check for attribute flag set first */ if ((p = strchr(name, '/')) != NULL) { *************** *** 594,611 **** } return do_set_atr(thing, flag, p, player, 1); } ! /* we haven't set an attribute, so we must be setting a flag */ ! ! /* move p past NOT_TOKEN if present */ ! for (p = (char *) flag; ! *p && (*p == NOT_TOKEN || isspace((unsigned char) *p)); p++) ; ! ! /* identify flag */ if (*p == '\0') { notify(player, T("You must specify a flag to set.")); return 0; } ! set_flag(player, thing, p, (*flag == NOT_TOKEN) ? 1 : 0, her, listener); return 1; } --- 590,611 ---- } return do_set_atr(thing, flag, p, player, 1); } ! /* we haven't set an attribute, so we must be setting flags */ ! strcpy(flagbuff, flag); ! p = trim_space_sep(flagbuff, ' '); if (*p == '\0') { notify(player, T("You must specify a flag to set.")); return 0; } ! do { ! f = split_token(&p, ' '); ! negate = 0; ! if (*f == NOT_TOKEN && *(f + 1)) { ! negate = 1; ! f++; ! } ! set_flag(player, thing, f, negate, her, listener); ! } while (p); return 1; } *** 1_7_7.772/src/services.c Wed, 29 Oct 2003 14:21:02 -0600 dunemush (pennmush/b/39_services.c 1.15 660) --- 1_7_7.846(w)/src/services.c Mon, 15 Mar 2004 16:22:04 -0600 dunemush (pennmush/b/39_services.c 1.17 660) *************** *** 3,8 **** --- 3,9 ---- /* Author: Nick Gammon */ #ifdef WIN32 + #ifndef __MINGW32__ #include "copyrite.h" #include "config.h" *************** *** 828,831 **** --- 829,833 ---- } /* end of convert_error */ + #endif /* ! __MINGW32__ */ #endif /* WIN32 */ *** 1_7_7.772/src/predicat.c Sun, 25 Jan 2004 20:29:53 -0600 dunemush (pennmush/b/44_predicat.c 1.1.1.34.1.1.1.3.1.4.2.38 660) --- 1_7_7.846(w)/src/predicat.c Mon, 15 Mar 2004 16:22:04 -0600 dunemush (pennmush/b/44_predicat.c 1.1.1.34.1.1.1.3.1.4.2.38.1.1 660) *************** *** 629,635 **** while (fgets(buf, sizeof buf, fp)) { upcasestr(buf); /* step on the newline */ ! if ((newlin = strchr(buf, '\n')) != NULL) *newlin = '\0'; ptr = buf; if (name && ptr && quick_wild(ptr, name)) { --- 629,637 ---- while (fgets(buf, sizeof buf, fp)) { upcasestr(buf); /* step on the newline */ ! if ((newlin = strchr(buf, '\r'))) ! *newlin = '\0'; ! else if ((newlin = strchr(buf, '\n'))) *newlin = '\0'; ptr = buf; if (name && ptr && quick_wild(ptr, name)) { *** 1_7_7.772/src/player.c Mon, 10 Nov 2003 13:43:29 -0600 dunemush (pennmush/b/47_player.c 1.15.1.1.1.1.1.4.1.6.1.1.1.7 660) --- 1_7_7.846(w)/src/player.c Mon, 15 Mar 2004 16:22:04 -0600 dunemush (pennmush/b/47_player.c 1.15.1.1.1.1.1.4.1.6.1.1.1.8 660) *************** *** 442,448 **** do_password(dbref player, const char *old, const char *newobj) { if (!password_check(player, old)) { ! notify(player, T("Suffering from memory loss? See a wizard!")); } else if (!ok_password(newobj)) { notify(player, T("Bad new password.")); } else { --- 442,448 ---- do_password(dbref player, const char *old, const char *newobj) { if (!password_check(player, old)) { ! notify(player, T("The old password that you entered was incorrect.")); } else if (!ok_password(newobj)) { notify(player, T("Bad new password.")); } else { *** 1_7_7.772/src/parse.c Wed, 12 Nov 2003 16:26:25 -0600 dunemush (pennmush/b/48_parse.c 1.23.1.10.1.2.1.1.1.1.1.2.1.2.1.23 660) --- 1_7_7.846(w)/src/parse.c Mon, 15 Mar 2004 16:22:04 -0600 dunemush (pennmush/b/48_parse.c 1.23.1.10.1.2.1.1.1.1.1.2.1.2.1.31 660) *************** *** 129,134 **** --- 129,164 ---- return num; } + /** Given a string, parse out an object id or dbref. + * \param str string to parse. + * \return dbref of object referenced by string, or NOTHING if not a valid + * string or not an existing dbref. + */ + dbref + parse_objid(char const *str) + { + char *p; + if ((p = strchr(str, ':'))) { + char tbuf1[BUFFER_LEN]; + dbref it; + /* A unique id, probably */ + strncpy(tbuf1, str, (p - str)); + tbuf1[p - str] = '\0'; + it = parse_dbref(tbuf1); + if (GoodObject(it)) { + time_t matchtime; + p++; + if (!is_strict_integer(p)) + return NOTHING; + matchtime = parse_integer(p); + return (CreTime(it) == matchtime) ? it : NOTHING; + } else + return NOTHING; + } else + return parse_dbref(str); + } + + /** Given a string, parse out a boolean value. * The meaning of boolean is fuzzy. To TinyMUSH, any string that begins with * a non-zero number is true, and everything else is false. *************** *** 204,209 **** --- 234,260 ---- return !*str; } + /** Is a string an objid? + * An objid is a string starting with a #, optionally followed by a -, + * and then followed by at least one digit, then optionally followed + * by a : and at least one digit, and nothing else. + * In regex: ^#-?\d+(:\d+)?$ + * \param str string to check. + * \retval 1 string is a dbref. + * \retval 0 string is not a dbref. + */ + int + is_objid(char const *str) + { + static pcre *re = NULL; + const char *errptr; + int erroffset; + + if (!re) + re = pcre_compile("^#-?\\d+(?::\\d+)?$", 0, &errptr, &erroffset, NULL); + return (pcre_exec(re, NULL, str, strlen(str), 0, 0, NULL, 0) >= 0); + } + /** Is string an integer? * To TinyMUSH, any string is an integer. To PennMUSH, a string that * passes strtol is an integer, and a blank string is an integer *************** *** 653,658 **** --- 704,714 ---- break; case '#': /* enactor dbref */ safe_dbref(enactor, buff, bp); + break; + case ':': /* enactor unique id */ + safe_dbref(enactor, buff, bp); + safe_chr(':', buff, bp); + safe_integer(CreTime(enactor), buff, bp); break; case '?': /* function limits */ if (pe_info) { *** 1_7_7.772/src/move.c Tue, 30 Sep 2003 16:39:26 -0500 dunemush (pennmush/b/51_move.c 1.1.1.18.1.5.1.13.1.3.1.9.1.1.1.1.1.2.1.1.1.1.1.23 660) --- 1_7_7.846(w)/src/move.c Mon, 15 Mar 2004 16:22:04 -0600 dunemush (pennmush/b/51_move.c 1.1.1.18.1.5.1.13.1.3.1.9.1.1.1.1.1.2.1.1.1.1.1.24 660) *************** *** 342,348 **** process_expression(buff, &bp, &ap, exit_obj, player, player, PE_DEFAULT, PT_DEFAULT, NULL); *bp = '\0'; ! dest_room = parse_dbref(buff); free((Malloc_t) abuf); return (dest_room); } --- 342,348 ---- process_expression(buff, &bp, &ap, exit_obj, player, player, PE_DEFAULT, PT_DEFAULT, NULL); *bp = '\0'; ! dest_room = parse_objid(buff); free((Malloc_t) abuf); return (dest_room); } *** 1_7_7.772/src/match.c Mon, 28 Apr 2003 22:03:14 -0500 dunemush (pennmush/c/2_match.c 1.24.1.1.1.4.1.1.1.1.1.1.1.1.1.1.1.21 660) --- 1_7_7.846(w)/src/match.c Mon, 15 Mar 2004 16:22:04 -0600 dunemush (pennmush/c/2_match.c 1.24.1.1.1.4.1.1.1.1.1.1.1.1.1.1.1.26 660) *************** *** 61,68 **** static int parse_english(const char **name, long *flags); static dbref match_me(const dbref who, const char *name); static dbref match_here(const dbref who, const char *name); ! /** Macro for an 'absolute dbref match' function */ ! #define match_absolute(name) parse_dbref(name) static dbref match_player(const dbref matcher, const char *match_name); static dbref choose_thing(const dbref match_who, const int preferred_type, long int flags, dbref thing1, dbref thing2); --- 61,67 ---- static int parse_english(const char **name, long *flags); static dbref match_me(const dbref who, const char *name); static dbref match_here(const dbref who, const char *name); ! #define match_absolute(name) parse_objid(name) static dbref match_player(const dbref matcher, const char *match_name); static dbref choose_thing(const dbref match_who, const int preferred_type, long int flags, dbref thing1, dbref thing2); *** 1_7_7.772/src/look.c Sun, 07 Dec 2003 16:16:59 -0600 dunemush (pennmush/c/4_look.c 1.21.1.2.1.9.1.1.1.1.1.22 660) --- 1_7_7.846(w)/src/look.c Mon, 15 Mar 2004 16:22:04 -0600 dunemush (pennmush/c/4_look.c 1.21.1.2.1.9.1.1.1.1.1.24 660) *************** *** 756,765 **** } } if (ok) { notify_format(player, T("Owner: %s Zone: %s %s: %d"), ! Name(Owner(thing)), ! object_header(player, Zone(thing)), MONIES, Pennies(thing)); notify_format(player, T("Parent: %s"), object_header(player, Parent(thing))); { --- 756,767 ---- } } if (ok) { + char tbuf1[BUFFER_LEN]; + strcpy(tbuf1, object_header(player, Zone(thing))); notify_format(player, T("Owner: %s Zone: %s %s: %d"), ! object_header(player, Owner(thing)), ! tbuf1, MONIES, Pennies(thing)); notify_format(player, T("Parent: %s"), object_header(player, Parent(thing))); { *** 1_7_7.772/src/lock.c Wed, 29 Oct 2003 14:21:02 -0600 dunemush (pennmush/c/6_lock.c 1.17.1.13.1.1.1.1.1.12 660) --- 1_7_7.846(w)/src/lock.c Mon, 15 Mar 2004 16:22:04 -0600 dunemush (pennmush/c/6_lock.c 1.17.1.13.1.1.1.1.1.14 660) *************** *** 860,862 **** --- 860,894 ---- if (!IsPlayer(thing)) ModTime(thing) = mudtime; } + + /** Check to see if an object has a good zone lock set. + * If it doesn't have a lock at all, set one of '=Zone'. + * \param player The object responsible for having the lock checked. + * \param zone the object whose lock needs to be checked. + */ + void + check_zone_lock(dbref player, dbref zone, int noisy) + { + boolexp key = getlock(zone, Zone_Lock); + if (key == TRUE_BOOLEXP) { + add_lock(GOD, zone, Zone_Lock, parse_boolexp(zone, "=me", Zone_Lock), -1); + if (noisy) + notify_format(player, + T + ("Unlocked zone %s - automatically zone-locking to itself"), + unparse_object(player, zone)); + } else if (eval_lock(Location(player), zone, Zone_Lock)) { + /* Does #0 and #2 pass it? If so, probably trivial elock */ + if (eval_lock(PLAYER_START, zone, Zone_Lock) && + eval_lock(MASTER_ROOM, zone, Zone_Lock)) { + if (noisy) + notify_format(player, + T("Zone %s really should have a more secure zone-lock."), + unparse_object(player, zone)); + } else /* Probably inexact zone lock */ + notify_format(player, + T + ("Warning: Zone %s may have loose zone lock. Lock zones to =player, not player"), + unparse_object(player, zone)); + } + } *** 1_7_7.772/src/game.c Thu, 08 Jan 2004 21:41:52 -0600 dunemush (pennmush/c/10_game.c 1.50.1.8.1.1.1.1.2.1.1.1.2.1.1.4.1.1.1.1.1.1.1.1.1.1.2.1.1.2.1.1.1.1.1.1.1.2.1.1.1.2.1.1.1.1.1.1.1.1.1.5.1.3.1.2.1.2.1.1.1.1.1.1.1.1.1.12.1.3.1.7 660) --- 1_7_7.846(w)/src/game.c Mon, 15 Mar 2004 16:22:04 -0600 dunemush (pennmush/c/10_game.c 1.50.1.8.1.1.1.1.2.1.1.1.2.1.1.4.1.1.1.1.1.1.1.1.1.1.2.1.1.2.1.1.1.1.1.1.1.2.1.1.1.2.1.1.1.1.1.1.1.1.1.5.1.3.1.2.1.2.1.1.1.1.1.1.1.1.1.12.1.3.1.7.1.2 660) *************** *** 153,159 **** #endif - Pid_t forked_dump_pid = -1; /** Open /dev/null to reserve a file descriptor that can be reused later. */ --- 153,158 ---- *************** *** 724,729 **** --- 723,729 ---- memset(¤t_state, 0, sizeof current_state); /* Load all the config file stuff except restrict_* */ + local_configs(); conf_default_set(); config_file_startup(conf, 0); *** 1_7_7.772/src/funtime.c Sat, 24 Jan 2004 13:22:12 -0600 dunemush (pennmush/c/12_funtime.c 1.11.1.14.1.1.1.4 660) --- 1_7_7.846(w)/src/funtime.c Mon, 15 Mar 2004 16:22:03 -0600 dunemush (pennmush/c/12_funtime.c 1.11.1.14.1.1.1.7 660) *************** *** 21,26 **** --- 21,27 ---- #include "parse.h" #include "dbdefs.h" #include "log.h" + #include "match.h" #include "confmagic.h" int do_convtime(const char *str, struct tm *ttm); *************** *** 98,115 **** FUNCTION(fun_time) { int utc = 0; if (nargs == 1) { ! if (!strcasecmp("UTC", args[0])) utc = 1; ! else { ! safe_str(T("#-1 INVALID TIME ZONE"), buff, bp); ! return; } ! } else if (!strcmp("UTCTIME", called_as)) utc = 1; ! safe_str(show_time(mudtime, utc), buff, bp); } /* ARGSUSED */ --- 99,145 ---- FUNCTION(fun_time) { int utc = 0; + int mytime; + double tz = 0; + + mytime = mudtime; if (nargs == 1) { ! if (!strcasecmp("UTC", args[0])) { utc = 1; ! } else if (args[0] && *args[0] && is_strict_number(args[0])) { ! utc = 1; ! tz = strtod(args[0], NULL); ! if (tz < -24.0 || tz > 24.0) { ! safe_str(T("#-1 INVALID TIME ZONE"), buff, bp); ! return; ! } ! mytime += (int) (tz * 3600); ! } else if (args[0] && *args[0]) { ! dbref thing; ! ATTR *a; ! char *ptr; ! utc = 1; ! thing = match_thing(executor, args[0]); ! if (!GoodObject(thing)) { ! safe_str(T(e_notvis), buff, bp); ! return; ! } ! /* Always make time(player) return a time, ! * even if player's TZ is unset or wonky */ ! a = atr_get(thing, "TZ"); ! if (a && is_strict_number(ptr = atr_value(a))) { ! tz = strtod(ptr, NULL); ! if (tz >= -24.0 || tz <= 24.0) { ! mytime += (int) (tz * 3600); ! } ! } } ! } else if (!strcmp("UTCTIME", called_as)) { utc = 1; + } ! safe_str(show_time(mytime, utc), buff, bp); } /* ARGSUSED */ *** 1_7_7.772/src/funstr.c Sun, 07 Dec 2003 16:16:59 -0600 dunemush (pennmush/c/13_funstr.c 1.28.1.1.1.2.1.4.1.6.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.3.1.5.1.3.1.2.1.1.1.1.1.1.1.1.1.13 660) --- 1_7_7.846(w)/src/funstr.c Mon, 15 Mar 2004 16:22:03 -0600 dunemush (pennmush/c/13_funstr.c 1.28.1.1.1.2.1.4.1.6.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.3.1.5.1.3.1.2.1.1.1.1.1.1.1.1.1.14.1.8 660) *************** *** 506,513 **** case 'D': { dbref a, b; ! a = parse_dbref(args[0]); ! b = parse_dbref(args[1]); if (a == NOTHING || b == NOTHING) { safe_str(T("#-1 INVALID DBREF"), buff, bp); return; --- 506,513 ---- case 'D': { dbref a, b; ! a = parse_objid(args[0]); ! b = parse_objid(args[1]); if (a == NOTHING || b == NOTHING) { safe_str(T("#-1 INVALID DBREF"), buff, bp); return; *************** *** 611,642 **** /* ARGSUSED */ FUNCTION(fun_merge) { ! /* given s1, s2, and a char, for each character in s1, if the char ! * is the same as the given char, replace it with the corresponding * char in s2. */ char *str, *rep; ! char c; /* do length checks first */ if (arglens[0] != arglens[1]) { safe_str(T("#-1 STRING LENGTHS MUST BE EQUAL"), buff, bp); return; } ! if (arglens[2] > 1) { ! safe_str(T("#-1 TOO MANY CHARACTERS"), buff, bp); ! return; } - /* find the character to look for */ - if (!*args[2]) - c = ' '; - else - c = *args[2]; /* walk strings, copy from the appropriate string */ for (str = args[0], rep = args[1]; *str && *rep; str++, rep++) { ! *str = (*str == c) ? *rep : *str; } safe_str(args[0], buff, bp); } --- 611,644 ---- /* ARGSUSED */ FUNCTION(fun_merge) { ! /* given s1, s2, and a list of characters, for each character in s1, ! * if the char is in the list, replace it with the corresponding * char in s2. */ char *str, *rep; ! char matched[UCHAR_MAX + 1]; /* do length checks first */ if (arglens[0] != arglens[1]) { safe_str(T("#-1 STRING LENGTHS MUST BE EQUAL"), buff, bp); return; } ! ! memset(matched, 0, sizeof matched); ! ! /* find the characters to look for */ ! if (!args[2] || !*args[2]) ! matched[(unsigned char) ' '] = 1; ! else { ! unsigned char *p; ! for (p = (unsigned char *) args[2]; p && *p; p++) ! matched[*p] = 1; } /* walk strings, copy from the appropriate string */ for (str = args[0], rep = args[1]; *str && *rep; str++, rep++) { ! *str = matched[(unsigned char) *str] ? *rep : *str; } safe_str(args[0], buff, bp); } *************** *** 648,676 **** * is in s1, replace it with the char at the same index in s2. */ - char *str, *find, *rep; char charmap[256]; ! int i; /* do length checks first */ - if (arglens[1] != arglens[2]) { - safe_str(T("#-1 STRING LENGTHS MUST BE EQUAL"), buff, bp); - return; - } for (i = 0; i < 256; i++) { charmap[i] = (char) i; } ! for (find = args[1], rep = args[2]; *find; find++, rep++) { ! charmap[(unsigned char) *find] = *rep; } /* walk the string, translating characters */ ! for (str = args[0]; *str; str++) { ! *str = charmap[(unsigned char) *str]; } ! safe_str(args[0], buff, bp); } /* ARGSUSED */ --- 650,741 ---- * is in s1, replace it with the char at the same index in s2. */ char charmap[256]; ! char instr[BUFFER_LEN], outstr[BUFFER_LEN]; ! char rawstr[BUFFER_LEN]; ! char *ip, *op; ! int i, len; ! char *c; ! ansi_string *as; ! ! /* No ansi allowed in find or replace lists */ ! c = remove_markup(args[1], &len); ! memcpy(rawstr, c, len); /* do length checks first */ for (i = 0; i < 256; i++) { charmap[i] = (char) i; } ! ip = instr; ! op = outstr; ! ! for (i = 0; i < len; i++) { ! safe_chr(rawstr[i], instr, &ip); ! /* Handle a range of characters */ ! if (i != len - 1 && rawstr[i + 1] == '-' && i != len - 2) { ! int dir, sentinel, cur; ! ! if (rawstr[i] < rawstr[i + 2]) ! dir = 1; ! else ! dir = -1; ! ! sentinel = rawstr[i + 2] + dir; ! cur = rawstr[i] + dir; ! ! while (cur != sentinel) { ! safe_chr((char) cur, instr, &ip); ! cur += dir; ! } ! i += 2; ! } ! } ! ! c = remove_markup(args[2], &len); ! memcpy(rawstr, c, len); ! for (i = 0; i < len; i++) { ! safe_chr(rawstr[i], outstr, &op); ! /* Handle a range of characters */ ! if (i != len - 1 && rawstr[i + 1] == '-' && i != len - 2) { ! int dir, sentinel, cur; ! ! if (rawstr[i] < rawstr[i + 2]) ! dir = 1; ! else ! dir = -1; ! ! sentinel = rawstr[i + 2] + dir; ! cur = rawstr[i] + dir; ! ! while (cur != sentinel) { ! safe_chr((char) cur, outstr, &op); ! cur += dir; ! } ! i += 2; ! } ! } ! ! if ((ip - instr) != (op - outstr)) { ! safe_str(T("#-1 STRING LENGTHS MUST BE EQUAL"), buff, bp); ! return; } + len = ip - instr; + + for (i = 0; i < len; i++) + charmap[(unsigned char) instr[i]] = outstr[i]; + /* walk the string, translating characters */ ! as = parse_ansi_string(args[0]); ! populate_codes(as); ! len = as->len; ! for (i = 0; i < len; i++) { ! as->text[i] = charmap[(unsigned char) as->text[i]]; } ! safe_ansi_string(as, 0, as->len, buff, bp); ! free_ansi_string(as); } /* ARGSUSED */ *************** *** 1022,1027 **** --- 1087,1095 ---- case ']': case '{': case '}': + case '(': + case ')': + case ',': case ';': safe_chr('\\', buff, bp); } *** 1_7_7.772/src/funmath.c Thu, 09 Oct 2003 19:20:51 -0500 dunemush (pennmush/c/15_funmath.c 1.39.1.1.1.1.1.1.1.10.1.8 660) --- 1_7_7.846(w)/src/funmath.c Mon, 15 Mar 2004 16:22:03 -0600 dunemush (pennmush/c/15_funmath.c 1.39.1.1.1.1.1.1.1.10.1.10 660) *************** *** 744,749 **** --- 744,782 ---- } } + FUNCTION(fun_vcross) + { + char sep = ' '; + char *v1[BUFFER_LEN / 3], *v2[BUFFER_LEN / 2]; + int v1len, v2len, n; + NVAL vec1[3], vec2[3], cross[3]; + + if (!delim_check(buff, bp, nargs, args, 3, &sep)) + return; + + v1len = list2arr(v1, BUFFER_LEN / 2, args[0], sep); + v2len = list2arr(v2, BUFFER_LEN / 2, args[1], sep); + + if (v1len != 3 || v2len != 3) { + safe_str(T("#-1 VECTORS MUST BE THREE-DIMENSIONAL"), buff, bp); + return; + } + + for (n = 0; n < 3; n++) { + vec1[n] = parse_number(v1[n]); + vec2[n] = parse_number(v2[n]); + } + + cross[0] = vec1[1] * vec2[2] - vec2[1] * vec1[2]; + cross[1] = vec1[2] * vec2[0] - vec2[2] * vec1[0]; + cross[2] = vec1[0] * vec2[1] - vec2[0] * vec1[1]; + + safe_number(cross[0], buff, bp); + safe_chr(sep, buff, bp); + safe_number(cross[1], buff, bp); + safe_chr(sep, buff, bp); + safe_number(cross[2], buff, bp); + } /* ARGSUSED */ FUNCTION(fun_fdiv) *** 1_7_7.772/src/funlist.c Sat, 24 Jan 2004 13:22:12 -0600 dunemush (pennmush/c/16_funlist.c 1.3.1.1.1.5.1.2.1.1.1.1.1.4.1.2.1.2.1.19.1.2.1.1.1.2.1.5.1.1.1.1.1.1.1.1.1.1.2.1.1.3.1.2.1.1.1.1.1.1.1.1.1.1.1.12.1.14.1.7 660) --- 1_7_7.846(w)/src/funlist.c Mon, 15 Mar 2004 16:22:03 -0600 dunemush (pennmush/c/16_funlist.c 1.3.1.1.1.5.1.2.1.1.1.1.1.4.1.2.1.2.1.19.1.2.1.1.1.2.1.5.1.1.1.1.1.1.1.1.1.1.2.1.1.3.1.2.1.1.1.1.1.1.1.1.1.1.1.12.1.14.1.7.1.1 660) *************** *** 635,641 **** * alphanumeric guess, unless this is the first * element and we have a dbref. */ ! if (is_dbref(ptrs[i])) sort_type = DBREF_LIST; else return ALPHANUM_LIST; --- 635,641 ---- * alphanumeric guess, unless this is the first * element and we have a dbref. */ ! if (is_objid(ptrs[i])) sort_type = DBREF_LIST; else return ALPHANUM_LIST; *************** *** 647,653 **** return ALPHANUM_LIST; break; case DBREF_LIST: ! if (!is_dbref(ptrs[i])) return ALPHANUM_LIST; break; default: --- 647,653 ---- return ALPHANUM_LIST; break; case DBREF_LIST: ! if (!is_objid(ptrs[i])) return ALPHANUM_LIST; break; default: *************** *** 826,833 **** case DBREF_LIST: { int dga, dgb; ! dga = parse_dbref(a); ! dgb = parse_dbref(b); if (dga < dgb) return -1; if (dga > dgb) --- 826,833 ---- case DBREF_LIST: { int dga, dgb; ! dga = parse_objid(a); ! dgb = parse_objid(b); if (dga < dgb) return -1; if (dga > dgb) *** 1_7_7.772/src/fundb.c Thu, 13 Nov 2003 07:48:17 -0600 dunemush (pennmush/c/17_fundb.c 1.1.1.1.1.1.1.1.1.1.1.1.1.3.1.1.1.1.1.7.1.3.1.3.1.3.1.2.1.2.1.3.2.1.2.1.2.1.1.1.1.4.1.1.1.1.1.1.1.1.1.1.1.3.1.1.2.2.2.1.1.1.1.1.1.24 660) --- 1_7_7.846(w)/src/fundb.c Mon, 15 Mar 2004 16:22:03 -0600 dunemush (pennmush/c/17_fundb.c 1.1.1.1.1.1.1.1.1.1.1.1.1.3.1.1.1.1.1.7.1.3.1.3.1.3.1.2.1.2.1.3.2.1.2.1.2.1.1.1.1.4.1.1.1.1.1.1.1.1.1.1.1.3.1.1.2.2.2.1.1.1.1.1.1.26 660) *************** *** 1151,1156 **** --- 1151,1169 ---- } /* ARGSUSED */ + FUNCTION(fun_objid) + { + dbref it = match_thing(executor, args[0]); + + if (GoodObject(it)) { + safe_dbref(it, buff, bp); + safe_chr(':', buff, bp); + safe_integer(CreTime(it), buff, bp); + } else + safe_str(T(e_notvis), buff, bp); + } + + /* ARGSUSED */ FUNCTION(fun_ctime) { dbref it = match_thing(executor, args[0]); *************** *** 1457,1463 **** if (*args[0] == '*') target = lookup_player(args[0] + 1); else if (*args[0] == NUMBER_TOKEN) { ! target = parse_dbref(args[0]); if (!(GoodObject(target) && IsPlayer(target))) { notify(executor, T("No match.")); safe_str("#-1", buff, bp); --- 1470,1476 ---- if (*args[0] == '*') target = lookup_player(args[0] + 1); else if (*args[0] == NUMBER_TOKEN) { ! target = parse_objid(args[0]); if (!(GoodObject(target) && IsPlayer(target))) { notify(executor, T("No match.")); safe_str("#-1", buff, bp); *** 1_7_7.772/src/function.c Sun, 07 Dec 2003 12:04:55 -0600 dunemush (pennmush/c/18_function.c 1.29.1.14.1.3.1.6.1.1.1.1.1.14.1.2.1.1.1.7.1.22.1.11 660) --- 1_7_7.846(w)/src/function.c Mon, 15 Mar 2004 16:22:03 -0600 dunemush (pennmush/c/18_function.c 1.29.1.14.1.3.1.6.1.1.1.1.1.14.1.2.1.1.1.7.1.22.1.11.1.3.1.1 660) *************** *** 389,394 **** --- 389,395 ---- {"NULL", fun_null, 1, INT_MAX, FN_REG}, {"OBJ", fun_obj, 1, 1, FN_REG}, {"OBJEVAL", fun_objeval, 2, -2, FN_NOPARSE}, + {"OBJID", fun_objid, 1, 1, FN_REG}, {"OBJMEM", fun_objmem, 1, 1, FN_REG}, {"OEMIT", fun_oemit, 2, -2, FN_REG}, {"OPEN", fun_open, 2, 2, FN_REG}, *************** *** 521,526 **** --- 522,528 ---- {"ZFUN", fun_zfun, 1, 11, FN_REG}, {"ZONE", fun_zone, 1, 2, FN_REG}, {"VADD", fun_vadd, 2, 3, FN_REG}, + {"VCROSS", fun_vcross, 2, 3, FN_REG}, {"VSUB", fun_vsub, 2, 3, FN_REG}, {"VMAX", fun_vmax, 2, 3, FN_REG}, {"VMIN", fun_vmin, 2, 3, FN_REG}, *** 1_7_7.772/src/flags.c Sun, 07 Dec 2003 12:21:41 -0600 dunemush (pennmush/c/20_flags.c 1.1.1.1.1.1.1.1.1.1.1.1.1.6.1.2.1.1.1.1.1.2.2.2.2.1.2.1.1.3.1.2.1.1.1.1.1.1.1.1.1.3.1.9.1.2.2.1.1.2.1.56.1.11 660) --- 1_7_7.846(w)/src/flags.c Mon, 15 Mar 2004 16:22:03 -0600 dunemush (pennmush/c/20_flags.c 1.1.1.1.1.1.1.1.1.1.1.1.1.6.1.2.1.1.1.1.1.2.2.2.2.1.2.1.1.3.1.2.1.1.1.1.1.1.1.1.1.3.1.9.1.2.2.1.1.2.1.56.1.12.1.1.1.1 660) *************** *** 1268,1274 **** n = (FLAGSPACE *) hashfind("FLAG", &htab_flagspaces); if ((f = flag_hash_lookup(n, flag, Typeof(thing))) == NULL) { ! notify(player, T("I don't recognize that flag.")); return; } --- 1268,1274 ---- n = (FLAGSPACE *) hashfind("FLAG", &htab_flagspaces); if ((f = flag_hash_lookup(n, flag, Typeof(thing))) == NULL) { ! notify_format(player, T("%s - I don't recognize that flag."), flag); return; } *************** *** 1356,1361 **** --- 1356,1363 ---- do_log(LT_WIZ, player, thing, "SUSPECT FLAG SET"); if (is_flag(f, "TRUST") && GoodObject(Zone(thing))) notify(player, T("Warning: Setting trust flag on zoned object")); + if (is_flag(f, "SHARED")) + check_zone_lock(player, thing, 1); /* DARK players should be treated as logged out */ if (is_flag(f, "DARK") && IsPlayer(thing)) hide_player(thing, 1); *************** *** 2135,2140 **** --- 2137,2144 ---- Flagspace_Lookup(n, ns); disallowed = God(privs) ? F_INTERNAL : (F_INTERNAL | F_DISABLED); + if (!Hasprivs(privs)) + disallowed |= (F_DARK | F_MDARK); ptrs = (char **) malloc(n->flagbits * sizeof(char *)); for (i = 0; i < n->flagbits; i++) { if ((f = n->flags[i]) && !(f->perms & disallowed)) { *** 1_7_7.772/src/filecopy.c Tue, 23 Sep 2003 20:11:09 -0500 dunemush (pennmush/c/21_filecopy.c 1.81 660) --- 1_7_7.846(w)/src/filecopy.c Mon, 15 Mar 2004 16:22:03 -0600 dunemush (pennmush/c/21_filecopy.c 1.83 660) *************** *** 191,200 **** int indb_OK, outdb_OK, panicdb_OK; FILETIME indb_time, outdb_time, panicdb_time; long indb_size, outdb_size, panicdb_size; - char FileName[256]; #ifndef _DEBUG ! if (GetModuleFileName(NULL, FileName, 256) != 0) { if (!strcasecmp(rindex(FileName, '\\') + 1, "pennmush.exe")) { if (CopyFile("pennmush.exe", "pennmush_run.exe", FALSE)) { do_rawlog(LT_ERR, "Successfully copied executable, starting copy."); --- 191,200 ---- int indb_OK, outdb_OK, panicdb_OK; FILETIME indb_time, outdb_time, panicdb_time; long indb_size, outdb_size, panicdb_size; #ifndef _DEBUG ! char FileName[256]; ! if (GetModuleFileName(NULL, FileName, 256) != 0) { if (!strcasecmp(rindex(FileName, '\\') + 1, "pennmush.exe")) { if (CopyFile("pennmush.exe", "pennmush_run.exe", FALSE)) { do_rawlog(LT_ERR, "Successfully copied executable, starting copy."); *** 1_7_7.772/src/extmail.c Wed, 29 Oct 2003 14:21:02 -0600 dunemush (pennmush/c/22_extmail.c 1.44.1.7.1.5.1.9.1.1.1.1.1.8 660) --- 1_7_7.846(w)/src/extmail.c Mon, 15 Mar 2004 16:22:03 -0600 dunemush (pennmush/c/22_extmail.c 1.44.1.7.1.5.1.9.1.1.1.1.1.10 660) *************** *** 1018,1027 **** newp->subject = compress(sbuf); if (flags & M_FORWARD) { /* Forwarding passes the message already compressed */ ! int len = strlen(message) + 1; newp->msgid = chunk_create(message, len, 1); } else { ! int len; unsigned char *text; newmsg = (char *) mush_malloc(BUFFER_LEN, "string"); if (!newmsg) --- 1018,1027 ---- newp->subject = compress(sbuf); if (flags & M_FORWARD) { /* Forwarding passes the message already compressed */ ! u_int_16 len = strlen(message) + 1; newp->msgid = chunk_create(message, len, 1); } else { ! u_int_16 len; unsigned char *text; newmsg = (char *) mush_malloc(BUFFER_LEN, "string"); if (!newmsg) *************** *** 1966,1972 **** char nbuf1[8]; unsigned char *tbuf = NULL; unsigned char *text; ! int len; int mail_top = 0; int mail_flags = 0; int i = 0; --- 1966,1972 ---- char nbuf1[8]; unsigned char *tbuf = NULL; unsigned char *text; ! u_int_16 len; int mail_top = 0; int mail_flags = 0; int i = 0; *************** *** 2311,2317 **** if (ms.days != -1) { /* Get the time now, subtract mp->time, and compare the results with * ms.days (in manner of ms.day_comp) */ ! diffdays = difftime(mudtime, mp->time) / 86400; if (sign(diffdays - ms.days) != ms.day_comp) return 0; else --- 2311,2317 ---- if (ms.days != -1) { /* Get the time now, subtract mp->time, and compare the results with * ms.days (in manner of ms.day_comp) */ ! diffdays = (int) (difftime(mudtime, mp->time) / 86400); if (sign(diffdays - ms.days) != ms.day_comp) return 0; else *************** *** 2410,2420 **** } } else if (*p == '#') { /* From db# */ ! if (!is_dbref(p)) { notify(player, T("MAIL: Invalid dbref #")); return 0; } ! ms->player = parse_dbref(p); if (!GoodObject(ms->player) || !(ms->player)) { notify(player, T("MAIL: Invalid dbref #")); return 0; --- 2410,2420 ---- } } else if (*p == '#') { /* From db# */ ! if (!is_objid(p)) { notify(player, T("MAIL: Invalid dbref #")); return 0; } ! ms->player = parse_objid(p); if (!GoodObject(ms->player) || !(ms->player)) { notify(player, T("MAIL: Invalid dbref #")); return 0; *** 1_7_7.772/src/extchat.c Sun, 25 Jan 2004 20:29:53 -0600 dunemush (pennmush/c/23_extchat.c 1.1.1.1.1.1.1.1.1.2.1.1.1.3.1.1.1.5.1.1.1.1.1.5.1.2.1.3.1.3.1.1.1.4.1.2.1.6.1.2.1.1.2.4.2.9.1.2.1.2.1.3.1.2.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.3.1.2.1.1.2.1.1.2.1.1.1.1.1.1.1.1.1.16 660) --- 1_7_7.846(w)/src/extchat.c Mon, 15 Mar 2004 16:22:03 -0600 dunemush (pennmush/c/23_extchat.c 1.1.1.1.1.1.1.1.1.2.1.1.1.3.1.1.1.5.1.1.1.1.1.5.1.2.1.3.1.3.1.1.1.4.1.2.1.6.1.2.1.1.2.4.2.9.1.2.1.2.1.3.1.2.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.3.1.2.1.1.2.1.1.2.1.1.1.1.1.1.1.1.1.16.1.3 660) *************** *** 653,658 **** --- 653,686 ---- * onchannel - is player on channel? */ + /** Removes markup and <>'s in channel names. + * \param name The name to normalize. + * \retval a pointer to a static buffer with the normalized name. + */ + static char * + normalize_channel_name(const char *name) + { + static char cleanname[BUFFER_LEN]; + size_t len; + + cleanname[0] = '\0'; + + if (!name || !*name) + return cleanname; + + strcpy(cleanname, remove_markup(name, &len)); + len--; + + if (!*cleanname) + return cleanname; + + if (cleanname[0] == '<' && cleanname[len - 1] == '>') { + cleanname[len - 1] = '\0'; + return cleanname + 1; + } else + return cleanname; + } + /** Attempt to match a channel name for a player. * Given name and a chan pointer, set chan pointer to point to * channel if found (NULL otherwise), and return an indication *************** *** 671,683 **** { CHAN *p; int count = 0; ! char cleanname[BUFFER_LEN]; char cleanp[CHAN_NAME_LEN]; *chan = NULL; if (!name || !*name) return CMATCH_NONE; ! strcpy(cleanname, remove_markup(name, NULL)); for (p = channels; p; p = p->next) { strcpy(cleanp, remove_markup(ChanName(p), NULL)); if (!strcasecmp(cleanname, cleanp)) { --- 699,712 ---- { CHAN *p; int count = 0; ! char *cleanname; char cleanp[CHAN_NAME_LEN]; *chan = NULL; if (!name || !*name) return CMATCH_NONE; ! ! cleanname = normalize_channel_name(name); for (p = channels; p; p = p->next) { strcpy(cleanp, remove_markup(ChanName(p), NULL)); if (!strcasecmp(cleanname, cleanp)) { *************** *** 725,737 **** { CHAN *p; int count = 0; ! char cleanname[BUFFER_LEN]; char cleanp[CHAN_NAME_LEN]; *chan = NULL; if (!name || !*name) return CMATCH_NONE; ! strcpy(cleanname, remove_markup(name, NULL)); for (p = channels; p; p = p->next) { strcpy(cleanp, remove_markup(ChanName(p), NULL)); if (!strcasecmp(cleanname, cleanp)) { --- 754,766 ---- { CHAN *p; int count = 0; ! char *cleanname; char cleanp[CHAN_NAME_LEN]; *chan = NULL; if (!name || !*name) return CMATCH_NONE; ! cleanname = normalize_channel_name(name); for (p = channels; p; p = p->next) { strcpy(cleanp, remove_markup(ChanName(p), NULL)); if (!strcasecmp(cleanname, cleanp)) { *************** *** 761,767 **** list_partial_matches(dbref player, const char *name, enum chan_match_type type) { CHAN *p; ! char cleanname[BUFFER_LEN]; char cleanp[CHAN_NAME_LEN]; char buff[BUFFER_LEN], *bp; bp = buff; --- 790,796 ---- list_partial_matches(dbref player, const char *name, enum chan_match_type type) { CHAN *p; ! char *cleanname; char cleanp[CHAN_NAME_LEN]; char buff[BUFFER_LEN], *bp; bp = buff; *************** *** 770,776 **** return; safe_str(T("CHAT: Partial matches are:"), buff, &bp); ! strcpy(cleanname, remove_markup(name, NULL)); for (p = channels; p; p = p->next) { if ((type == PMATCH_ALL) || ((type == PMATCH_ON) ? (int) (void *) onchannel(player, p) --- 799,805 ---- return; safe_str(T("CHAT: Partial matches are:"), buff, &bp); ! cleanname = normalize_channel_name(name); for (p = channels; p; p = p->next) { if ((type == PMATCH_ALL) || ((type == PMATCH_ON) ? (int) (void *) onchannel(player, p) *************** *** 810,822 **** { CHAN *p; int count = 0; ! char cleanname[BUFFER_LEN]; char cleanp[CHAN_NAME_LEN]; *chan = NULL; if (!name || !*name) return CMATCH_NONE; ! strcpy(cleanname, remove_markup(name, NULL)); for (p = channels; p; p = p->next) { if (onchannel(player, p)) { strcpy(cleanp, remove_markup(ChanName(p), NULL)); --- 839,851 ---- { CHAN *p; int count = 0; ! char *cleanname; char cleanp[CHAN_NAME_LEN]; *chan = NULL; if (!name || !*name) return CMATCH_NONE; ! cleanname = normalize_channel_name(name); for (p = channels; p; p = p->next) { if (onchannel(player, p)) { strcpy(cleanp, remove_markup(ChanName(p), NULL)); *************** *** 859,871 **** { CHAN *p; int count = 0; ! char cleanname[BUFFER_LEN]; char cleanp[CHAN_NAME_LEN]; *chan = NULL; if (!name || !*name) return CMATCH_NONE; ! strcpy(cleanname, remove_markup(name, NULL)); for (p = channels; p; p = p->next) { if (!onchannel(player, p)) { strcpy(cleanp, remove_markup(ChanName(p), NULL)); --- 888,900 ---- { CHAN *p; int count = 0; ! char *cleanname; char cleanp[CHAN_NAME_LEN]; *chan = NULL; if (!name || !*name) return CMATCH_NONE; ! cleanname = normalize_channel_name(name); for (p = channels; p; p = p->next) { if (!onchannel(player, p)) { strcpy(cleanp, remove_markup(ChanName(p), NULL)); *************** *** 2263,2272 **** { CHAN *c; int found = 0; ! char cleanname[BUFFER_LEN]; char cleanp[CHAN_NAME_LEN]; ! strcpy(cleanname, remove_markup(partname, NULL)); for (c = channels; c; c = c->next) { strcpy(cleanp, remove_markup(ChanName(c), NULL)); if (Chan_Can_See(c, player) && string_prefix(cleanp, cleanname)) { --- 2292,2301 ---- { CHAN *c; int found = 0; ! char *cleanname; char cleanp[CHAN_NAME_LEN]; ! cleanname = normalize_channel_name(partname); for (c = channels; c; c = c->next) { strcpy(cleanp, remove_markup(ChanName(c), NULL)); if (Chan_Can_See(c, player) && string_prefix(cleanp, cleanname)) { *** 1_7_7.772/src/db.c Thu, 13 Nov 2003 07:48:17 -0600 dunemush (pennmush/c/25_db.c 1.26.1.1.1.1.1.6.1.1.1.9 660) --- 1_7_7.846(w)/src/db.c Mon, 15 Mar 2004 16:22:03 -0600 dunemush (pennmush/c/25_db.c 1.26.1.1.1.1.1.6.1.1.1.10 660) *************** *** 41,47 **** #include "confmagic.h" #ifdef WIN32 ! #ifdef __MINGW32__ void shutdown_checkpoint(void); #endif #endif --- 41,47 ---- #include "confmagic.h" #ifdef WIN32 ! #ifndef __MINGW32__ void shutdown_checkpoint(void); #endif #endif *** 1_7_7.772/src/cque.c Thu, 11 Sep 2003 15:26:04 -0500 dunemush (pennmush/c/28_cque.c 1.36.1.5.1.1.1.1.1.1.1.2.1.6.1.10 660) --- 1_7_7.846(w)/src/cque.c Mon, 15 Mar 2004 16:22:03 -0600 dunemush (pennmush/c/28_cque.c 1.36.1.5.1.1.1.1.1.1.1.2.1.6.1.12 660) *************** *** 1053,1059 **** do_halt(player, "", player); else { if ((victim = ! noisy_match_result(player, arg1, NOTYPE, MAT_OBJECTS)) == NOTHING) return; if (!Owns(player, victim) && !HaltAny(player)) { notify(player, T("Permission denied.")); --- 1053,1060 ---- do_halt(player, "", player); else { if ((victim = ! noisy_match_result(player, arg1, NOTYPE, ! MAT_OBJECTS | MAT_HERE)) == NOTHING) return; if (!Owns(player, victim) && !HaltAny(player)) { notify(player, T("Permission denied.")); *** 1_7_7.772/src/conf.c Mon, 17 Nov 2003 11:57:56 -0600 dunemush (pennmush/c/31_conf.c 1.41.2.3.1.3.1.2.1.15.1.1.1.1.1.1.1.10 660) --- 1_7_7.846(w)/src/conf.c Mon, 15 Mar 2004 16:22:03 -0600 dunemush (pennmush/c/31_conf.c 1.41.2.3.1.3.1.2.1.15.1.1.1.1.1.1.1.15 660) *************** *** 42,77 **** time_t mudtime; /**< game time, in seconds */ - /** Runtime configuration parameter. - * This structure represents a runtime configuration option. - */ - typedef struct confparm { - const char *name; /**< name of option. */ - /** the function handler. */ - int (*handler) - (const char *opt, const char *val, void *loc, int maxval, int source); - void *loc; /**< place to put this option. */ - int max; /**< max: string length, integer value. */ - int overridden; /**< Has the default been overridden? */ - const char *group; /**< The option's group name */ - } CONF; - static void show_compile_options(dbref player); static char *config_list_helper(dbref player, CONF *cp, int lc); static char *config_list_helper2(dbref player, CONF *cp, int lc); OPTTAB options; /**< The table of configuration options */ - int cf_bool(const char *opt, const char *val, void *loc, int maxval, - int source); - int cf_str(const char *opt, const char *val, void *loc, int maxval, int source); - int cf_int(const char *opt, const char *val, void *loc, int maxval, int source); - int cf_dbref(const char *opt, const char *val, void *loc, int maxval, - int source); - int cf_flag(const char *opt, const char *val, void *loc, int maxval, - int source); - int cf_time(const char *opt, const char *val, void *loc, int maxval, - int source); int config_set(const char *opt, char *val, int source, int restrictions); void conf_default_set(void); --- 42,54 ---- time_t mudtime; /**< game time, in seconds */ static void show_compile_options(dbref player); static char *config_list_helper(dbref player, CONF *cp, int lc); static char *config_list_helper2(dbref player, CONF *cp, int lc); OPTTAB options; /**< The table of configuration options */ + HASHTAB local_options; /**< Hash table for local config options */ int config_set(const char *opt, char *val, int source, int restrictions); void conf_default_set(void); *************** *** 487,493 **** {NULL, NULL, NULL, 0, 0, NULL} }; - /** A runtime configuration group. * This struction represents the name and information about a group * of runtime configuration directives. Groups are used to organize --- 464,469 ---- *************** *** 522,527 **** --- 498,547 ---- {NULL, NULL, 0} }; + static CONF *new_config(void); + static CONF *get_config(const char *name); + + CONF * + new_config(void) + { + return ((CONF *) mush_malloc(sizeof(CONF), "config")); + } + + /** Add a new local runtime configuration parameter to local_options. + * This function will not override an existing local configuration + * option. + * \param name name of the configuration option. + * \param handler cf_* function to handle the option. + * \param loc address to store the value of the option. + * \param max maximum value allowed for the option. + * \param group name of the option group the option should display with. + * \return pointer to configuration structure or NULL for failure. + */ + CONF * + add_config(const char *name, config_func handler, void *loc, int max, + const char *group) + { + CONF *cnf; + if ((cnf = get_config(name))) + return cnf; + if ((cnf = new_config()) == NULL) + return NULL; + cnf->name = mush_strdup(strupper(name), "config name"); + cnf->handler = handler; + cnf->loc = loc; + cnf->max = max; + cnf->overridden = 0; + cnf->group = group; + hashadd(name, (void *) cnf, &local_options); + return cnf; + } + + CONF * + get_config(const char *name) + { + return ((CONF *) hashfind(name, &local_options)); + } + /** Parse a boolean configuration option. * \param opt name of the configuration option. * \param val value of the option. *************** *** 925,930 **** --- 945,962 ---- return i; } } + for (cp = (CONF *) hash_firstentry(&local_options); cp; + cp = (CONF *) hash_nextentry(&local_options)) { + int i = 0; + if ((!source || (cp->group && strcmp(cp->group, "files") != 0 + && strcmp(cp->group, "messages") != 0)) + && !strcasecmp(cp->name, opt)) { + i = cp->handler(opt, val, cp->loc, cp->max, source); + if (i) + cp->overridden = 1; + return i; + } + } if (source == 0) { do_rawlog(LT_ERR, T("CONFIG: directive '%s' in cnf file ignored.\n"), opt); *************** *** 1218,1223 **** --- 1250,1264 ---- cp->name); } } + for (cp = (CONF *) hash_firstentry(&local_options); cp; + cp = (CONF *) hash_nextentry(&local_options)) { + if (!cp->overridden) { + do_rawlog(LT_ERR, + T + ("CONFIG: local directive '%s' missing from cnf file. using default value."), + cp->name); + } + } /* these directives aren't player-settable but need to be initialized */ mudtime = time(NULL); *************** *** 1327,1332 **** --- 1368,1383 ---- } } if (!found) { + /* Ok, maybe a local option? */ + for (cp = (CONF *) hash_firstentry(&local_options); cp; + cp = (CONF *) hash_nextentry(&local_options)) { + if (cp->group && !strcasecmp(cp->name, type)) { + notify(player, config_list_helper(player, cp, lc)); + found = 1; + } + } + } + if (!found) { /* Wasn't found at all. Ok. */ notify(player, T("I only know the following types of options:")); for (cgp = confgroups; cgp->name; cgp++) { *************** *** 1339,1350 **** notify(player, cgp->desc); if (string_prefix("compile", type)) show_compile_options(player); ! else for (cp = conftable; cp->name; cp++) { if (cp->group && !strcmp(cp->group, cgp->name)) { notify(player, config_list_helper(player, cp, lc)); } } } } else { /* If we're here, we ran @config without a type. */ --- 1390,1408 ---- notify(player, cgp->desc); if (string_prefix("compile", type)) show_compile_options(player); ! else { for (cp = conftable; cp->name; cp++) { if (cp->group && !strcmp(cp->group, cgp->name)) { notify(player, config_list_helper(player, cp, lc)); } } + for (cp = (CONF *) hash_firstentry(&local_options); cp; + cp = (CONF *) hash_nextentry(&local_options)) { + if (cp->group && !strcasecmp(cp->group, cgp->name)) { + notify(player, config_list_helper(player, cp, lc)); + } + } + } } } else { /* If we're here, we ran @config without a type. */ *************** *** 1444,1474 **** { CONF *cp; - /* Never reached, since maxargs == 1 in the function table. - On second thought after writing it, I think having config() - set options as well as @config/set is a mistake. */ - if (nargs == 2) { /* Set the option */ - #ifdef FUNCTION_SIDE_EFFECTS - if (!Wizard(executor)) { - safe_str(T(e_perm), buff, bp); - return; - } - if (!args[0] || !*args[0]) { - safe_str(T("#-1 NO SUCH OPTION"), buff, bp); - return; - } - if (!config_set(args[0], args[1], 1, 0) - && !config_set(args[0], args[1], 1, 1)) { - safe_str(T("#-1 UNABLE TO SET OPTION"), buff, bp); - return; - } - /* Return the new value */ - #else - safe_str(T("#-1 TWO-ARGUMENT FORM OF FUNCTION DISABLED"), buff, bp); - return; - #endif - } - if (args[0] && *args[0]) { for (cp = conftable; cp->name; cp++) { if (cp->group && !strcasecmp(cp->name, args[0])) { --- 1502,1507 ---- *************** *** 1476,1485 **** --- 1509,1530 ---- return; } } + for (cp = (CONF *) hash_firstentry(&local_options); cp; + cp = (CONF *) hash_nextentry(&local_options)) { + if (cp->group && !strcasecmp(cp->name, args[0])) { + safe_str(config_list_helper2(executor, cp, 0), buff, bp); + return; + } + } safe_str(T("#-1 NO SUCH CONFIG OPTION"), buff, bp); return; } else { for (cp = conftable; cp->name; cp++) { + safe_str(cp->name, buff, bp); + safe_chr(' ', buff, bp); + } + for (cp = (CONF *) hash_firstentry(&local_options); cp; + cp = (CONF *) hash_nextentry(&local_options)) { safe_str(cp->name, buff, bp); safe_chr(' ', buff, bp); } *** 1_7_7.772/src/command.c Sun, 07 Dec 2003 11:07:54 -0600 dunemush (pennmush/c/36_command.c 1.56.1.1.1.1.1.1.1.2.1.1.1.1.1.5.1.2.1.1.1.1.1.2.1.3.1.10.1.1.3.26 660) --- 1_7_7.846(w)/src/command.c Mon, 15 Mar 2004 16:22:03 -0600 dunemush (pennmush/c/36_command.c 1.56.1.1.1.1.1.1.1.2.1.1.1.1.1.5.1.2.1.1.1.1.1.2.1.3.1.10.1.1.3.39 660) *************** *** 61,67 **** */ COMLIST commands[] = { ! {"@COMMAND", "ON OFF QUIET ENABLE DISABLE RESTRICT", cmd_command, CMD_T_PLAYER | CMD_T_EQSPLIT, 0, 0}, {"@@", NULL, cmd_null, CMD_T_ANY | CMD_T_NOPARSE, 0, 0}, {"@ALLHALT", NULL, cmd_allhalt, CMD_T_ANY, "WIZARD", HALT_ANYTHING}, --- 61,69 ---- */ COMLIST commands[] = { ! {"@COMMAND", ! "ADD DELETE EQSPLIT LSARGS RSARGS NOEVAL ON OFF QUIET ENABLE DISABLE RESTRICT", ! cmd_command, CMD_T_PLAYER | CMD_T_EQSPLIT, 0, 0}, {"@@", NULL, cmd_null, CMD_T_ANY | CMD_T_NOPARSE, 0, 0}, {"@ALLHALT", NULL, cmd_allhalt, CMD_T_ANY, "WIZARD", HALT_ANYTHING}, *************** *** 286,291 **** --- 288,294 ---- {"FOLLOW", NULL, cmd_follow, CMD_T_PLAYER | CMD_T_THING | CMD_T_NOGAGGED, 0, 0}, + {"GET", NULL, cmd_get, CMD_T_PLAYER | CMD_T_THING | CMD_T_NOGAGGED, 0, 0}, {"GIVE", "SILENT", cmd_give, CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_NOGAGGED, 0, 0}, *************** *** 295,301 **** {"KILL", NULL, cmd_kill, CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_NOGAGGED, 0, 0}, {"LOOK", "OUTSIDE", cmd_look, CMD_T_ANY, 0, 0}, {"LEAVE", NULL, cmd_leave, CMD_T_PLAYER | CMD_T_THING, 0, 0}, - {"MOVE", NULL, cmd_goto, CMD_T_PLAYER | CMD_T_THING, 0, 0}, {"PAGE", "BLIND NOEVAL LIST PORT OVERRIDE", cmd_page, CMD_T_ANY | CMD_T_RS_NOPARSE | CMD_T_NOPARSE | CMD_T_EQSPLIT | --- 298,303 ---- *************** *** 326,331 **** --- 328,338 ---- {"ATTRIB_SET", NULL, command_atrset, CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_NOGAGGED | CMD_T_INTERNAL, 0, 0}, + + /* A way to stop people starting commands with functions */ + {"WARN_ON_MISSING", NULL, cmd_warn_on_missing, + CMD_T_ANY | CMD_T_NOPARSE | CMD_T_INTERNAL, 0, 0}, + {NULL, NULL, NULL, 0, 0, 0} }; *************** *** 344,350 **** {"nobody", CMD_T_DISABLED}, {"nogagged", CMD_T_NOGAGGED}, {"noguest", CMD_T_NOGUEST}, ! {"nofix", CMD_T_NOFIXED}, {"logargs", CMD_T_LOGARGS}, {"logname", CMD_T_LOGNAME}, #ifdef DANGEROUS --- 351,357 ---- {"nobody", CMD_T_DISABLED}, {"nogagged", CMD_T_NOGAGGED}, {"noguest", CMD_T_NOGUEST}, ! {"nofixed", CMD_T_NOFIXED}, {"logargs", CMD_T_LOGARGS}, {"logname", CMD_T_LOGNAME}, #ifdef DANGEROUS *************** *** 370,376 **** safe_str(", ", buff, bp); safe_str(from, buff, bp); } - static int switch_find(COMMAND_INFO *cmd, char *sw) { --- 377,382 ---- *************** *** 413,419 **** * \return pointer to a newly allocated COMMAND_INFO structure. */ COMMAND_INFO * ! make_command(const char *name, int type, object_flag_type flagmask, int powers, switch_mask *sw, command_func func) { COMMAND_INFO *cmd; --- 419,426 ---- * \return pointer to a newly allocated COMMAND_INFO structure. */ COMMAND_INFO * ! make_command(const char *name, int type, ! object_flag_type flagmask, int powers, switch_mask *sw, command_func func) { COMMAND_INFO *cmd; *************** *** 519,526 **** * \return pointer to modified command entry, or NULL. */ COMMAND_INFO * ! command_modify(const char *name, int type, object_flag_type flagmask, ! int powers, switch_mask *sw, command_func func) { COMMAND_INFO *cmd; cmd = command_find(name); --- 526,534 ---- * \return pointer to modified command entry, or NULL. */ COMMAND_INFO * ! command_modify(const char *name, int type, ! object_flag_type flagmask, int powers, ! switch_mask *sw, command_func func) { COMMAND_INFO *cmd; cmd = command_find(name); *************** *** 571,577 **** /** Add an alias to the table of reserved aliases. * This function adds an alias to the table of reserved aliases, preventing * it from being matched for standard commands. It's typically used to ! * insure that 'e' will match a global 'east;e' exit rather than the * 'examine' command. * \param a alias to reserve. */ --- 579,585 ---- /** Add an alias to the table of reserved aliases. * This function adds an alias to the table of reserved aliases, preventing * it from being matched for standard commands. It's typically used to ! * insure that 'e' will match a global 'east;e' exit rather than the * 'examine' command. * \param a alias to reserve. */ *************** *** 584,590 **** /** Initialize command tables (before reading config file). * This function performs command table initialization that should take place ! * before the configuration file has been read. It initializes the * command prefix table and the reserved alias table, inserts all of the * commands from the commands array into the prefix table, initializes * the command permission prefix table, and inserts all the permissions --- 592,598 ---- /** Initialize command tables (before reading config file). * This function performs command table initialization that should take place ! * before the configuration file has been read. It initializes the * command prefix table and the reserved alias table, inserts all of the * commands from the commands array into the prefix table, initializes * the command permission prefix table, and inserts all the permissions *************** *** 608,615 **** for (cmd = commands; cmd->name; cmd++) { ptab_insert(&ptab_command, cmd->name, make_command(cmd->name, cmd->type, ! string_to_bits("FLAG", cmd->flagstr), cmd->powers, ! switchmask(cmd->switches), cmd->func)); } ptab_end_inserts(&ptab_command); --- 616,624 ---- for (cmd = commands; cmd->name; cmd++) { ptab_insert(&ptab_command, cmd->name, make_command(cmd->name, cmd->type, ! string_to_bits("FLAG", cmd->flagstr), ! cmd->powers, switchmask(cmd->switches), ! cmd->func)); } ptab_end_inserts(&ptab_command); *************** *** 796,803 **** return NULL; } /** Parse commands. ! * Parse the commands. This is the big one! * We distinguish parsing of input sent from a player at a socket * (in which case attribute values to set are not evaluated) and * input sent in any other way (in which case attribute values to set --- 805,819 ---- return NULL; } + #define command_parse_free_args \ + mush_free((Malloc_t) command, "string"); \ + mush_free((Malloc_t) swtch, "string"); \ + mush_free((Malloc_t) ls, "string"); \ + mush_free((Malloc_t) rs, "string"); \ + mush_free((Malloc_t) switches, "string") + /** Parse commands. ! * Parse the commands. This is the big one! * We distinguish parsing of input sent from a player at a socket * (in which case attribute values to set are not evaluated) and * input sent in any other way (in which case attribute values to set *************** *** 815,820 **** --- 831,837 ---- { char *command, *swtch, *ls, *rs, *switches; static char commandraw[BUFFER_LEN]; + static char exit_command[BUFFER_LEN], *ec; char *lsa[MAX_ARG]; char *rsa[MAX_ARG]; char *ap, *swp; *************** *** 852,857 **** --- 869,883 ---- string = p; memmove(ccom, (char *) ccom + 1, BUFFER_LEN - 1); } + if (*p == '[') { + if ((cmd = command_find("WARN_ON_MISSING"))) { + if (!(cmd->type & CMD_T_DISABLED)) { + cmd->func(cmd, player, cause, sw, string, NULL, NULL, ls, lsa, rs, rsa); + command_parse_free_args; + return NULL; + } + } + } switch (*p) { case '#': if (!Gagged(player) && Mobile(player)) *************** *** 859,869 **** /* Fall though is cool */ case '\0': /* Just in case. You never know */ ! mush_free((Malloc_t) command, "string"); ! mush_free((Malloc_t) swtch, "string"); ! mush_free((Malloc_t) ls, "string"); ! mush_free((Malloc_t) rs, "string"); ! mush_free((Malloc_t) switches, "string"); return NULL; case SAY_TOKEN: replacer = "SAY"; --- 885,891 ---- /* Fall though is cool */ case '\0': /* Just in case. You never know */ ! command_parse_free_args; return NULL; case SAY_TOKEN: replacer = "SAY"; *************** *** 886,919 **** case CHAT_TOKEN_ALIAS: #endif if (command_check_byname(player, "@chat") && parse_chat(player, p + 1)) { ! mush_free((Malloc_t) command, "string"); ! mush_free((Malloc_t) swtch, "string"); ! mush_free((Malloc_t) ls, "string"); ! mush_free((Malloc_t) rs, "string"); ! mush_free((Malloc_t) switches, "string"); return NULL; } #endif /* CHAT_SYSTEM */ /* And everything else */ default: ! /* EXCEPT exits, which have priority */ if (can_move(player, p)) { ! if (Mobile(player) && command_check_byname(player, "GOTO")) ! do_move(player, p, 0); ! mush_free((Malloc_t) command, "string"); ! mush_free((Malloc_t) swtch, "string"); ! mush_free((Malloc_t) ls, "string"); ! mush_free((Malloc_t) rs, "string"); ! mush_free((Malloc_t) switches, "string"); ! return NULL; } c = command; while (*p == ' ') p++; process_expression(command, &c, (const char **) &p, player, cause, cause, noevtoken ? PE_NOTHING : ! ((PE_DEFAULT & ~PE_FUNCTION_CHECK) | PE_COMMAND_BRACES), ! PT_SPACE, NULL); *c = '\0'; strcpy(commandraw, command); upcasestr(command); --- 908,937 ---- case CHAT_TOKEN_ALIAS: #endif if (command_check_byname(player, "@chat") && parse_chat(player, p + 1)) { ! command_parse_free_args; return NULL; } #endif /* CHAT_SYSTEM */ /* And everything else */ default: ! /* EXCEPT exits, which have priority. We still pass them through ! * the parser so @hook on GOTO can work on them. ! */ if (can_move(player, p)) { ! ec = exit_command; ! safe_str("GOTO ", exit_command, &ec); ! safe_str(p, exit_command, &ec); ! *ec = '\0'; ! p = string = exit_command; ! noevtoken = 1; /* But don't parse the exit name! */ } c = command; while (*p == ' ') p++; process_expression(command, &c, (const char **) &p, player, cause, cause, noevtoken ? PE_NOTHING : ! ((PE_DEFAULT & ~PE_FUNCTION_CHECK) | ! PE_COMMAND_BRACES), PT_SPACE, NULL); *c = '\0'; strcpy(commandraw, command); upcasestr(command); *************** *** 987,1006 **** PE_COMMAND_BRACES), PT_DEFAULT, NULL); } *c2 = '\0'; ! mush_free((Malloc_t) command, "string"); ! mush_free((Malloc_t) swtch, "string"); ! mush_free((Malloc_t) ls, "string"); ! mush_free((Malloc_t) rs, "string"); ! mush_free((Malloc_t) switches, "string"); return commandraw; } /* Check the permissions */ if (!command_check(player, cmd)) { ! mush_free((Malloc_t) command, "string"); ! mush_free((Malloc_t) swtch, "string"); ! mush_free((Malloc_t) ls, "string"); ! mush_free((Malloc_t) rs, "string"); ! mush_free((Malloc_t) switches, "string"); return NULL; } /* Parse out any switches */ --- 1005,1016 ---- PE_COMMAND_BRACES), PT_DEFAULT, NULL); } *c2 = '\0'; ! command_parse_free_args; return commandraw; } /* Check the permissions */ if (!command_check(player, cmd)) { ! command_parse_free_args; return NULL; } /* Parse out any switches */ *************** *** 1027,1037 **** } else { notify_format(player, T("%s doesn't know switch %s."), cmd->name, swtch); ! mush_free((Malloc_t) command, "string"); ! mush_free((Malloc_t) swtch, "string"); ! mush_free((Malloc_t) ls, "string"); ! mush_free((Malloc_t) rs, "string"); ! mush_free((Malloc_t) switches, "string"); return NULL; } } else { --- 1037,1043 ---- } else { notify_format(player, T("%s doesn't know switch %s."), cmd->name, swtch); ! command_parse_free_args; return NULL; } } else { *************** *** 1072,1078 **** if (cmd->type & CMD_T_EQSPLIT) { char *savep = p; command_argparse(player, cause, &p, ls, lsa, cmd, 0, noeval); ! if (noeval && *p) { /* oops, we have a right hand side, should have evaluated */ p = savep; command_argparse(player, cause, &p, ls, lsa, cmd, 0, 0); --- 1078,1084 ---- if (cmd->type & CMD_T_EQSPLIT) { char *savep = p; command_argparse(player, cause, &p, ls, lsa, cmd, 0, noeval); ! if (noeval && !noevtoken && *p) { /* oops, we have a right hand side, should have evaluated */ p = savep; command_argparse(player, cause, &p, ls, lsa, cmd, 0, 0); *************** *** 1087,1101 **** /* Finish setting up commandraw, if we may need it for hooks */ if (has_hook(&cmd->hooks.ignore) || has_hook(&cmd->hooks.override)) { p = command2; ! if (*p) { ! if (*p == ' ') { ! safe_chr(' ', commandraw, &c2); ! p++; } process_expression(commandraw, &c2, (const char **) &p, player, cause, cause, noevtoken ? PE_NOTHING : ! ((PE_DEFAULT & ~PE_FUNCTION_CHECK) | PE_COMMAND_BRACES), PT_DEFAULT, NULL); } *c2 = '\0'; } --- 1093,1137 ---- /* Finish setting up commandraw, if we may need it for hooks */ if (has_hook(&cmd->hooks.ignore) || has_hook(&cmd->hooks.override)) { p = command2; ! if (*p && (*p == ' ')) { ! safe_chr(' ', commandraw, &c2); ! p++; ! } ! if (cmd->type & CMD_T_ARGS) { ! int lsa_index; ! if (lsa[1]) { ! safe_str(lsa[1], commandraw, &c2); ! for (lsa_index = 2; lsa[lsa_index]; lsa_index++) { ! safe_chr(',', commandraw, &c2); ! safe_str(lsa[lsa_index], commandraw, &c2); ! } ! } ! } else { ! safe_str(ls, commandraw, &c2); ! } ! if (cmd->type & CMD_T_EQSPLIT) { ! safe_chr('=', commandraw, &c2); ! if (cmd->type & CMD_T_RS_ARGS) { ! int rsa_index; ! /* This is counterintuitive, but rsa[] ! * starts at 1. */ ! if (rsa[1]) { ! safe_str(rsa[1], commandraw, &c2); ! for (rsa_index = 2; rsa[rsa_index]; rsa_index++) { ! safe_chr(',', commandraw, &c2); ! safe_str(rsa[rsa_index], commandraw, &c2); ! } ! } ! } else { ! safe_str(rs, commandraw, &c2); } + #ifdef NEVER + /* We used to do this, but we're not sure why */ process_expression(commandraw, &c2, (const char **) &p, player, cause, cause, noevtoken ? PE_NOTHING : ! ((PE_DEFAULT & ~PE_EVALUATE) | PE_COMMAND_BRACES), PT_DEFAULT, NULL); + #endif } *c2 = '\0'; } *************** *** 1127,1140 **** } } ! mush_free((Malloc_t) command, "string"); ! mush_free((Malloc_t) swtch, "string"); ! mush_free((Malloc_t) ls, "string"); ! mush_free((Malloc_t) rs, "string"); ! mush_free((Malloc_t) switches, "string"); return retval; } /** Add a restriction to a command. * Given a command name and a restriction, apply the restriction to the * command in addition to whatever its usual restrictions are. --- 1163,1174 ---- } } ! command_parse_free_args; return retval; } + #undef command_parse_free_args + /** Add a restriction to a command. * Given a command name and a restriction, apply the restriction to the * command in addition to whatever its usual restrictions are. *************** *** 1225,1230 **** --- 1259,1336 ---- return 1; } + /** Command stub for \@command/add-ed commands. + * This does nothing more than notify the player + * with "This command has not been implemented" + */ + COMMAND (cmd_unimplemented) { + notify(player, "This command has not been implemented"); + } + + /** Adds a user-added command + * \verbatim + * This code implements @command/add, which adds a + * command with cmd_unimplemented as a stub + * \endverbatim + * \param player the enactor + * \param name the name + * \param flags CMD_T_* flags + */ + void + do_command_add(dbref player, char *name, int flags) + { + COMMAND_INFO *command; + + if (!God(player)) { + notify(player, T("Permission denied.")); + return; + } + name = trim_space_sep(name, ' '); + upcasestr(name); + command = command_find(name); + if (!command) { + if ((*name == 0) || strchr(name, ' ') || !ok_name(name) + || strchr(name, '\t') || strchr(name, '\n') + || strchr(name, '\r')) { + notify(player, T("Bad command name.")); + } else { + command_add(mush_strdup(name, "command_add"), + flags, NULL, + 0, (flags & CMD_T_NOPARSE ? NULL : "NOEVAL"), + cmd_unimplemented); + notify_format(player, T("Command %s added."), name); + } + } else { + notify_format(player, T("Command %s already exists"), command->name); + } + } + + /** Deletes a user-added command + * \verbatim + * This code implements @command/delete, which deletes a + * command added via @command/add + * \endverbatim + * \param player the enactor + * \param name name of the command to delete + */ + void + do_command_delete(dbref player, char *name) + { + COMMAND_INFO *command; + if (!God(player)) { + notify(player, T("Permission denied.")); + return; + } + command = command_find(name); + if (command->func != cmd_unimplemented) { + notify(player, + T("You can't delete built-in commands. @hook/override instead.")); + return; + } + notify_format(player, T("Removed %s from command table."), command->name); + ptab_delete(&ptab_command, name); + } + /** Definition of the \@command command. * This is the only command which should be defined in this * file, because it uses variables from this file, etc. *************** *** 1239,1244 **** --- 1345,1364 ---- notify(player, T("You must specify a command.")); return; } + if (SW_ISSET(sw, SWITCH_ADD)) { + int flags = CMD_T_ANY; + flags |= SW_ISSET(sw, SWITCH_NOEVAL) ? CMD_T_NOPARSE : 0; + flags |= SW_ISSET(sw, SWITCH_RSARGS) ? CMD_T_RS_ARGS : 0; + flags |= SW_ISSET(sw, SWITCH_LSARGS) ? CMD_T_LS_ARGS : 0; + flags |= SW_ISSET(sw, SWITCH_LSARGS) ? CMD_T_LS_ARGS : 0; + flags |= SW_ISSET(sw, SWITCH_EQSPLIT) ? CMD_T_EQSPLIT : 0; + do_command_add(player, arg_left, flags); + return; + } + if (SW_ISSET(sw, SWITCH_DELETE)) { + do_command_delete(player, arg_left); + return; + } command = command_find(arg_left); if (!command) { notify(player, T("No such command.")); *************** *** 1289,1297 **** if (command->type & CMD_T_SWITCHES) strccat(buff, &bp, "Switches"); if (command->type & CMD_T_NOGAGGED) ! strccat(buff, &bp, "Nogag"); if (command->type & CMD_T_NOFIXED) ! strccat(buff, &bp, "Nofix"); if (command->type & CMD_T_NOGUEST) strccat(buff, &bp, "Noguest"); if (command->type & CMD_T_EQSPLIT) --- 1409,1417 ---- if (command->type & CMD_T_SWITCHES) strccat(buff, &bp, "Switches"); if (command->type & CMD_T_NOGAGGED) ! strccat(buff, &bp, "Nogagged"); if (command->type & CMD_T_NOFIXED) ! strccat(buff, &bp, "Nofixed"); if (command->type & CMD_T_NOGUEST) strccat(buff, &bp, "Noguest"); if (command->type & CMD_T_EQSPLIT) *************** *** 1343,1355 **** } if (Wizard(player)) { if (GoodObject(command->hooks.before.obj)) ! notify_format(player, "@hook/before: #%d/%s", command->hooks.before.obj, command->hooks.before.attrname); if (GoodObject(command->hooks.after.obj)) notify_format(player, "@hook/after: #%d/%s", command->hooks.after.obj, command->hooks.after.attrname); if (GoodObject(command->hooks.ignore.obj)) ! notify_format(player, "@hook/ignore: #%d/%s", command->hooks.ignore.obj, command->hooks.ignore.attrname); if (GoodObject(command->hooks.override.obj)) notify_format(player, "@hook/override: #%d/%s", --- 1463,1477 ---- } if (Wizard(player)) { if (GoodObject(command->hooks.before.obj)) ! notify_format(player, "@hook/before: #%d/%s", ! command->hooks.before.obj, command->hooks.before.attrname); if (GoodObject(command->hooks.after.obj)) notify_format(player, "@hook/after: #%d/%s", command->hooks.after.obj, command->hooks.after.attrname); if (GoodObject(command->hooks.ignore.obj)) ! notify_format(player, "@hook/ignore: #%d/%s", ! command->hooks.ignore.obj, command->hooks.ignore.attrname); if (GoodObject(command->hooks.override.obj)) notify_format(player, "@hook/override: #%d/%s", *** 1_7_7.772/src/cmds.c Sun, 07 Dec 2003 11:07:54 -0600 dunemush (pennmush/c/37_cmds.c 1.33.1.1.1.2.1.2.2.3.1.1.1.2.1.1.1.3.1.8.1.1.2.2.2.20.1.3.1.7 660) --- 1_7_7.846(w)/src/cmds.c Mon, 15 Mar 2004 16:22:03 -0600 dunemush (pennmush/c/37_cmds.c 1.33.1.1.1.2.1.2.2.3.1.1.1.2.1.1.1.3.1.8.1.1.2.2.2.20.1.3.1.7.1.2 660) *************** *** 1049,1051 **** --- 1049,1059 ---- COMMAND (cmd_null) { return; } + + COMMAND (cmd_warn_on_missing) { + notify_format(Owner(player), + T + ("No command found in code by %s - don't start code with functions."), + unparse_dbref(player)); + return; + } *** 1_7_7.772/src/bsd.c Sat, 17 Jan 2004 13:58:58 -0600 dunemush (pennmush/c/38_bsd.c 1.58.1.11.1.2.1.5.1.7.1.14.1.13.1.9.1.4.1.2.1.12.1.1.1.1.1.2.1.1.1.13.1.1.1.1.1.1.1.1.1.1.1.3.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.3.1.8.2.1.1.1.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.9 660) --- 1_7_7.846(w)/src/bsd.c Mon, 15 Mar 2004 16:22:03 -0600 dunemush (pennmush/c/38_bsd.c 1.58.1.11.1.2.1.5.1.7.1.14.1.13.1.9.1.4.1.2.1.12.1.1.1.1.1.2.1.1.1.13.1.1.1.1.1.1.1.1.1.1.1.3.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.3.1.8.2.1.1.1.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.9.1.1 660) *************** *** 2407,2413 **** if (*q + 1 >= qend) return -1; if (*(*q + 1) == IAC) { ! safe_chr(IAC, tbuf, &bp); (*q)++; } else break; --- 2407,2413 ---- if (*q + 1 >= qend) return -1; if (*(*q + 1) == IAC) { ! safe_chr((char) IAC, tbuf, &bp); (*q)++; } else break; *** 1_7_7.772/src/boolexp.c Wed, 29 Oct 2003 14:21:02 -0600 dunemush (pennmush/c/39_boolexp.c 1.1.1.17.1.1.1.13.1.2.1.11 660) --- 1_7_7.846(w)/src/boolexp.c Mon, 15 Mar 2004 16:22:03 -0600 dunemush (pennmush/c/39_boolexp.c 1.1.1.17.1.1.1.13.1.2.1.13 660) *************** *** 241,247 **** static char * safe_get_bytecode(boolexp b) __attribute_malloc__; ! static char *get_bytecode(boolexp b, int *storelen); static struct boolexp_node *alloc_bool(void) __attribute_malloc__; static struct boolatr *alloc_atr(const char *name, const char *s) __attribute_malloc__; --- 241,247 ---- static char * safe_get_bytecode(boolexp b) __attribute_malloc__; ! static char *get_bytecode(boolexp b, u_int_16 * storelen); static struct boolexp_node *alloc_bool(void) __attribute_malloc__; static struct boolatr *alloc_atr(const char *name, const char *s) __attribute_malloc__; *************** *** 303,309 **** static char *safe_get_bytecode(boolexp b) { char *bytecode; ! int len; len = chunk_len(b); bytecode = mush_malloc(len, "boolexp.bytecode"); --- 303,309 ---- static char *safe_get_bytecode(boolexp b) { char *bytecode; ! u_int_16 len; len = chunk_len(b); bytecode = mush_malloc(len, "boolexp.bytecode"); *************** *** 316,325 **** * \return a static copy of the bytecode. */ static char * ! get_bytecode(boolexp b, int *storelen) { static char bytecode[BUFFER_LEN * 2]; ! int len; len = chunk_fetch(b, bytecode, sizeof bytecode); if (storelen) --- 316,325 ---- * \return a static copy of the bytecode. */ static char * ! get_bytecode(boolexp b, u_int_16 * storelen) { static char bytecode[BUFFER_LEN * 2]; ! u_int_16 len; len = chunk_fetch(b, bytecode, sizeof bytecode); if (storelen) *************** *** 340,346 **** { boolexp r; char *bytecode; ! int len = 0; if (b == TRUE_BOOLEXP) return TRUE_BOOLEXP; --- 340,346 ---- { boolexp r; char *bytecode; ! u_int_16 len = 0; if (b == TRUE_BOOLEXP) return TRUE_BOOLEXP; *************** *** 1489,1495 **** struct bvm_asmnode *i; struct bvm_strnode *s; char *pc, *bytecode; ! int blen, len; if (!a) return TRUE_BOOLEXP; --- 1489,1495 ---- struct bvm_asmnode *i; struct bvm_strnode *s; char *pc, *bytecode; ! u_int_16 len, blen; if (!a) return TRUE_BOOLEXP; *** 1_7_7.772/src/attrib.c Thu, 13 Nov 2003 07:48:17 -0600 dunemush (pennmush/c/40_attrib.c 1.15.1.2.1.5.1.1.1.3.1.3.1.2.1.2.1.2.2.1.1.2.1.2.1.2.1.1.1.3.1.1.1.1.1.1.3.43 660) --- 1_7_7.846(w)/src/attrib.c Mon, 15 Mar 2004 16:22:03 -0600 dunemush (pennmush/c/40_attrib.c 1.15.1.2.1.5.1.1.1.3.1.3.1.2.1.2.1.2.2.1.1.2.1.2.1.2.1.1.1.3.1.1.1.1.1.1.3.43.1.1 660) *************** *** 1140,1150 **** strcpy(tbuf1, s); fwdstr = trim_space_sep(tbuf1, ' '); while ((curr = split_token(&fwdstr, ' ')) != NULL) { ! if (!is_dbref(curr))