This is patch29 to PennMUSH 1.7.7. After applying this patch, you will have version 1.7.7p29 *** BACK UP YOUR DATABASES BEFORE USING THIS PATCH. IT MAKES IRREVOCABLE *** CHANGES TO THE WAY POWERS ARE STORED (AKIN TO THE FLAG REWRITE). To apply this patch, save it to a file in your top-level MUSH directory, and do the following: patch -p1 < 1.7.7-patch29 ./Configure -d make update make install If you use GNU patch 2.2, you probably want the above to be 'patch -b -p1', not just 'patch -p1'. You should expect to be asked about removing 'CRYPT_SYSTEM' from options.h, and you should agree to remove it. *sniff* 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: * Anonymous attributes via #lambda. See help anonymous attributes. [SW] * Wizards (other than God) and royalty are no longer treated as No_Pay unless the No_Pay power is explicitly set on them, although they can still give (themselves or others) as many pennies as they wish. This helps stop runaway wizards in the queue (they'll run out of cash like anyone else). To get the old behavior back, @power your admin No_Pay. You probably want to @power any globals that use search(), children(), mail*stats(), etc, No_Pay as well. Suggested by Walker@M*U*S*H. * game/restrict.cnf, alias.cnf, names.cnf are renamed in the tarball and made with make update like mush.cnf. Suggested by Philip Mak. [SW] * @powers now operate under the same code as the @flag system, so God can add and modify powers in the MUSH with @power/add, etc. Commands: * @nsemit, @nsoemit, @nslemit, @nsremit, @nszemit and function forms of the same. Suggested by Cloud@M*U*S*H. Functions: * andlpowers(), orlpowers(), andpowers(), orpowers(). * align() performs fancy text alignment tricks. Patch by Walker@M*U*S*H. * sent() and recv() show more player descriptor data from SESSION. Suggested by Ricochet@M*U*S*H. * scan() with a single argument assumes the executor's point of view. Suggested by Cheetah@M*U*S*H. * valid() can also check for syntactically correct passwords, command names, and function names. Minor changes: * No more CRYPT_SYSTEM in options.h. We try everything and we always reset passwords to SHS. Patch by Vadiv@M*U*S*H. * Wizards and other privileged players can @chan/recall on channels they're not on. Suggested by Trispis@M*U*S*H. [SW] * A separate ip address to bind the SSL port to can now be specified in mush.cnf. * @flag/type allows God to change flag types. Suggested by Renee@ShoreSide. * After each @startup is enqueued (during startup or @restart/all), we immediately run up to 5 queue cycles. This allows, e.g., God's @startup to up to five levels of @dol/@tr/@switch/etc and still have the queued code run ahead of other startups. This requires that you keep God's dbref as #1. Based on comments by Philip Mak and o Trispis@M*U*S*H. * The message after successful @password is now clearer, to avoid confusion in some unusual cases. Report by Kholnuu. * Makefile is no longer set executable. Report by Luke@M*U*S*H. * Server now handles telnet NOP and AYT commands. Suggested by Philip Mak and Liz (author of Muckclient). * announce.c is no longer distributed. portmsg.c cleanup. Fixes: * @undestroy on an invalid (garbage, or !going) object now produces an error message. Suggested by T'orA@M*U*S*H. * On shutdowns, all queue deposits are now refunded. * Ansi behavior on second and later lines of text fixed by Walker@M*U*S*H. * Database reading improvements for win32 - ideally, you should now be able to read a database written on win32/unix on either system. * allof() now evaluates its separator argument. [SW] * firstof() doesn't add an extra space before the value it returns. [SW] * Slackware portability fixes by Dale @ Wolfpaw.net hosting * ]page properly noevals (the right hand side) now. Report by Cheetah@M*U*S*H. * Partial channel match listings no longer reveal channels the player isn't allowed to see. Report by Taz. * Help fixes by Trispis@M*U*S*H and Tanaku@M*U*S*H. * ssl() and terminfo() don't work on other players unless you're See_All, as promised. Based on patch by Tanaku@M*U*S*H. * lcon, etc. all do an INTERACT_SEE interaction check now. Suggested by Thor@bDv. * Code cleanup. [SW] * Fixes from 1.7.6p16 Prereq: 1.7.7p28 *** 1_7_7.848/Patchlevel Sat, 13 Mar 2004 10:36:10 -0600 dunemush (pennmush/5_Patchlevel 1.17.1.11.1.30 600) --- 1_7_7.919(w)/Patchlevel Wed, 28 Apr 2004 09:46:34 -0500 dunemush (pennmush/5_Patchlevel 1.17.1.11.1.31 600) *************** *** 1,2 **** Do not edit this file. It is maintained by the official PennMUSH patches. ! This is PennMUSH 1.7.7p28 --- 1,2 ---- Do not edit this file. It is maintained by the official PennMUSH patches. ! This is PennMUSH 1.7.7p29 *** 1_7_7.848/CHANGES.176 Wed, 28 Jan 2004 12:11:20 -0600 dunemush (pennmush/g/17_CHANGES 1.10.1.6.1.2.1.2.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.3.1.1.1.1.1.9.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.1.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.2.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.2 600) --- 1_7_7.919(w)/CHANGES.176 Wed, 28 Apr 2004 10:32:36 -0500 dunemush (pennmush/g/17_CHANGES 1.10.1.6.1.2.1.2.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.3.1.1.1.1.1.9.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.1.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.2.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1 600) *************** *** 13,18 **** --- 13,24 ---- ========================================================================== + Version 1.7.6 patchlevel 16 April 28, 2004 + + Fixes: + * PCRE updated to 4.5 [SW] + + Version 1.7.6 patchlevel 15 January 25, 2004 Fixes: *** 1_7_7.848/CHANGES.177 Mon, 15 Mar 2004 16:39:19 -0600 dunemush (pennmush/g/23_CHANGES 1.48.1.258.1.14.1.18 600) --- 1_7_7.919(w)/CHANGES.177 Wed, 28 Apr 2004 09:46:51 -0500 dunemush (pennmush/g/23_CHANGES 1.48.1.258.1.14.1.53 600) *************** *** 18,23 **** --- 18,93 ---- ========================================================================== + Version 1.7.7 patchlevel 29 April 28, 2004 + + Major changes: + * Anonymous attributes via #lambda. See help anonymous attributes. [SW] + * Wizards (other than God) and royalty are no longer treated as No_Pay + unless the No_Pay power is explicitly set on them, although they + can still give (themselves or others) as many pennies as they wish. + This helps stop runaway wizards in the queue (they'll run out of cash + like anyone else). To get the old behavior back, @power your admin + No_Pay. You probably want to @power any globals that use search(), + children(), mail*stats(), etc, No_Pay as well. Suggested by Walker@M*U*S*H. + * game/restrict.cnf, alias.cnf, names.cnf are renamed in the tarball and + made with make update like mush.cnf. Suggested by Philip Mak. [SW] + * @powers now operate under the same code as the @flag system, so God + can add and modify powers in the MUSH with @power/add, etc. + Commands: + * @nsemit, @nsoemit, @nslemit, @nsremit, @nszemit and function forms + of the same. Suggested by Cloud@M*U*S*H. + Functions: + * andlpowers(), orlpowers(), andpowers(), orpowers(). + * align() performs fancy text alignment tricks. Patch by Walker@M*U*S*H. + * sent() and recv() show more player descriptor data from SESSION. + Suggested by Ricochet@M*U*S*H. + * scan() with a single argument assumes the executor's point of + view. Suggested by Cheetah@M*U*S*H. + * valid() can also check for syntactically correct passwords, + command names, and function names. + Minor changes: + * No more CRYPT_SYSTEM in options.h. We try everything and we + always reset passwords to SHS. Patch by Vadiv@M*U*S*H. + * Wizards and other privileged players can @chan/recall on channels they're + not on. Suggested by Trispis@M*U*S*H. [SW] + * A separate ip address to bind the SSL port to can now be specified + in mush.cnf. + * @flag/type allows God to change flag types. Suggested by Renee@ShoreSide. + * After each @startup is enqueued (during startup or @restart/all), + we immediately run up to 5 queue cycles. This allows, e.g., God's + @startup to up to five levels of @dol/@tr/@switch/etc and still have + the queued code run ahead of other startups. This requires that you + keep God's dbref as #1. Based on comments by Philip Mak and o + Trispis@M*U*S*H. + * The message after successful @password is now clearer, to avoid + confusion in some unusual cases. Report by Kholnuu. + * Makefile is no longer set executable. Report by Luke@M*U*S*H. + * Server now handles telnet NOP and AYT commands. Suggested by + Philip Mak and Liz (author of Muckclient). + * announce.c is no longer distributed. portmsg.c cleanup. + Fixes: + * @undestroy on an invalid (garbage, or !going) object now produces + an error message. Suggested by T'orA@M*U*S*H. + * On shutdowns, all queue deposits are now refunded. + * Ansi behavior on second and later lines of text fixed by Walker@M*U*S*H. + * Database reading improvements for win32 - ideally, you should now + be able to read a database written on win32/unix on either system. + * allof() now evaluates its separator argument. [SW] + * firstof() doesn't add an extra space before the value it returns. [SW] + * Slackware portability fixes by Dale @ Wolfpaw.net hosting + * ]page properly noevals (the right hand side) now. Report by + Cheetah@M*U*S*H. + * Partial channel match listings no longer reveal channels the player + isn't allowed to see. Report by Taz. + * Help fixes by Trispis@M*U*S*H and Tanaku@M*U*S*H. + * ssl() and terminfo() don't work on other players unless you're + See_All, as promised. Based on patch by Tanaku@M*U*S*H. + * lcon, etc. all do an INTERACT_SEE interaction check now. + Suggested by Thor@bDv. + * Code cleanup. [SW] + * Fixes from 1.7.6p16 + + Version 1.7.7 patchlevel 28 March 12, 2004 Major changes: *** 1_7_7.848/game/txt/hlp/penntop.hlp Thu, 26 Feb 2004 16:14:14 -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) --- 1_7_7.919(w)/game/txt/hlp/penntop.hlp Mon, 05 Apr 2004 00:18:23 -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.8.1.4 600) *************** *** 17,23 **** On many MUSHes, list local commands with: +help If there are any errors in the help text, please notify a wizard ! in the game, or send mail to dunemush@pennmush.org. & newbie --- 17,25 ---- On many MUSHes, list local commands with: +help If there are any errors in the help text, please notify a wizard ! in the game, or send mail to dunemush@pennmush.org, who maintains ! PennMUSH (and its distributed help files) but probably has no relation ! to this MUSH in particular. & newbie *************** *** 76,92 **** & topics Help is available on the following topics: ! ACTION LISTS ANCESTORS ATTRIB-OWNERSHIP ! ATTRIBUTES BEING KILLED BOOLEAN VALUES ! CHAT CLIENTS CONTROL ! COPYRIGHT COSTS CREDITS ! DBREFS DROP-TO ENACTOR ! EVALUATION EXECUTOR EXITS ! FAILURE FLAGS FUNCTIONS ! GENDER GLOBALS HERE ! HOMES INTERIORS LINKING ! LISTENING LISTS LOOPING ! MASTER ROOM MATCHING (continued in help topics2) & topics2 --- 78,94 ---- & topics Help is available on the following topics: ! ACTION LISTS ANCESTORS ANONYMOUS ATTRIBUTES ! ATTRIB-OWNERSHIP ATTRIBUTES BEING KILLED ! BOOLEAN VALUES CHAT CLIENTS ! CONTROL COPYRIGHT COSTS ! CREDITS DBREFS DROP-TO ! ENACTOR EVALUATION EXECUTOR ! EXITS FAILURE FLAGS ! FUNCTIONS GENDER GLOBALS ! HERE HOMES INTERIORS ! LINKING LISTENING LISTS ! LOOPING MASTER ROOM MATCHING (continued in help topics2) & topics2 *************** *** 160,170 **** type of the *child* object, as is the check of the ORPHAN flag. See also: PARENTS, ORPHAN ! & ATTRIB-OWNERSHIP ATTRIBUTE OWNERSHIP ! The first person who creates an attribute on an object is the owner of that attribute. If you lock an attribute, using the @atrlock command, only the person who owns the attribute will be able to alter the attribute. This allows you to create standard commands on objects and --- 162,231 ---- type of the *child* object, as is the check of the ORPHAN flag. See also: PARENTS, ORPHAN ! & ANONYMOUS ATTRIBUTES ! & LAMBDA ! In many cases where a function expects a object/attribute pair ! that refers to an attribute to evaluate, you can use the form ! ! #lambda/ ! ! instead, and the code will be treated as an attribute's body. ! The code will normally be parsed twice, so special characters ! should be escaped where needed. ! ! These anonymous attributes should be used for short and simple ! pieces of code. Anything long or complicated should go in an ! actual attribute, for readability and maintainability. ! ! See HELP ANONYMOUS2 for examples. ! & ANONYMOUS2 ! A typical usage of anonymous attributes would be to convert ! a list of dbrefs to names, as so: ! ! >say map(#lambda/name(\%0), #3 #12 #23) ! You say, "Joe Robert Sally" ! ! Because the code is parsed twice, you can actually build parts of ! it in place, which is very convenient. Consider this implementation ! of a lattrval function, which is like lattr() but it only returns ! non-empty attributes: ! ! &lattrval me= ! filter(#lambda/hasattrval([secure(before(%0, /))], \%0), lattr(%0)) ! ! The first time '#lambda/hasattrval([secure(before(%0, /))], \%0)' is ! parsed in a call like 'u(lattrval, #1234)', it is turned into ! '#lambda/hasattrval(#1234, %0)', thus avoiding the need for a setq() or ! the like to store the top-level %0 for use in a real attribute called by ! filter(). However, this can lead to problems with evaluating un-trusted ! code. Use secure() or escape() where neccessary. ! ! See HELP ANONYMOUS3 for another example. ! & ANONYMOUS3 ! ! You can also use lit() to avoid having the code evaluated twice, if ! needed. For example, this code, which returns all unlinked exits in ! a room: ! ! &lunlinked me=filter(lit(#lambda/strmatch(loc(%0), #-1)), lexits(%0)) ! ! This approach is useful both for security in making it harder to evaluate ! a string that shouldn't be, and for making the code look nicer by not ! having to escape percent signs, brackets, and other special ! characters. However, it also makes it harder to build the code string on ! the fly. Use what's most appropriate. ! ! See HELP ANONYMOUS4 for a list of functions that support anonymous ! attributes. ! & ANONYMOUS4 ! The following functions support anonymous attributes: ! ! filter() filterbool() fold() foreach() map() ! mix() munge() sortby() step() & ATTRIB-OWNERSHIP ATTRIBUTE OWNERSHIP ! The latest person to set an attribute on an object is the owner of that attribute. If you lock an attribute, using the @atrlock command, only the person who owns the attribute will be able to alter the attribute. This allows you to create standard commands on objects and *************** *** 459,464 **** --- 520,526 ---- & %# & %N & %~ + & %: & ENACTOR The enactor is the object that does something (enacts something :). This is an important concept in MUSH, because the way many commands *************** *** 470,476 **** %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 --- 532,538 ---- %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, like objid(%#) 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 *************** *** 1504,1510 **** %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 If the ENACTOR's gender is set, you can use these substitutions to get the --- 1566,1573 ---- %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, like objid(%#) ! (continued in help SUBSTITUTIONS2) & SUBSTITUTIONS2 If the ENACTOR's gender is set, you can use these substitutions to get the *** 1_7_7.848/game/txt/hlp/pennmail.hlp Sun, 15 Sep 2002 15:53:06 -0500 dunemush (pennmush/15_pennmail.h 1.10 600) --- 1_7_7.919(w)/game/txt/hlp/pennmail.hlp Mon, 05 Apr 2004 00:46:37 -0500 dunemush (pennmush/15_pennmail.h 1.11 600) *************** *** 125,132 **** @mail/nuke Only wizards may stats players other than themselves. The mail statistics ! commands are computationally expensive, and thus are subject to "daytime" ! restrictions. They also cost the same as a @find (100 pennies). The /debug switch does sanity checking on the mail database, and may only be used by a wizard. "@mail/debug sanity" just does the check; the command --- 125,131 ---- @mail/nuke Only wizards may stats players other than themselves. The mail statistics ! commands are computationally expensive and cost the same as @find. The /debug switch does sanity checking on the mail database, and may only be used by a wizard. "@mail/debug sanity" just does the check; the command *** 1_7_7.848/game/txt/hlp/pennfunc.hlp Mon, 15 Mar 2004 16:39:19 -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.38 600) --- 1_7_7.919(w)/game/txt/hlp/pennfunc.hlp Mon, 05 Apr 2004 00:18:57 -0500 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.1.1.5 600) *************** *** 103,109 **** Communication functions are side-effect functions that send a message to an object or objects. ! cemit() emit() lemit() nspemit() oemit() pemit() remit() zemit() & Connection functions Connection functions return information about the connections open --- 103,110 ---- Communication functions are side-effect functions that send a message to an object or objects. ! cemit() emit() lemit() nsemit() nslemit() ! nsoemit() nspemit() nsremit() nszemit() oemit() pemit() remit() zemit() & Connection functions Connection functions return information about the connections open *************** *** 111,118 **** cmds() conn() doing() height() hostname() hidden() idle() ipaddr() lports() lwho() ! mwho() ports() pueblo() ssl() terminfo() ! width() & Dbref functions Dbref functions return a dbref or list of dbrefs related to some value on an object. --- 112,119 ---- cmds() conn() doing() height() hostname() hidden() idle() ipaddr() lports() lwho() ! mwho() ports() pueblo() recv() sent() ! ssl() terminfo() width() & Dbref functions Dbref functions return a dbref or list of dbrefs related to some value on an object. *************** *** 333,338 **** --- 334,382 ---- > think after(foo bar baz,ba) r baz + & ALIGN() + align(,,..,[,[,[,]) + + Creates columns of text, each column designated by . + Each column is individually wrapped inside its own column, allowing + for easy creation of book pages, newsletters, or the like. + + is a space-separated list of column widths. '10 10 10' for + the widths argument specifies that there are 3 columns, each 10 + spaces wide. You can further modify this by prefixing the number + with '<', '-' or '>'. A < before a number causes the field to be + left-aligned. A '-' causes it to be centered, and '>' makes it + right-aligned. No prefix defaults to left-aligned. A '.' after the + number implies the column is to be repeated for as long as there is + a non-repeating column. + + is a single character that, if given, is the character used + to fill empty columns and remaining spaces. , if given, is + inserted between every column, on every row. , if given, is + inserted between every line. By default, and are + a space, and is a newline. + + Continued in HELP ALIGN2 + & ALIGN2 + Examples: + + > &line me=align(<5 10 20,\([left(xget(%0,sex),1)]\),name(%0),name(%L)) + > th iter(lwho(),u(line,##)) + (M) Walker Tree + (F) Jane Doe Nowhere + + > &haiku me = Alignment function,%rIt justifies your writing,%rBut the + words still suck.%rLuke + + > th [align(5 -40 5,,[repeat(-,40)]%r[u(haiku)]%r[repeat(-,40)],,%b,+) + + +----------------------------------------+ + + Alignment function, + + + It justifies your writing, + + + But the words still suck. + + + Luke + + +----------------------------------------+ + & ALLOF() allof([, ...,], ) *************** *** 656,661 **** --- 700,725 ---- player requires privileged power such as Wizard, Royalty or SEE_ALL. See also: Connection Functions + & SENT() + sent() + + Returns the number of characters sent by a player during this + connection as indicated by SESSION. + + The caller can use the function on himself, but using on any other + player requires privileged power such as Wizard, Royalty or SEE_ALL. + + See also: Connection Functions + & RECV() + recv() + + Returns the number of characters received by a player during this + connection as indicated by SESSION. + + The caller can use the function on himself, but using on any other + player requires privileged power such as Wizard, Royalty or SEE_ALL. + + See also: Connection Functions & COMP() comp(, [, ]) *************** *** 1047,1055 **** --- 1111,1122 ---- See also: @lock, locktypes & EMIT() emit() + nsemit() Sends a message to the room, as per @emit. + nsemit() is a wizard-only variation that works like @nsemit. + & ENCRYPT() encrypt(, ) *************** *** 1172,1177 **** --- 1239,1246 ---- > &IS_ODD test=[mod(%0,2)] > say [filter(test/is_odd, 1 2 3 4 5 6)] You say, "1 3 5" + + See also: anonymous attributes & FINDABLE() findable(,) *************** *** 1292,1297 **** --- 1361,1368 ---- > &ADD_NUMS test=add(%0,%1) > say [fold(test/add_nums,1 2 3 4 5)] You say, "15" + + See also: anonymous attributes & FOLDERSTATS() folderstats() folderstats(folder#) *************** *** 1341,1346 **** --- 1412,1419 ---- > &is_alphanum me=[regmatch(%0, \[\[:alnum:\]\])]%b > say [foreach(is_alphanum,jt1o+)] You say, "1 1 1 1 0 " + + See also: anonymous attributes & ACCNAME() accname() *************** *** 1857,1865 **** --- 1930,1941 ---- & LEMIT() lemit() + nslemit() Sends a message to the outermost room, as per @lemit. + nslemit() is a wizard-only variation that works like @nslemit. + & LEXITS() lexits() *************** *** 2246,2252 **** > say [map(times_two,1;2;3;4;5,;)] You say, "2;4;6;8;10" ! & MATCH() match(, [, ]) --- 2322,2329 ---- > say [map(times_two,1;2;3;4;5,;)] You say, "2;4;6;8;10" ! ! See also: anonymous attributes & MATCH() match(, [, ]) *************** *** 2359,2365 **** > &add_nums me=[add(%0, %1, %2)] > say [mix(add_nums, 1:1:1, 2:2:2, 3:3:3, :)] You say, "6:6:6" ! & MOD() & MODULO() & MODULUS() --- 2436,2443 ---- > &add_nums me=[add(%0, %1, %2)] > say [mix(add_nums, 1:1:1, 2:2:2, 3:3:3, :)] You say, "6:6:6" ! ! See also: anonymous attributes & MOD() & MODULO() & MODULUS() *************** *** 2464,2469 **** --- 2542,2549 ---- > &faction_members me=#3 #12 #234 > say [munge(sort,iter(v(faction_members),conn(##)),v(faction_members))] You say, "#12 #234 #3" + + See also: anonymous attributes & MWHO() mwho() *************** *** 2542,2557 **** see help BOOLEAN VALUES for details. See also: and(), or(), nor(), xor() - & NSPEMIT() - nspemit(,) - This wizard-only function will send each object on the list a - message, as per the @nspemit/list command. It returns nothing. It is - similar to pemit(), except it does not include any nospoof information. - Like @nspemit, it is meant for use with globals where nospoof - information isn't wanted. - - See also: pemit(), @nspemit & NUM() num() --- 2622,2628 ---- *************** *** 2585,2590 **** --- 2656,2663 ---- that if an object's dbref is recycled, the new object won't be mistaken for the old object. + The substitution %: returns the object id of the enacting object. + & OBJMEM() objmem() *************** *** 2595,2604 **** --- 2668,2680 ---- & OEMIT() oemit([/] [ ...],) + nsoemit([/] [ ...],) Sends to all objects in (default is the location of (s)) except (s), as per @oemit. + nsoemit() is a wizard-only variation that works like @nsoemit. + & OPEN() open(, ) *************** *** 2658,2667 **** --- 2734,2747 ---- In this case, you must control the object. & PEMIT() pemit(,) + nspemit(,) This function will send each object on the list a message, as per the @pemit/list command. It returns nothing. It respects page-locks and HAVEN flags on players. + + nspemit() is a wizard-only variation that works like @nspemit/list. + & PI() pi() *************** *** 2820,2827 **** If the specified register is -1, the substring is not copied into a register. Under regmatchi, case of the substring may be modified. ! For example, if is 'cookies=30', and is '(.+)=([0-9]*)' ! (parsed; note that escaping may be necessary), then the 0th substring matched is 'cookies=30', the 1st substring is 'cookies', and the 2nd substring is '30'. If is '0 3 5', then %q0 will become "cookies=30", %q3 will become "cookies", and %q5 will become "30". --- 2900,2907 ---- If the specified register is -1, the substring is not copied into a register. Under regmatchi, case of the substring may be modified. ! For example, in regmatch( cookies=30 , (.+)=(\[0-9\]*) ) ! (note use of escaping for MUSH parser), then the 0th substring matched is 'cookies=30', the 1st substring is 'cookies', and the 2nd substring is '30'. If is '0 3 5', then %q0 will become "cookies=30", %q3 will become "cookies", and %q5 will become "30". *************** *** 2833,2841 **** --- 2913,2923 ---- See also: regrab() & REMIT() remit(, ) + nsremit(, ) Sends a message to the contents of , as per @remit. + nsremit() is a wizard-only variation that works like @nsremit. & REMOVE() remove(,[,]) *************** *** 2985,2996 **** --- 3067,3082 ---- & SCAN() scan(, ) + scan() This function works like @scan, and returns a space-separated list of dbref/attribute pairs containing $commands that would be triggered if were run by . You must control or be See_All to use this function. + If no is specified, this function works like @scan run + by the function's executor. + & SCRAMBLE() scramble() *************** *** 3213,3218 **** --- 3299,3306 ---- Warning: the function invocation limit applies to this function. If this limit is exceeded, the function will fail _silently_. List and function sizes should be kept reasonable. + + See also: anonymous attributes & SOUNDEX() soundex() *************** *** 3357,3363 **** 1 - 2 - 3 4 - 5 - ! See also: map(), iter() & STDDEV() stddev(,...) --- 3445,3451 ---- 1 - 2 - 3 4 - 5 - ! See also: map(), iter(), anonymous attributes & STDDEV() stddev(,...) *************** *** 3912,3917 **** --- 4000,4008 ---- attrname Test for a valid attribute name. playername Test for a valid player name that can be set with @name or @alias. + password Test for a valid password. + command Test for a valid command name for @command/add + function Test for a valid function name for @function > think valid(name,Foobar) 1 *************** *** 4106,4114 **** --- 4197,4208 ---- See also: and(), or(), not(), nor() & ZEMIT() zemit(, ) + nszemit(, ) Sends a message to everything zoned to , as per @zemit. Costs apply. + + nszemit() is a wizard-only variation that works like @nszemit. & ZFUN() zfun(, , , ... ) *** 1_7_7.848/game/txt/hlp/penncmd.hlp Mon, 15 Mar 2004 12:34:39 -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) --- 1_7_7.919(w)/game/txt/hlp/penncmd.hlp Mon, 29 Mar 2004 00:03:05 -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.22 600) *************** *** 56,62 **** @dolist @drain @edit @emit @entrances @find @force @function @gedit @grep @halt @lemit @listmotd @mail @map ! @notify @nspemit @oemit @password @pemit @ps @remit @restart @scan @search @select @stats @sweep @switch @teleport @trigger @verb @version @wait @whereis --- 56,63 ---- @dolist @drain @edit @emit @entrances @find @force @function @gedit @grep @halt @lemit @listmotd @mail @map ! @notify @nsemit @nslemit @nsoemit @nspemit ! @nsremit @nszemit @oemit @password @pemit @ps @remit @restart @scan @search @select @stats @sweep @switch @teleport @trigger @verb @version @wait @whereis *************** *** 1343,1348 **** --- 1344,1350 ---- @flag/alias = @flag/letter [=] @flag/restrict =[], [] + @flag/type = @flag/enable @flag/disable *************** *** 1358,1363 **** --- 1360,1366 ---- /alias adds a new alias for an existing flag /letter changes or removes a single-letter alias for an existing flag. /restrict changes flag permissions (see help @flag2) + /type changes flag type(s) (see help @flag2) /delete deletes a flag completely, removing it from all objects in the database and the removing it permanently from the flag table. It requires the exact flag name or alias to be used. *************** *** 1726,1731 **** --- 1729,1735 ---- /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 + /powers : Alias for @powers/list, shows all powers /lowercase : Show whatever you're showing in lowercase, rather than upper. & @listmotd @listmotd *************** *** 2152,2164 **** See also: @password & @notify ! @notify[/any][/all] [/][=] This command notifies a semaphore, allowing commands queued for that semaphore to be executed. If the /any switch is given, then all semaphores associated with ! are @notified. Otherwise, the only the specified semaphore attribute (or SEMAPHORE if no attribute is specified) is @notified. If the /all switch is given, then all queue entries associated --- 2156,2168 ---- See also: @password & @notify ! @notify[/any][/all] [/][=] This command notifies a semaphore, allowing commands queued for that semaphore to be executed. If the /any switch is given, then all semaphores associated with ! are @notified. Otherwise, only the specified semaphore attribute (or SEMAPHORE if no attribute is specified) is @notified. If the /all switch is given, then all queue entries associated *************** *** 2176,2189 **** See also: SEMAPHORES, @drain, @wait & @nspemit @nspemit[/switches] = ! This wizard-only command is similar to @pemit, with two differences. ! It will not include nospoof information, and it doesn't accept the ! /contents switch. It is meant to be used by commands in the master ! room where the nospoof information is just useless noise. ! See also: @pemit, nspemit() & @odeath @odeath [=] --- 2180,2204 ---- See also: SEMAPHORES, @drain, @wait & @nspemit + & @nsemit + & @nslemit + & @nsremit + & @nszemit + & @nsoemit + @nsemit[/] [] + @nslemit[/] @nspemit[/switches] = + @nsremit[/switches] = . + @nszemit = ! These wizard-only commands work like @emit, @lemit, @pemit, @remit, ! and @zemit, respectively, but will not include nospoof information. ! They are meant to be used by commands in the master room where the ! nospoof information is just useless noise. They take all switches ! of their respective commands. ! See also: @emit, @lemit, @pemit, @remit, @zemit, nsemit(), nslemit(), ! nspemit(), nsremit(), nszemit() & @odeath @odeath [=] *** 1_7_7.848/game/mushcnf.dst Fri, 06 Feb 2004 17:37:49 -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) --- 1_7_7.919(w)/game/mushcnf.dst Sat, 24 Apr 2004 08:56:10 -0500 dunemush (pennmush/41_mushcnf.ds 1.1.1.19.1.1.1.2.1.1.1.8.1.1.1.1.1.23 600) *************** *** 163,168 **** --- 163,174 ---- # connections, leave this set to 0. ssl_port 0 + # The ip address to bind to for the SSL port, if one is specified. + # If your host has multiple IP addresses, put the ip address to + # listen on here. Otherwise, leave it blank to listen on all + # addresses if SSL is in use. + ssl_ip_addr + # The file containing the MUSH server's certificate and private key, # concatenated together, and with no password on the private key. # Obviously, this file should only be readable by the MUSH account *************** *** 639,644 **** --- 645,658 ---- wizwall_prefix Broadcast: rwall_prefix Admin: wall_prefix Announcement: + + # Should we announce connections/disconnections to rooms and on channels? + # If this is disabled, only MONITOR players will see connect/disconnect. + # @aconnect/@adisconnect, however, are still triggered, so you can + # softcode whatever connection monitor you like. Players will probably + # object if you don't at least show them when someone connects in + # the room with them. + announce_connects yes # can players have names with spaces in them? player_name_spaces no *** 1_7_7.848/game/access.README Thu, 15 Mar 2001 13:31:39 -0600 dunemush (pennmush/42_access.REA 1.3 600) --- 1_7_7.919(w)/game/access.README Wed, 24 Mar 2004 13:16:32 -0600 dunemush (pennmush/42_access.REA 1.4 600) *************** *** 102,113 **** This will totally lock out those sites (like lockout.cnf) ! 2. Allow specific sites and no others *.berkeley.edu -2 default * -2 none ! People may connect from .berkeley.edu sites only. 3. Allow connection but not creation from some sites --- 102,117 ---- This will totally lock out those sites (like lockout.cnf) ! 2. Allow specific sites and no others. Note that you must list both ! hostname-matching patterns and ip address-matching patterns, because ! if either fails to match a rule that allows connection, the connection ! will be refused. This is true in general when writing positive rules. *.berkeley.edu -2 default + 128.32.* -2 default * -2 none ! People may connect from .berkeley.edu (128.32.) sites only. 3. Allow connection but not creation from some sites *************** *** 159,165 **** remove 'username@' so that anyone on the server can connect. username@localhost 1 connect ! 127.0.0.1 1 connect * -2 !god @sitelock --- 163,169 ---- remove 'username@' so that anyone on the server can connect. username@localhost 1 connect ! username@127.0.0.1 1 connect * -2 !god @sitelock *************** *** 174,179 **** --- 178,184 ---- f) Allow @sitelock to override c-e above localhost.berkeley.edu -2 default + 127.0.0.1 -2 default *.twink.edu -2 !create register suspect @sitelock *badsite.com -2 none deny_silent *** 1_7_7.848/src/SWITCHES Tue, 02 Mar 2004 17:35:59 -0600 dunemush (pennmush/b/22_SWITCHES 1.12.1.3.1.12 600) --- 1_7_7.919(w)/src/SWITCHES Wed, 28 Apr 2004 10:33:12 -0500 dunemush (pennmush/b/22_SWITCHES 1.12.1.3.1.14 600) *************** *** 89,94 **** --- 89,95 ---- PARANOID PLAYERS PORT + POWERS PRESERVE PRINT PRIVS *************** *** 127,132 **** --- 128,134 ---- THINGS TITLE TRACE + TYPE UNCLEAR UNHIDE UNGAG *** 1_7_7.848/src/wiz.c Sun, 14 Mar 2004 20:10:12 -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) --- 1_7_7.919(w)/src/wiz.c Wed, 28 Apr 2004 10:33:09 -0500 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.9 660) *************** *** 995,1001 **** notify(player, object_header(player, thing)); notify_format(player, T("Flags value: %s"), bits_to_string("FLAG", Flags(thing), GOD, NOTHING)); ! notify_format(player, T("Powers value: 0x%08x"), Powers(thing)); notify_format(player, "Next: %d", Next(thing)); notify_format(player, "Contents: %d", Contents(thing)); --- 995,1002 ---- notify(player, object_header(player, thing)); notify_format(player, T("Flags value: %s"), bits_to_string("FLAG", Flags(thing), GOD, NOTHING)); ! notify_format(player, T("Powers value: %s"), ! bits_to_string("POWER", Powers(thing), GOD, NOTHING)); notify_format(player, "Next: %d", Next(thing)); notify_format(player, "Contents: %d", Contents(thing)); *************** *** 1040,1048 **** void do_power(dbref player, const char *name, const char *power) { ! int pwr, revoke_it = 0; dbref thing; if (!Wizard(player)) { notify(player, T("Only wizards may grant powers.")); return; --- 1041,1055 ---- void do_power(dbref player, const char *name, const char *power) { ! int revoke_it = 0; ! char powerbuff[BUFFER_LEN], *p, *f; dbref thing; + if (!power || !*power) { + /* @power */ + do_flag_info("POWER", player, name); + return; + } if (!Wizard(player)) { notify(player, T("Only wizards may grant powers.")); return; *************** *** 1061,1101 **** return; } ! /* move past leading whitespace and the not token if there is one */ ! while (isspace((unsigned char) *power)) ! power++; ! if (*power == NOT_TOKEN) { ! power++; ! revoke_it = 1; ! } ! ! if (*power == '\0') { ! notify(player, T("You must specify a power.")); ! return; ! } ! ! pwr = find_power(power); ! if (pwr == -1) { ! notify(player, T("That is not a power.")); return; } ! if (revoke_it) { ! Powers(thing) &= ~pwr; ! if (!AreQuiet(player, thing)) ! notify_format(player, T("%s - %s power removed."), Name(thing), ! power_to_string(pwr)); ! do_log(LT_WIZ, player, thing, T("Power Removed: %s"), power_to_string(pwr)); ! } else { ! if (Hasprivs(thing) && (pwr == IS_GUEST)) { ! notify(player, T("You can't make admin into guests.")); ! return; } ! Powers(thing) |= pwr; ! if (!AreQuiet(player, thing)) ! notify_format(player, T("%s - %s power granted."), Name(thing), ! power_to_string(pwr)); ! do_log(LT_WIZ, player, thing, T("Power Granted: %s"), power_to_string(pwr)); ! } } /*---------------------------------------------------------------------------- --- 1068,1089 ---- return; } ! strcpy(powerbuff, power); ! p = trim_space_sep(powerbuff, ' '); ! if (*p == '\0') { ! notify(player, T("You must specify a power to set.")); return; } ! do { ! f = split_token(&p, ' '); ! revoke_it = 0; ! if (*f == NOT_TOKEN && *(f + 1)) { ! revoke_it = 1; ! f++; } ! set_power(player, thing, f, revoke_it); ! } while (p); ! } /*---------------------------------------------------------------------------- *************** *** 1342,1348 **** enum search_class sclass = S_OWNER; int n; int restrict_type = NOTYPE; - int restrict_powers = 0; dbref restrict_obj = NOTHING, restrict_owner = ANY_OWNER; int is_wiz; dbref low = 0, high = db_top - 1; --- 1330,1335 ---- *************** *** 1451,1460 **** sclass = S_EVAL; restrict_type = TYPE_PLAYER; } else if (string_prefix("powers", class)) { sclass = S_POWER; ! restrict_powers = find_power(restriction); ! if (restrict_powers == -1) { ! notify(player, T("No such power to search for.")); return -1; } } else if (string_prefix("flags", class)) { --- 1438,1447 ---- sclass = S_EVAL; restrict_type = TYPE_PLAYER; } else if (string_prefix("powers", class)) { + /* Handle the checking later. */ sclass = S_POWER; ! if (!restriction || !*restriction) { ! notify(player, T("You must give a list of power names.")); return -1; } } else if (string_prefix("flags", class)) { *************** *** 1609,1640 **** } } break; - case S_POWER: /* @search power=see_all */ - for (n = low; n <= high; n++) { - if ((restrict_owner == ANY_OWNER || Owner(n) == restrict_owner) - && (Powers(n) & restrict_powers) == restrict_powers) { - if (nresults >= result_size) { - dbref *newresults; - result_size *= 2; - newresults = - (dbref *) realloc((Malloc_t) *result, sizeof(dbref) * result_size); - if (!newresults) - mush_panic(T("Couldn't reallocate memory in search!")); - *result = newresults; - } - - (*result)[nresults++] = (dbref) n; - } - } - break; case S_FLAG: case S_LFLAG: for (n = low; n <= high; n++) { if ((restrict_owner == ANY_OWNER || Owner(n) == restrict_owner) && (restrict_type == NOTYPE || Typeof(n) == restrict_type) ! && ((sclass == S_FLAG) ? ! flaglist_check("FLAG", player, n, restriction, 1) ! : flaglist_check_long("FLAG", player, n, restriction, 1))) { if (nresults >= result_size) { dbref *newresults; result_size *= 2; --- 1596,1612 ---- } } break; case S_FLAG: case S_LFLAG: + case S_POWER: for (n = low; n <= high; n++) { if ((restrict_owner == ANY_OWNER || Owner(n) == restrict_owner) && (restrict_type == NOTYPE || Typeof(n) == restrict_type) ! && ((sclass == S_POWER) ? ! flaglist_check_long("POWER", player, n, restriction, 1) : ! ((sclass == S_FLAG) ? ! flaglist_check("FLAG", player, n, restriction, 1) ! : flaglist_check_long("FLAG", player, n, restriction, 1)))) { if (nresults >= result_size) { dbref *newresults; result_size *= 2; *************** *** 2055,2060 **** --- 2027,2033 ---- #ifdef HAS_OPENSSL close_ssl_connections(); #endif + shutdown_queues(); fork_and_dump(0); #ifndef PROFILING #ifndef WIN32 *** 1_7_7.848/src/utils.c Sun, 14 Sep 2003 09:24:00 -0500 dunemush (pennmush/b/27_utils.c 1.30.1.1.1.15 660) --- 1_7_7.919(w)/src/utils.c Wed, 28 Apr 2004 10:33:09 -0500 dunemush (pennmush/b/27_utils.c 1.30.1.1.1.16 660) *************** *** 125,130 **** --- 125,163 ---- *attrib = (ATTR *) atr_get(*thing, upcasestr(name)); } + void + parse_anon_attrib(dbref player, char *str, dbref *thing, ATTR **attrib) + { + /* takes a string which is of the format #lambda/code, / or , + * and returns the dbref of the object, and a pointer to the attribute. + */ + + if (string_prefix(str, "#lambda/")) { + unsigned char *t; + str += 8; + *attrib = mush_malloc(sizeof(ATTR), "anon_attr"); + AL_CREATOR(*attrib) = player; + AL_NAME(*attrib) = strdup("#lambda"); + t = compress(str); + (*attrib)->data = chunk_create(t, u_strlen(t), 0); + AL_FLAGS(*attrib) = AF_ANON; + AL_NEXT(*attrib) = NULL; + *thing = player; + return; + } + parse_attrib(player, str, thing, attrib); + } + + + void + free_anon_attrib(ATTR *attrib) + { + if (attrib && (AL_FLAGS(attrib) & AF_ANON)) { + free((char *) AL_NAME(attrib)); + chunk_delete(attrib->data); + mush_free(attrib, "anon_attr"); + } + } /** Given an exit, find the room that is its source through brute force. * This is used in pathological cases where the exit's own source *** 1_7_7.848/src/switchinc.c Thu, 04 Mar 2004 09:27:23 -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) --- 1_7_7.919(w)/src/switchinc.c Wed, 28 Apr 2004 10:33:13 -0500 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.7 660) *************** *** 91,96 **** --- 91,97 ---- {"PARANOID", SWITCH_PARANOID}, {"PLAYERS", SWITCH_PLAYERS}, {"PORT", SWITCH_PORT}, + {"POWERS", SWITCH_POWERS}, {"PRESERVE", SWITCH_PRESERVE}, {"PRINT", SWITCH_PRINT}, {"PRIVS", SWITCH_PRIVS}, *************** *** 129,134 **** --- 130,136 ---- {"THINGS", SWITCH_THINGS}, {"TITLE", SWITCH_TITLE}, {"TRACE", SWITCH_TRACE}, + {"TYPE", SWITCH_TYPE}, {"UNCLEAR", SWITCH_UNCLEAR}, {"UNFOLDER", SWITCH_UNFOLDER}, {"UNGAG", SWITCH_UNGAG}, *** 1_7_7.848/src/strutil.c Wed, 10 Mar 2004 20:14:23 -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) --- 1_7_7.919(w)/src/strutil.c Wed, 28 Apr 2004 10:33:09 -0500 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.14 660) *************** *** 1670,1680 **** in_html++; q--; } - p = q + 1; /* p is now pointing to the first starting code, and we know if we're * in ansi, html, or both. We also know how many html tags have been * opened. */ } /* Copy the text. The right thing to do now would be to have a stack --- 1670,1686 ---- in_html++; q--; } /* p is now pointing to the first starting code, and we know if we're * in ansi, html, or both. We also know how many html tags have been * opened. */ + /* Except there's this one problem - Now we know it, we weren't + * doing anything with it. + */ + for (q = q + 1; q <= p; q++) { + if (safe_str(as->codes[q], buff, bp)) + return 1; + } } /* Copy the text. The right thing to do now would be to have a stack *** 1_7_7.848/src/speech.c Thu, 26 Feb 2004 11:27:52 -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) --- 1_7_7.919(w)/src/speech.c Wed, 28 Apr 2004 10:33:09 -0500 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.1.1 660) *************** *** 34,40 **** static void do_audible_stuff(dbref loc, dbref *excs, int numexcs, const char *msg); static void do_one_remit(dbref player, const char *target, const char *msg, ! int noisy); dbref na_zemit(dbref current, void *data); extern int i_comp(const void *s1, const void *s2); static const char *spname(dbref thing); --- 34,40 ---- static void do_audible_stuff(dbref loc, dbref *excs, int numexcs, const char *msg); static void do_one_remit(dbref player, const char *target, const char *msg, ! int flags); dbref na_zemit(dbref current, void *data); extern int i_comp(const void *s1, const void *s2); static const char *spname(dbref thing); *************** *** 175,188 **** * \param player the enactor. * \param list the list of dbrefs to oemit from the emit. * \param message the message to emit. */ void ! do_oemit_list(dbref player, char *list, const char *message) { char *temp, *p, *s; dbref who; dbref pass[12], locs[10]; int i, oneloc = 0; /* If no message, further processing is pointless. * If no list, they should have used @remit. */ --- 175,190 ---- * \param player the enactor. * \param list the list of dbrefs to oemit from the emit. * \param message the message to emit. + * \param flags PEMIT_* flags. */ void ! do_oemit_list(dbref player, char *list, const char *message, int flags) { char *temp, *p, *s; dbref who; dbref pass[12], locs[10]; int i, oneloc = 0; + int na_flags = NA_INTER_HEAR; /* If no message, further processing is pointless. * If no list, they should have used @remit. */ *************** *** 255,265 **** * room twice */ qsort((void *) locs, pass[0], sizeof(locs[0]), i_comp); for (i = 0; i < pass[0]; i++) { if (i != 0 && locs[i] == locs[i - 1]) continue; pass[1] = locs[i]; ! notify_anything_loc(orator, na_exceptN, pass, ns_esnotify, NA_INTER_HEAR, message, locs[i]); do_audible_stuff(pass[1], &pass[2], pass[0], message); } --- 257,269 ---- * room twice */ qsort((void *) locs, pass[0], sizeof(locs[0]), i_comp); + if (flags & PEMIT_SPOOF) + na_flags |= NA_SPOOF; for (i = 0; i < pass[0]; i++) { if (i != 0 && locs[i] == locs[i - 1]) continue; pass[1] = locs[i]; ! notify_anything_loc(orator, na_exceptN, pass, ns_esnotify, na_flags, message, locs[i]); do_audible_stuff(pass[1], &pass[2], pass[0], message); } *************** *** 403,424 **** * \param player the enactor. * \param list the list of players to pemit to, destructively modified. * \param message the message to pemit. ! * \param nospoof if 0, this is an nspemit; if 1, honor nospoof. */ void ! do_pemit_list(dbref player, char *list, const char *message, int nospoof) { char *bp, *p; char *nsbuf, *nspbuf; char *l; dbref who; /* If no list or no message, further processing is pointless. */ if (!message || !*message || !list || !*list) return; nspbuf = nsbuf = NULL; ! list[BUFFER_LEN - 1] = '\0'; l = trim_space_sep(list, ' '); --- 407,429 ---- * \param player the enactor. * \param list the list of players to pemit to, destructively modified. * \param message the message to pemit. ! * \param flags PEMIT_* flags */ void ! do_pemit_list(dbref player, char *list, const char *message, int flags) { char *bp, *p; char *nsbuf, *nspbuf; char *l; dbref who; + int nospoof; /* If no list or no message, further processing is pointless. */ if (!message || !*message || !list || !*list) return; nspbuf = nsbuf = NULL; ! nospoof = (flags & PEMIT_SPOOF) ? 0 : 1; list[BUFFER_LEN - 1] = '\0'; l = trim_space_sep(list, ' '); *************** *** 463,476 **** * \param player the enactor. * \param arg1 the name of the object to pemit to. * \param arg2 the message to pemit. ! * \param silent if 1, don't provide feedback to the pemitter. ! * \param nospoof if 0, this is an nspemit; if 1, honor nospoof. */ void ! do_pemit(dbref player, const char *arg1, const char *arg2, int silent, ! int nospoof) { dbref who; switch (who = match_result(player, arg1, NOTYPE, MAT_OBJECTS | MAT_HERE | MAT_CONTAINER)) { --- 468,483 ---- * \param player the enactor. * \param arg1 the name of the object to pemit to. * \param arg2 the message to pemit. ! * \param flags PEMIT_* flags. */ void ! do_pemit(dbref player, const char *arg1, const char *arg2, int flags) { dbref who; + int silent, nospoof; + + silent = (flags & PEMIT_SILENT) ? 1 : 0; + nospoof = (flags & PEMIT_SPOOF) ? 0 : 1; switch (who = match_result(player, arg1, NOTYPE, MAT_OBJECTS | MAT_HERE | MAT_CONTAINER)) { *************** *** 1184,1192 **** * \param tbuf1 the message to emit. */ void ! do_emit(dbref player, const char *tbuf1) { dbref loc; loc = speech_loc(player); if (!GoodObject(loc)) --- 1191,1200 ---- * \param tbuf1 the message to emit. */ void ! do_emit(dbref player, const char *tbuf1, int flags) { dbref loc; + int na_flags = NA_INTER_HEAR; loc = speech_loc(player); if (!GoodObject(loc)) *************** *** 1198,1204 **** } /* notify everybody */ ! notify_anything(player, na_loc, &loc, ns_esnotify, NA_INTER_HEAR, tbuf1); do_audible_stuff(loc, NULL, 0, tbuf1); } --- 1206,1214 ---- } /* notify everybody */ ! if (flags & PEMIT_SPOOF) ! na_flags |= NA_SPOOF; ! notify_anything(player, na_loc, &loc, ns_esnotify, na_flags, tbuf1); do_audible_stuff(loc, NULL, 0, tbuf1); } *************** *** 1207,1218 **** * \param player the enactor. * \param target string containing dbref of room to remit in. * \param msg message to emit. ! * \param noisy if 1, give enactor feedback. */ static void ! do_one_remit(dbref player, const char *target, const char *msg, int noisy) { dbref room; room = match_result(player, target, NOTYPE, MAT_EVERYTHING); if (!GoodObject(room)) { notify(player, T("I can't find that.")); --- 1217,1229 ---- * \param player the enactor. * \param target string containing dbref of room to remit in. * \param msg message to emit. ! * \param flags PEMIT_* flags */ static void ! do_one_remit(dbref player, const char *target, const char *msg, int flags) { dbref room; + int na_flags = NA_INTER_HEAR; room = match_result(player, target, NOTYPE, MAT_EVERYTHING); if (!GoodObject(room)) { notify(player, T("I can't find that.")); *************** *** 1226,1237 **** } else if (!Hasprivs(player) && !eval_lock(player, room, Speech_Lock)) { notify(player, T("You may not speak there!")); } else { ! if (noisy && (Location(player) != room)) { const char *rmno; rmno = unparse_object(player, room); notify_format(player, T("You remit, \"%s\" in %s"), msg, rmno); } ! notify_anything_loc(player, na_loc, &room, ns_esnotify, NA_INTER_HEAR, msg, room); do_audible_stuff(room, NULL, 0, msg); } --- 1237,1250 ---- } else if (!Hasprivs(player) && !eval_lock(player, room, Speech_Lock)) { notify(player, T("You may not speak there!")); } else { ! if (!(flags & PEMIT_SILENT) && (Location(player) != room)) { const char *rmno; rmno = unparse_object(player, room); notify_format(player, T("You remit, \"%s\" in %s"), msg, rmno); } ! if (flags & PEMIT_SPOOF) ! na_flags |= NA_SPOOF; ! notify_anything_loc(player, na_loc, &room, ns_esnotify, na_flags, msg, room); do_audible_stuff(room, NULL, 0, msg); } *************** *** 1255,1263 **** char *current; arg1 = trim_space_sep(arg1, ' '); while ((current = split_token(&arg1, ' ')) != NULL) ! do_one_remit(player, current, arg2, !(flags & PEMIT_SILENT)); } else { ! do_one_remit(player, arg1, arg2, !(flags & PEMIT_SILENT)); } } --- 1268,1276 ---- char *current; arg1 = trim_space_sep(arg1, ' '); while ((current = split_token(&arg1, ' ')) != NULL) ! do_one_remit(player, current, arg2, flags); } else { ! do_one_remit(player, arg1, arg2, flags); } } *************** *** 1267,1278 **** * \param silent if 0, give feedback to enactor. */ void ! do_lemit(dbref player, const char *tbuf1, int silent) { /* give a message to the "absolute" location of an object */ - dbref room; int rec = 0; /* only players and things may use this command */ if (!Mobile(player)) --- 1280,1292 ---- * \param silent if 0, give feedback to enactor. */ void ! do_lemit(dbref player, const char *tbuf1, int flags) { /* give a message to the "absolute" location of an object */ dbref room; int rec = 0; + int na_flags = NA_INTER_HEAR; + int silent = (flags & PEMIT_SILENT) ? 1 : 0; /* only players and things may use this command */ if (!Mobile(player)) *************** *** 1297,1303 **** } else { if (!silent && (Location(player) != room)) notify_format(player, T("You lemit: \"%s\""), tbuf1); ! notify_anything(player, na_loc, &room, ns_esnotify, NA_INTER_HEAR, tbuf1); } } --- 1311,1319 ---- } else { if (!silent && (Location(player) != room)) notify_format(player, T("You lemit: \"%s\""), tbuf1); ! if (flags & PEMIT_SPOOF) ! na_flags |= NA_SPOOF; ! notify_anything(player, na_loc, &room, ns_esnotify, na_flags, tbuf1); } } *************** *** 1338,1355 **** /** The zemit command. * \verbatim ! * This implements @zemit. * \endverbatim * \param player the enactor. * \param arg1 string containing dbref of ZMO. * \param arg2 message to emit. */ void ! do_zemit(dbref player, const char *arg1, const char *arg2) { const char *where; dbref zone; dbref pass[5]; zone = match_result(player, arg1, NOTYPE, MAT_ABSOLUTE); if (!GoodObject(zone)) { --- 1354,1373 ---- /** The zemit command. * \verbatim ! * This implements @zemit and @nszemit. * \endverbatim * \param player the enactor. * \param arg1 string containing dbref of ZMO. * \param arg2 message to emit. + * \param nospoof should we honor nospoof? */ void ! do_zemit(dbref player, const char *arg1, const char *arg2, int flags) { const char *where; dbref zone; dbref pass[5]; + int na_flags = NA_INTER_HEAR; zone = match_result(player, arg1, NOTYPE, MAT_ABSOLUTE); if (!GoodObject(zone)) { *************** *** 1373,1377 **** pass[2] = zone; pass[3] = player; pass[4] = player; ! notify_anything(player, na_zemit, pass, ns_esnotify, NA_INTER_HEAR, arg2); } --- 1391,1397 ---- pass[2] = zone; pass[3] = player; pass[4] = player; ! if (flags & PEMIT_SPOOF) ! na_flags |= NA_SPOOF; ! notify_anything(player, na_zemit, pass, ns_esnotify, na_flags, arg2); } *** 1_7_7.848/src/set.c Wed, 10 Mar 2004 16:53:35 -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) --- 1_7_7.919(w)/src/set.c Wed, 28 Apr 2004 10:33:09 -0500 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.29 660) *************** *** 307,313 **** void chown_object(dbref player, dbref thing, dbref newowner, int preserve) { ! undestroy(player, thing); if (God(player)) { Owner(thing) = newowner; } else { --- 307,313 ---- void chown_object(dbref player, dbref thing, dbref newowner, int preserve) { ! (void) undestroy(player, thing); if (God(player)) { Owner(thing) = newowner; } else { *** 1_7_7.848/src/rob.c Tue, 06 May 2003 17:27:48 -0500 dunemush (pennmush/b/42_rob.c 1.18.1.2.1.3.1.3.1.13 660) --- 1_7_7.919(w)/src/rob.c Wed, 28 Apr 2004 10:33:09 -0500 dunemush (pennmush/b/42_rob.c 1.18.1.2.1.3.1.3.1.15 660) *************** *** 248,254 **** return; } /* try to do the give */ ! if (!payfor(player, amount)) { notify_format(player, T("You don't have that many %s to give!"), MONIES); } else { char *pay_env[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; --- 248,254 ---- return; } /* try to do the give */ ! if (!Moneybags(player) && !payfor(player, amount)) { notify_format(player, T("You don't have that many %s to give!"), MONIES); } else { char *pay_env[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; *************** *** 258,263 **** --- 258,264 ---- /* objects work differently */ if (IsThing(who)) { + /* give pennies to an object */ int cost = 0; ATTR *a; a = atr_get(who, "COST"); *************** *** 282,288 **** NOTHING, pay_env, NA_INTER_SEE); return; } else { ! /* he can do it */ if (amount > 0) { notify_format(player, T("You give %d %s to %s."), amount, --- 283,289 ---- NOTHING, pay_env, NA_INTER_SEE); return; } else { ! /* give pennies to a player */ if (amount > 0) { notify_format(player, T("You give %d %s to %s."), amount, *** 1_7_7.848/src/predicat.c Sun, 14 Mar 2004 19:56:40 -0600 dunemush (pennmush/b/44_predicat.c 1.1.1.34.1.1.1.3.1.4.2.38.1.1 660) --- 1_7_7.919(w)/src/predicat.c Wed, 28 Apr 2004 10:33:09 -0500 dunemush (pennmush/b/44_predicat.c 1.1.1.34.1.1.1.3.1.4.2.38.1.6 660) *************** *** 485,501 **** return 1; } ! /** Transfer pennies to a player. * \param who recipient. * \param pennies amount of pennies to give. */ void giveto(dbref who, int pennies) { - /* wizards and royalty don't need pennies */ if (NoPay(who)) ! return; ! who = Owner(who); if ((Pennies(who) + pennies) > Max_Pennies(who)) s_Pennies(who, Max_Pennies(who)); --- 485,499 ---- return 1; } ! /** Transfer pennies to an object's owner. * \param who recipient. * \param pennies amount of pennies to give. */ void giveto(dbref who, int pennies) { if (NoPay(who)) ! return; /* Giving to a NoPay object or owner */ who = Owner(who); if ((Pennies(who) + pennies) > Max_Pennies(who)) s_Pennies(who, Max_Pennies(who)); *************** *** 517,524 **** int tmp; if (NoPay(who)) return 1; ! else if ((tmp = Pennies(Owner(who))) >= cost) { ! s_Pennies(Owner(who), tmp - cost); return 1; } else return 0; --- 515,523 ---- int tmp; if (NoPay(who)) return 1; ! who = Owner(who); ! if ((tmp = Pennies(who)) >= cost) { ! s_Pennies(who, tmp - cost); return 1; } else return 0; *** 1_7_7.848/src/portmsg.c Tue, 20 Nov 2001 17:08:09 -0600 dunemush (pennmush/b/45_portmsg.c 1.17 660) --- 1_7_7.919(w)/src/portmsg.c Wed, 28 Apr 2004 10:33:09 -0500 dunemush (pennmush/b/45_portmsg.c 1.18 660) *************** *** 98,105 **** static int how_many_fds(void); static Signal_t ! wait_on_child(sig) ! int sig; { WAIT_TYPE status; --- 98,104 ---- static int how_many_fds(void); static Signal_t ! wait_on_child(int sig __attribute__ ((__unused__))) { WAIT_TYPE status; *************** *** 118,134 **** } Signal_t ! lostconn(sig) ! int ! sig; { exit(1); } int ! main(argc, argv) ! int argc; ! char **argv; { int msgfd, fd, n; struct stat statBuf; --- 117,129 ---- } Signal_t ! lostconn(int sig __attribute__ ((__unused__))) { exit(1); } int ! main(int argc, char **argv) { int msgfd, fd, n; struct stat statBuf; *************** *** 196,202 **** #endif signal(SIGCLD, (void *) wait_on_child); ! bzero((char *) &tcp_srv_addr, sizeof(tcp_srv_addr)); tcp_srv_addr.sin_family = AF_INET; #ifdef SINGLE_IP_ADDR tcp_srv_addr.sin_addr.s_addr = inet_addr(MUSH_IP_ADDR); --- 191,197 ---- #endif signal(SIGCLD, (void *) wait_on_child); ! memset((char *) &tcp_srv_addr, 0, sizeof(tcp_srv_addr)); tcp_srv_addr.sin_family = AF_INET; #ifdef SINGLE_IP_ADDR tcp_srv_addr.sin_addr.s_addr = inet_addr(MUSH_IP_ADDR); *************** *** 256,262 **** } static int ! how_many_fds() { /* Determine how many open file descriptors we're allowed * In order, we'll try: --- 251,257 ---- } static int ! how_many_fds(void) { /* Determine how many open file descriptors we're allowed * In order, we'll try: *** 1_7_7.848/src/player.c Thu, 26 Feb 2004 11:27:52 -0600 dunemush (pennmush/b/47_player.c 1.15.1.1.1.1.1.4.1.6.1.1.1.8 660) --- 1_7_7.919(w)/src/player.c Wed, 28 Apr 2004 10:33:09 -0500 dunemush (pennmush/b/47_player.c 1.15.1.1.1.1.1.4.1.6.1.1.1.10 660) *************** *** 35,41 **** #include "flags.h" #include "lock.h" ! #if (CRYPT_SYSTEM == 1) || (CRYPT_SYSTEM == 3) #ifdef I_CRYPT #include #else --- 35,41 ---- #include "flags.h" #include "lock.h" ! #ifdef HAS_CRYPT #ifdef I_CRYPT #include #else *************** *** 81,116 **** passwd = mush_crypt(password); if (strcmp(passwd, saved) != 0) { ! #if (CRYPT_SYSTEM == 3) || (CRYPT_SYSTEM == 1) /* shs encryption didn't match. Try crypt(3) */ ! if (strcmp(crypt(password, "XX"), saved) != 0) { ! /* crypt(3) didn't match either. */ ! free(saved); ! return 0; ! } ! /* crypt(3) worked. Change password to SHS-encrypted */ ! (void) atr_add(player, pword_attr, passwd, GOD, NOTHING); ! #else ! #if (CRYPT_SYSTEM == 4) ! /* prevent direct entry of the raw encrypted password */ ! if ((strlen(password) >= 4) && (password[0] == 'X') && (password[1] == 'X')) { ! free(saved); ! return 0; ! } ! ! if (strcmp(saved, password) != 0) { ! free(saved); ! return 0; /* Plaintext didn't match */ ! } (void) atr_add(player, pword_attr, passwd, GOD, NOTHING); - #else - free(saved); - return 0; - #endif /* CRYPT_SYSTEM == 4 */ - #endif /* CRYPT_SYSTEM == 3 or 1 */ } free(saved); - /* we're okay */ return 1; } --- 81,104 ---- passwd = mush_crypt(password); if (strcmp(passwd, saved) != 0) { ! /* Nope. Try non-SHS. */ ! #ifdef HAS_CRYPT /* shs encryption didn't match. Try crypt(3) */ ! if (strcmp(crypt(password, "XX"), saved) != 0) ! /* Nope */ ! #endif /* HAS_CRYPT */ ! /* crypt() didn't work. Try plaintext, being sure to not allow unencrypted entry of encrypted password */ ! if ((strcmp(saved, password) != 0) ! && ((strlen(password) < 4) || (password[0] != 'X') ! || (password[1] != 'X'))) { ! /* Nothing worked. You lose. */ ! free(saved); ! return 0; ! } ! /* Something worked. Change password to SHS-encrypted */ (void) atr_add(player, pword_attr, passwd, GOD, NOTHING); } free(saved); return 1; } *************** *** 447,453 **** notify(player, T("Bad new password.")); } else { (void) atr_add(player, "XYXXY", mush_crypt(newobj), GOD, NOTHING); ! notify(player, T("Password changed.")); } } --- 435,441 ---- notify(player, T("Bad new password.")); } else { (void) atr_add(player, "XYXXY", mush_crypt(newobj), GOD, NOTHING); ! notify(player, T("You have changed your password.")); } } *** 1_7_7.848/src/mycrypt.c Mon, 06 Oct 2003 23:33:49 -0500 dunemush (pennmush/b/50_mycrypt.c 1.11 660) --- 1_7_7.919(w)/src/mycrypt.c Wed, 28 Apr 2004 10:33:09 -0500 dunemush (pennmush/b/50_mycrypt.c 1.12 660) *************** *** 12,24 **** #include #include #include "conf.h" - #if (CRYPT_SYSTEM > 0) #ifdef HAS_OPENSSL #include #else #include "shs.h" #endif - #endif #include "confmagic.h" char *mush_crypt(const char *key); --- 12,22 ---- *************** *** 30,38 **** char * mush_crypt(const char *key) { - #if (CRYPT_SYSTEM == 0) - return (char *) key; - #else static char crypt_buff[70]; #ifdef HAS_OPENSSL --- 28,33 ---- *************** *** 65,69 **** #endif return crypt_buff; - #endif } --- 60,63 ---- *** 1_7_7.848/src/match.c Thu, 26 Feb 2004 21:06:23 -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) --- 1_7_7.919(w)/src/match.c Wed, 28 Apr 2004 10:33:09 -0500 dunemush (pennmush/c/2_match.c 1.24.1.1.1.4.1.1.1.1.1.1.1.1.1.1.1.28 660) *************** *** 413,419 **** } /* Handle count adjectives */ ! if (!isdigit(**name)) { /* Quick exit */ return 0; } --- 413,419 ---- } /* Handle count adjectives */ ! if (!isdigit((unsigned char) **name)) { /* Quick exit */ return 0; } *** 1_7_7.848/src/look.c Sun, 14 Mar 2004 23:45:40 -0600 dunemush (pennmush/c/4_look.c 1.21.1.2.1.9.1.1.1.1.1.24 660) --- 1_7_7.919(w)/src/look.c Wed, 28 Apr 2004 10:33:09 -0500 dunemush (pennmush/c/4_look.c 1.21.1.2.1.9.1.1.1.1.1.26 660) *************** *** 31,41 **** #include "confmagic.h" #include "log.h" - extern void decompile_flags(dbref player, dbref thing, const char *name); /* from flags.c */ - extern void decompile_powers(dbref player, dbref thing, const char *name); /* from flags.c */ - extern const char *channel_description(dbref player); - extern PRIV attr_privs[]; - static void look_exits(dbref player, dbref loc, const char *exit_name); static void look_contents(dbref player, dbref loc, const char *contents_name); static void look_atrs(dbref player, dbref thing, const char *mstr, int all); --- 31,36 ---- *************** *** 54,59 **** --- 49,56 ---- const char *pattern, const char *prefix, int skipdef); void decompile_locks(dbref player, dbref thing, const char *name, int skipdef); + extern PRIV attr_privs[]; + static void look_exits(dbref player, dbref loc, const char *exit_name) { *************** *** 772,778 **** unparse_boolexp(player, L_KEY(ll), UB_ALL)); } } ! notify_format(player, T("Powers: %s"), power_description(thing)); #ifdef CHAT_SYSTEM notify(player, channel_description(thing)); --- 769,775 ---- unparse_boolexp(player, L_KEY(ll), UB_ALL)); } } ! notify_format(player, T("Powers: %s"), power_description(player, thing)); #ifdef CHAT_SYSTEM notify(player, channel_description(thing)); *** 1_7_7.848/src/game.c Thu, 26 Feb 2004 16:31:33 -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) --- 1_7_7.919(w)/src/game.c Wed, 28 Apr 2004 10:33:08 -0500 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.2.1.1.4 660) *************** *** 38,43 **** --- 38,44 ---- #include #endif #include + #include #ifdef macintosh extern void PMSSetupDatabases(void); *************** *** 105,110 **** --- 106,114 ---- int depth = 0; /**< excessive recursion prevention */ extern dbref cplr; extern char ccom[]; + #ifndef errno + extern int errno; + #endif extern void initialize_mt(void); *************** *** 669,676 **** set_name(thing, "XXXX"); } } ! if (STARTUPS && !IsGarbage(thing) && !(Halted(thing))) (void) queue_attribute_noparent(thing, "STARTUP", thing); } } --- 673,682 ---- set_name(thing, "XXXX"); } } ! if (STARTUPS && !IsGarbage(thing) && !(Halted(thing))) { (void) queue_attribute_noparent(thing, "STARTUP", thing); + do_top(5); + } } } *************** *** 711,716 **** --- 717,723 ---- /* initialize all the hash and prefix tables */ init_flagspaces(); init_flag_table("FLAG"); + init_flag_table("POWER"); init_func_hashtab(); init_math_hashtab(); init_tag_hashtab(); *************** *** 2098,2103 **** --- 2105,2124 ---- db_open_write(const char *filename) { FILE *f; + char workdir[BUFFER_LEN]; + + /* Be safe in case our game directory was removed and restored, + * in which case our inode is screwy + */ + if (getcwd(workdir, BUFFER_LEN)) { + if (chdir(workdir) < 0) + fprintf(stderr, "chdir to %s failed in db_open_write, errno %d (%s)\n", + workdir, errno, strerror(errno)); + } else { + /* If this fails, we probably can't write to a log, either, though */ + fprintf(stderr, "getcwd failed during db_open_write, errno %d (%s)\n", + errno, strerror(errno)); + } #ifndef macintosh #ifndef WIN32 if (options.compressprog && *options.compressprog) { *** 1_7_7.848/src/funstr.c Wed, 10 Mar 2004 16:24:40 -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) --- 1_7_7.919(w)/src/funstr.c Wed, 28 Apr 2004 10:33:08 -0500 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.13 660) *************** *** 39,45 **** --- 39,51 ---- HASHTAB htab_tag; /**< Hash table of safe html tags */ + #define MAX_COLS 32 static int wraplen(char *str, int maxlen); + static int align_one_line(char *buff, char **bp, int ncols, + int cols[MAX_COLS], int calign[MAX_COLS], + char *ptrs[MAX_COLS], ansi_string *as[MAX_COLS], + int linenum, char *fieldsep, int fslen, char *linesep, + int lslen, char filler); void init_tag_hashtab(void); void init_pronouns(void); *************** *** 976,985 **** } /* find our object and attribute */ ! parse_attrib(executor, args[0], &thing, &attrib); ! if (!GoodObject(thing) || !attrib || !Can_Read_Attr(executor, thing, attrib)) return; ! strcpy(place, "0"); asave = safe_atr_value(attrib); --- 982,992 ---- } /* find our object and attribute */ ! parse_anon_attrib(executor, args[0], &thing, &attrib); ! if (!GoodObject(thing) || !attrib || !Can_Read_Attr(executor, thing, attrib)) { ! free_anon_attrib(attrib); return; ! } strcpy(place, "0"); asave = safe_atr_value(attrib); *************** *** 998,1003 **** --- 1005,1011 ---- if (!tmp) { safe_str(lp, buff, bp); free((Malloc_t) asave); + free_anon_attrib(attrib); wenv[1] = tptr[1]; return; } *************** *** 1032,1037 **** --- 1040,1046 ---- if (*lp) safe_str(lp + 1, buff, bp); free((Malloc_t) asave); + free_anon_attrib(attrib); wenv[0] = tptr[0]; wenv[1] = tptr[1]; } *************** *** 1823,1825 **** --- 1832,2054 ---- } #undef initint + + #define AL_LEFT 1 + #define AL_RIGHT 2 + #define AL_CENTER 3 + #define AL_REPEAT 4 + + static int + align_one_line(char *buff, char **bp, int ncols, + int cols[MAX_COLS], int calign[MAX_COLS], char *ptrs[MAX_COLS], + ansi_string *as[MAX_COLS], + int linenum, char *fieldsep, int fslen, + char *linesep, int lslen, char filler) + { + static char line[BUFFER_LEN]; + static char segment[BUFFER_LEN]; + char *sp; + char *ptr, *tptr; + char *lp; + char *lastspace; + int i, j; + int len; + int cols_done; + int skipspace; + + lp = line; + memset(line, filler, BUFFER_LEN); + cols_done = 0; + for (i = 0; i < ncols; i++) { + if (!ptrs[i] || !*ptrs[i]) { + if (calign[i] & AL_REPEAT) { + ptrs[i] = as[i]->text; + } else { + lp += cols[i]; + if (i < (ncols - 1) && fslen) + safe_str(fieldsep, line, &lp); + cols_done++; + continue; + } + } + if (calign[i] & AL_REPEAT) { + cols_done++; + } + for (len = 0, ptr = ptrs[i], lastspace = NULL; len < cols[i]; ptr++, len++) { + if ((!*ptr) || (*ptr == '\n')) + break; + if (isspace(*ptr)) { + lastspace = ptr; + } + } + skipspace = 0; + sp = segment; + if (!*ptr) { + if (len > 0) { + safe_ansi_string(as[i], ptrs[i] - (as[i]->text), len, segment, &sp); + } + ptrs[i] = ptr; + } else if (*ptr == '\n') { + for (tptr = ptr; *tptr && tptr >= ptrs[i] && isspace(*tptr); tptr--) ; + len = (tptr - ptrs[i]) + 1; + if (len > 0) { + safe_ansi_string(as[i], ptrs[i] - (as[i]->text), len, segment, &sp); + } + ptrs[i] = ptr + 1; + ptr = tptr; + } else if (lastspace) { + ptr = lastspace; + skipspace = 1; + for (tptr = ptr; *tptr && tptr >= ptrs[i] && isspace(*tptr); tptr--) ; + len = (tptr - ptrs[i]) + 1; + if (len > 0) { + safe_ansi_string(as[i], ptrs[i] - (as[i]->text), len, segment, &sp); + } + ptrs[i] = lastspace; + } else { + if (len > 0) { + safe_ansi_string(as[i], ptrs[i] - (as[i]->text), len, segment, &sp); + } + ptrs[i] = ptr; + } + *sp = '\0'; + + if ((calign[i] & 3) == AL_LEFT) { + safe_str(segment, line, &lp); + lp += cols[i] - len; + } else if ((calign[i] & 3) == AL_RIGHT) { + lp += cols[i] - len; + safe_str(segment, line, &lp); + } else if ((calign[i] & 3) == AL_CENTER) { + j = cols[i] - len; + lp += j >> 1; + safe_str(segment, line, &lp); + lp += (j >> 1) + (j & 1); + } + if ((lp - line) > BUFFER_LEN) + lp = (line + BUFFER_LEN - 1); + if (i < (ncols - 1) && fslen) + safe_str(fieldsep, line, &lp); + if (skipspace) + for (; *ptrs[i] && (*ptrs[i] != '\n') && isspace(*ptrs[i]); ptrs[i]++) ; + } + if (cols_done == ncols) + return 0; + *lp = '\0'; + if (linenum > 0 && lslen > 0) + safe_str(linesep, buff, bp); + safe_str(line, buff, bp); + return 1; + } + + + FUNCTION(fun_align) + { + int nline; + char *ptr; + int ncols; + int i; + static int cols[MAX_COLS]; + static int calign[MAX_COLS]; + static ansi_string *as[MAX_COLS]; + static char *ptrs[MAX_COLS]; + char filler; + char *fieldsep; + int fslen; + char *linesep; + int lslen; + + filler = ' '; + fieldsep = (char *) " "; + linesep = (char *) "\n"; + + /* Get column widths */ + ncols = 0; + for (ptr = args[0]; *ptr; ptr++) { + while (isspace(*ptr)) + ptr++; + if (*ptr == '>') { + calign[ncols] = AL_RIGHT; + ptr++; + } else if (*ptr == '-') { + calign[ncols] = AL_CENTER; + ptr++; + } else if (*ptr == '<') { + calign[ncols] = AL_LEFT; + ptr++; + } else if (isdigit(*ptr)) { + calign[ncols] = AL_LEFT; + } else { + safe_str(T("#-1 INVALID ALIGN STRING"), buff, bp); + return; + } + for (i = 0; *ptr && isdigit(*ptr); ptr++) { + i *= 10; + i += *ptr - '0'; + } + if (*ptr == '.') { + calign[ncols] |= AL_REPEAT; + ptr++; + } + cols[ncols++] = i; + if (!*ptr) + break; + } + + for (i = 0; i < ncols; i++) { + if (cols[i] < 1) { + safe_str(T("#-1 CANNOT HAVE COLUMN OF SIZE 0"), buff, bp); + return; + } + } + + if (ncols < 1) { + safe_str(T("#-1 NOT ENOUGH COLUMNS FOR ALIGN"), buff, bp); + return; + } + if (ncols > MAX_COLS) { + safe_str(T("#-1 TOO MANY COLUMNS FOR ALIGN"), buff, bp); + return; + } + if (nargs < (ncols + 1) || nargs > (ncols + 4)) { + safe_str(T("#-1 INVALID NUMBER OF ARGUMENTS TO ALIGN"), buff, bp); + return; + } + if (nargs >= (ncols + 2)) { + if (!args[ncols + 1] || strlen(args[ncols + 1]) != 1) { + safe_str(T("#-1 FILLER MUST BE ONE CHARACTER"), buff, bp); + return; + } + filler = *(args[ncols + 1]); + } + if (nargs >= (ncols + 3)) { + fieldsep = args[ncols + 2]; + } + if (nargs >= (ncols + 4)) { + linesep = args[ncols + 3]; + } + + fslen = strlen(fieldsep); + lslen = strlen(linesep); + + for (i = 0; i < MAX_COLS; i++) { + as[i] = NULL; + } + for (i = 0; i < ncols; i++) { + as[i] = parse_ansi_string(args[i + 1]); + ptrs[i] = as[i]->text; + } + + nline = 0; + while (1) { + if (!align_one_line(buff, bp, ncols, cols, calign, ptrs, + as, nline++, fieldsep, fslen, linesep, lslen, filler)) + break; + } + **bp = '\0'; + for (i = 0; i < ncols; i++) { + free_ansi_string(as[i]); + ptrs[i] = as[i]->text; + } + return; + } *** 1_7_7.848/src/funmisc.c Sat, 24 Jan 2004 13:22:12 -0600 dunemush (pennmush/c/14_funmisc.c 1.30.1.1.1.28 660) --- 1_7_7.919(w)/src/funmisc.c Wed, 28 Apr 2004 10:33:08 -0500 dunemush (pennmush/c/14_funmisc.c 1.30.1.1.1.36 660) *************** *** 55,60 **** --- 55,66 ---- safe_boolean(good_atr_name(upcasestr(args[1])), buff, bp); else if (!strcasecmp(args[0], "playername")) safe_boolean(ok_player_name(args[1], executor), buff, bp); + else if (!strcasecmp(args[0], "password")) + safe_boolean(ok_password(args[1]), buff, bp); + else if (!strcasecmp(args[0], "command")) + safe_boolean(ok_command_name(upcasestr(args[1])), buff, bp); + else if (!strcasecmp(args[0], "function")) + safe_boolean(ok_command_name(upcasestr(args[1])), buff, bp); else safe_str("#-1", buff, bp); } *************** *** 62,143 **** /* ARGSUSED */ FUNCTION(fun_pemit) { ! if (!command_check_byname(executor, "@pemit") || fun->flags & FN_NOSIDEFX) { safe_str(T(e_perm), buff, bp); return; } orator = executor; ! do_pemit_list(executor, args[0], args[1], PEMIT_LIST); } - /* ARGSUSED */ - FUNCTION(fun_nspemit) - { - if (!command_check_byname(executor, "@nspemit") || fun->flags & FN_NOSIDEFX) { - safe_str(T(e_perm), buff, bp); - return; - } - orator = executor; - do_pemit_list(executor, args[0], args[1], 0); - } /* ARGSUSED */ FUNCTION(fun_oemit) { ! if (!command_check_byname(executor, "@oemit") || fun->flags & FN_NOSIDEFX) { safe_str(T(e_perm), buff, bp); return; } orator = executor; ! do_oemit_list(executor, args[0], args[1]); } /* ARGSUSED */ FUNCTION(fun_emit) { ! if (!command_check_byname(executor, "@emit") || fun->flags & FN_NOSIDEFX) { safe_str(T(e_perm), buff, bp); return; } orator = executor; ! do_emit(executor, args[0]); } /* ARGSUSED */ FUNCTION(fun_remit) { ! if (!command_check_byname(executor, "@remit") || fun->flags & FN_NOSIDEFX) { safe_str(T(e_perm), buff, bp); return; } orator = executor; ! do_remit(executor, args[0], args[1], 0); } /* ARGSUSED */ FUNCTION(fun_lemit) { ! if (!command_check_byname(executor, "@lemit") || fun->flags & FN_NOSIDEFX) { safe_str(T(e_perm), buff, bp); return; } orator = executor; ! do_lemit(executor, args[0], 0); } /* ARGSUSED */ FUNCTION(fun_zemit) { ! if (!command_check_byname(executor, "@zemit") || fun->flags & FN_NOSIDEFX) { safe_str(T(e_perm), buff, bp); return; } orator = executor; ! do_zemit(executor, args[0], args[1]); } - extern signed char qreg_indexes[UCHAR_MAX + 1]; /* ARGSUSED */ FUNCTION(fun_setq) --- 68,158 ---- /* ARGSUSED */ FUNCTION(fun_pemit) { ! int ns = string_prefix(called_as, "NS"); ! int flags = PEMIT_LIST; ! if (!command_check_byname(executor, ns ? "@nspemit" : "@pemit") || ! fun->flags & FN_NOSIDEFX) { safe_str(T(e_perm), buff, bp); return; } orator = executor; ! if (ns) ! flags |= PEMIT_SPOOF; ! do_pemit_list(executor, args[0], args[1], flags); } /* ARGSUSED */ FUNCTION(fun_oemit) { ! int ns = string_prefix(called_as, "NS"); ! int flags = ns ? PEMIT_SPOOF : 0; ! if (!command_check_byname(executor, ns ? "@nsoemit" : "@oemit") || ! fun->flags & FN_NOSIDEFX) { safe_str(T(e_perm), buff, bp); return; } orator = executor; ! do_oemit_list(executor, args[0], args[1], flags); } /* ARGSUSED */ FUNCTION(fun_emit) { ! int ns = string_prefix(called_as, "NS"); ! int flags = ns ? PEMIT_SPOOF : 0; ! if (!command_check_byname(executor, ns ? "@nsemit" : "@emit") || ! fun->flags & FN_NOSIDEFX) { safe_str(T(e_perm), buff, bp); return; } orator = executor; ! do_emit(executor, args[0], flags); } /* ARGSUSED */ FUNCTION(fun_remit) { ! int ns = string_prefix(called_as, "NS"); ! int flags = ns ? PEMIT_SPOOF : 0; ! if (!command_check_byname(executor, ns ? "@nsremit" : "@remit") || ! fun->flags & FN_NOSIDEFX) { safe_str(T(e_perm), buff, bp); return; } orator = executor; ! do_remit(executor, args[0], args[1], flags); } /* ARGSUSED */ FUNCTION(fun_lemit) { ! int ns = string_prefix(called_as, "NS"); ! int flags = ns ? PEMIT_SPOOF : 0; ! if (!command_check_byname(executor, ns ? "@nslemit" : "@lemit") || ! fun->flags & FN_NOSIDEFX) { safe_str(T(e_perm), buff, bp); return; } orator = executor; ! do_lemit(executor, args[0], flags); } /* ARGSUSED */ FUNCTION(fun_zemit) { ! int ns = string_prefix(called_as, "NS"); ! int flags = ns ? PEMIT_SPOOF : 0; ! if (!command_check_byname(executor, ns ? "@nszemit" : "@zemit") || ! fun->flags & FN_NOSIDEFX) { safe_str(T(e_perm), buff, bp); return; } orator = executor; ! do_zemit(executor, args[0], args[1], flags); } extern signed char qreg_indexes[UCHAR_MAX + 1]; /* ARGSUSED */ FUNCTION(fun_setq) *************** *** 516,523 **** * I deem the modularity to be more important. So there. */ char tbuf1[5]; ! if (!*args[0] || !*args[1] || !isalpha(*args[0]) || !isalpha(*args[1]) || ! strchr(args[0], ' ') || strchr(args[1], ' ')) { safe_str(T("#-1 FUNCTION (SOUNDLIKE) REQUIRES TWO ONE-WORD ARGUMENTS"), buff, bp); return; --- 531,539 ---- * I deem the modularity to be more important. So there. */ char tbuf1[5]; ! if (!*args[0] || !*args[1] || !isalpha((unsigned char) *args[0]) ! || !isalpha((unsigned char) *args[1]) || strchr(args[0], ' ') ! || strchr(args[1], ' ')) { safe_str(T("#-1 FUNCTION (SOUNDLIKE) REQUIRES TWO ONE-WORD ARGUMENTS"), buff, bp); return; *************** *** 574,615 **** { dbref thing; char save_ccom[BUFFER_LEN]; ! thing = match_thing(executor, args[0]); ! if (!GoodObject(thing)) { ! safe_str(T(e_notvis), buff, bp); ! return; ! } ! if (!See_All(executor) && !controls(executor, thing)) { ! notify(executor, T("Permission denied.")); ! safe_str("#-1", buff, bp); ! return; } strcpy(save_ccom, ccom); ! strncpy(ccom, args[1], BUFFER_LEN); ccom[BUFFER_LEN - 1] = '\0'; ! safe_str(scan_list(thing, args[1]), buff, bp); strcpy(ccom, save_ccom); } static void ! do_whichof(char *args[], int nargs, int flag, char *buff, char **bp, dbref executor, dbref caller, dbref enactor, PE_Info * pe_info) { int j; char tbuf[BUFFER_LEN], *tp; char const *sp; char sep = ' '; tbuf[0] = '\0'; ! if (!flag) { ! if (strlen(args[nargs]) > 1) { ! safe_str(T("#-1 SEPARATOR MUST BE ONE CHARACTER"), buff, bp); return; ! } else if (*args[nargs]) ! sep = *args[nargs]; } for (j = 0; j < nargs; j++) { --- 590,647 ---- { dbref thing; char save_ccom[BUFFER_LEN]; + char *cmdptr; ! if (nargs == 1) { ! thing = executor; ! cmdptr = args[0]; ! } else { ! thing = match_thing(executor, args[0]); ! if (!GoodObject(thing)) { ! safe_str(T(e_notvis), buff, bp); ! return; ! } ! if (!See_All(executor) && !controls(executor, thing)) { ! notify(executor, T("Permission denied.")); ! safe_str("#-1", buff, bp); ! return; ! } ! cmdptr = args[1]; } strcpy(save_ccom, ccom); ! strncpy(ccom, cmdptr, BUFFER_LEN); ccom[BUFFER_LEN - 1] = '\0'; ! safe_str(scan_list(thing, cmdptr), buff, bp); strcpy(ccom, save_ccom); } + enum whichof_t { DO_FIRSTOF, DO_ALLOF }; static void ! do_whichof(char *args[], int nargs, enum whichof_t flag, char *buff, char **bp, dbref executor, dbref caller, dbref enactor, PE_Info * pe_info) { int j; char tbuf[BUFFER_LEN], *tp; char const *sp; char sep = ' '; + int first = 1; tbuf[0] = '\0'; ! if (flag == DO_ALLOF) { ! /* The last arg is a delimiter. Parse it in place. */ ! char insep[BUFFER_LEN]; ! char *isep = insep; ! const char *arglast = args[nargs - 1]; ! process_expression(insep, &isep, &arglast, executor, caller, enactor, ! PE_DEFAULT, PT_DEFAULT, pe_info); ! *isep = '\0'; ! strcpy(args[nargs - 1], insep); ! ! if (!delim_check(buff, bp, nargs, args, nargs, &sep)) return; ! nargs--; } for (j = 0; j < nargs; j++) { *************** *** 619,647 **** PE_DEFAULT, PT_DEFAULT, pe_info); *tp = '\0'; if (parse_boolean(tbuf)) { ! if (*bp != buff) safe_chr(sep, buff, bp); safe_str(tbuf, buff, bp); ! if (flag) return; } } ! ! if (flag) safe_str(tbuf, buff, bp); } /* ARGSUSED */ FUNCTION(fun_firstof) { ! do_whichof(args, nargs, 1, buff, bp, executor, caller, enactor, pe_info); } /* ARGSUSED */ FUNCTION(fun_allof) { ! do_whichof(args, nargs - 1, 0, buff, bp, executor, caller, enactor, pe_info); } --- 651,682 ---- PE_DEFAULT, PT_DEFAULT, pe_info); *tp = '\0'; if (parse_boolean(tbuf)) { ! if (!first) { safe_chr(sep, buff, bp); + } else + first = 0; safe_str(tbuf, buff, bp); ! if (flag == DO_FIRSTOF) return; } } ! if (flag == DO_FIRSTOF) safe_str(tbuf, buff, bp); } /* ARGSUSED */ FUNCTION(fun_firstof) { ! do_whichof(args, nargs, DO_FIRSTOF, buff, bp, executor, caller, enactor, ! pe_info); } /* ARGSUSED */ FUNCTION(fun_allof) { ! do_whichof(args, nargs, DO_ALLOF, buff, bp, executor, caller, enactor, ! pe_info); } *** 1_7_7.848/src/funlist.c Fri, 27 Feb 2004 15:31:35 -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) --- 1_7_7.919(w)/src/funlist.c Wed, 28 Apr 2004 10:33:08 -0500 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.2 660) *************** *** 155,165 **** } /* find our object and attribute */ ! parse_attrib(executor, args[0], &thing, &attrib); ! if (!GoodObject(thing) || !attrib || !Can_Read_Attr(executor, thing, attrib)) return; ! if (!CanEvalAttr(executor, thing, attrib)) return; /* Copy the first list, since we need to pass it to two destructive * routines. --- 155,169 ---- } /* find our object and attribute */ ! parse_anon_attrib(executor, args[0], &thing, &attrib); ! if (!GoodObject(thing) || !attrib || !Can_Read_Attr(executor, thing, attrib)) { ! free_anon_attrib(attrib); return; ! } ! if (!CanEvalAttr(executor, thing, attrib)) { ! free_anon_attrib(attrib); return; + } /* Copy the first list, since we need to pass it to two destructive * routines. *************** *** 180,185 **** --- 184,190 ---- safe_str(T("#-1 LISTS MUST BE OF EQUAL SIZE"), buff, bp); mush_free((Malloc_t) ptrs1, "ptrarray"); mush_free((Malloc_t) ptrs2, "ptrarray"); + free_anon_attrib(attrib); return; } /* Call the user function */ *************** *** 219,224 **** --- 224,230 ---- mush_free((Malloc_t) ptrs1, "ptrarray"); mush_free((Malloc_t) ptrs2, "ptrarray"); mush_free((Malloc_t) results, "ptrarray"); + free_anon_attrib(attrib); } /* ARGSUSED */ *************** *** 371,382 **** return; /* find our object and attribute */ ! parse_attrib(executor, args[0], &thing, &attrib); ! if (!GoodObject(thing) || !attrib || !Can_Read_Attr(executor, thing, attrib)) return; ! if (!CanEvalAttr(executor, thing, attrib)) return; /* Now we can go to work */ if (AF_Debug(attrib)) --- 377,392 ---- return; /* find our object and attribute */ ! parse_anon_attrib(executor, args[0], &thing, &attrib); ! if (!GoodObject(thing) || !attrib || !Can_Read_Attr(executor, thing, attrib)) { ! free_anon_attrib(attrib); return; ! } ! if (!CanEvalAttr(executor, thing, attrib)) { ! free_anon_attrib(attrib); return; + } /* Now we can go to work */ if (AF_Debug(attrib)) *************** *** 435,440 **** --- 445,451 ---- free((Malloc_t) abuf); mush_free((Malloc_t) result, "string"); mush_free((Malloc_t) rsave, "string"); + free_anon_attrib(attrib); } /* ARGSUSED */ *************** *** 523,534 **** check_bool = 1; /* find our object and attribute */ ! parse_attrib(executor, args[0], &thing, &attrib); ! if (!GoodObject(thing) || !attrib || !Can_Read_Attr(executor, thing, attrib)) return; ! if (!CanEvalAttr(executor, thing, attrib)) return; if (AF_Debug(attrib)) pe_flags |= PE_DEBUG; --- 534,549 ---- check_bool = 1; /* find our object and attribute */ ! parse_anon_attrib(executor, args[0], &thing, &attrib); ! if (!GoodObject(thing) || !attrib || !Can_Read_Attr(executor, thing, attrib)) { ! free_anon_attrib(attrib); return; ! } ! if (!CanEvalAttr(executor, thing, attrib)) { ! free_anon_attrib(attrib); return; + } if (AF_Debug(attrib)) pe_flags |= PE_DEBUG; *************** *** 568,573 **** --- 583,589 ---- wenv[0] = tptr; free((Malloc_t) abuf); + free_anon_attrib(attrib); } /* ARGSUSED */ *************** *** 1050,1060 **** } /* Find object and attribute to get sortby function from. */ ! parse_attrib(executor, args[0], &thing, &attrib); ! if (!GoodObject(thing) || !attrib || !Can_Read_Attr(executor, thing, attrib)) return; ! if (!CanEvalAttr(executor, thing, attrib)) return; up = ucomp_buff; safe_str(atr_value(attrib), ucomp_buff, &up); *up = '\0'; --- 1066,1080 ---- } /* Find object and attribute to get sortby function from. */ ! parse_anon_attrib(executor, args[0], &thing, &attrib); ! if (!GoodObject(thing) || !attrib || !Can_Read_Attr(executor, thing, attrib)) { ! free_anon_attrib(attrib); return; ! } ! if (!CanEvalAttr(executor, thing, attrib)) { ! free_anon_attrib(attrib); return; + } up = ucomp_buff; safe_str(atr_value(attrib), ucomp_buff, &up); *up = '\0'; *************** *** 1074,1079 **** --- 1094,1100 ---- arr2list(ptrs, nptrs, buff, bp, osep); restore_global_env("sortby", tptr); + free_anon_attrib(attrib); } /* ARGSUSED */ *************** *** 2322,2332 **** return; /* find our object and attribute */ ! parse_attrib(executor, args[0], &thing, &attrib); ! if (!GoodObject(thing) || !attrib || !Can_Read_Attr(executor, thing, attrib)) return; ! if (!CanEvalAttr(executor, thing, attrib)) return; if (AF_Debug(attrib)) pe_flags |= PE_DEBUG; --- 2343,2357 ---- return; /* find our object and attribute */ ! parse_anon_attrib(executor, args[0], &thing, &attrib); ! if (!GoodObject(thing) || !attrib || !Can_Read_Attr(executor, thing, attrib)) { ! free_anon_attrib(attrib); return; ! } ! if (!CanEvalAttr(executor, thing, attrib)) { ! free_anon_attrib(attrib); return; + } if (AF_Debug(attrib)) pe_flags |= PE_DEBUG; *************** *** 2372,2377 **** --- 2397,2403 ---- } free((Malloc_t) asave); + free_anon_attrib(attrib); restore_global_env("step", preserve); } *************** *** 2411,2421 **** return; /* find our object and attribute */ ! parse_attrib(executor, args[0], &thing, &attrib); ! if (!GoodObject(thing) || !attrib || !Can_Read_Attr(executor, thing, attrib)) return; ! if (!CanEvalAttr(executor, thing, attrib)) return; if (AF_Debug(attrib)) pe_flags |= PE_DEBUG; --- 2437,2451 ---- return; /* find our object and attribute */ ! parse_anon_attrib(executor, args[0], &thing, &attrib); ! if (!GoodObject(thing) || !attrib || !Can_Read_Attr(executor, thing, attrib)) { ! free_anon_attrib(attrib); return; ! } ! if (!CanEvalAttr(executor, thing, attrib)) { ! free_anon_attrib(attrib); return; + } if (AF_Debug(attrib)) pe_flags |= PE_DEBUG; *************** *** 2448,2453 **** --- 2478,2484 ---- } free((Malloc_t) asave); + free_anon_attrib(attrib); wenv[0] = tptr[0]; wenv[1] = tptr[1]; } *************** *** 2488,2498 **** lp[n] = trim_space_sep(args[n + 1], sep); /* find our object and attribute */ ! parse_attrib(executor, args[0], &thing, &attrib); ! if (!GoodObject(thing) || !attrib || !Can_Read_Attr(executor, thing, attrib)) return; ! if (!CanEvalAttr(executor, thing, attrib)) return; if (AF_Debug(attrib)) pe_flags |= PE_DEBUG; --- 2519,2533 ---- lp[n] = trim_space_sep(args[n + 1], sep); /* find our object and attribute */ ! parse_anon_attrib(executor, args[0], &thing, &attrib); ! if (!GoodObject(thing) || !attrib || !Can_Read_Attr(executor, thing, attrib)) { ! free_anon_attrib(attrib); return; ! } ! if (!CanEvalAttr(executor, thing, attrib)) { ! free_anon_attrib(attrib); return; + } if (AF_Debug(attrib)) pe_flags |= PE_DEBUG; *************** *** 2513,2518 **** --- 2548,2554 ---- if (words == 0) { restore_global_env("fun_mix", tptr); free((Malloc_t) asave); + free_anon_attrib(attrib); return; } ap = asave; *************** *** 2544,2549 **** --- 2580,2586 ---- } free((Malloc_t) asave); + free_anon_attrib(attrib); restore_global_env("fun_mix", tptr); } *** 1_7_7.848/src/fundb.c Fri, 27 Feb 2004 15:31:35 -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) --- 1_7_7.919(w)/src/fundb.c Wed, 28 Apr 2004 10:33:08 -0500 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.33 660) *************** *** 483,507 **** FUNCTION(fun_haspower) { dbref it; - int pwr; it = match_thing(executor, args[0]); if (!GoodObject(it)) { safe_str(T(e_notvis), buff, bp); return; } ! if (HASPOWER_RESTRICTED) ! if (!Can_Examine(executor, it)) { ! notify(executor, ! T("We could let you see that, but then we'd have to kill you.")); ! safe_str("#-1", buff, bp); ! return; ! } ! pwr = find_power(args[1]); ! if (pwr == -1) ! safe_str(T("#-1 NO SUCH POWER"), buff, bp); ! else ! safe_boolean(Powers(it) & pwr, buff, bp); } /* ARGSUSED */ --- 483,495 ---- FUNCTION(fun_haspower) { dbref it; it = match_thing(executor, args[0]); if (!GoodObject(it)) { safe_str(T(e_notvis), buff, bp); return; } ! safe_boolean(sees_flag("POWER", executor, it, args[1]), buff, bp); } /* ARGSUSED */ *************** *** 526,539 **** safe_str(T(e_notvis), buff, bp); return; } ! if (HASPOWER_RESTRICTED) ! if (!Can_Examine(executor, it)) { ! notify(executor, ! T("We could let you see that, but then we'd have to kill you.")); ! safe_str("#-1", buff, bp); ! return; ! } ! safe_str(power_description(it), buff, bp); } #ifdef WIN32 --- 514,520 ---- safe_str(T(e_notvis), buff, bp); return; } ! safe_str(power_description(executor, it), buff, bp); } #ifdef WIN32 *************** *** 629,639 **** (enactor == loc))) { first = 1; DOLIST_VISIBLE(thing, startdb, executor) { if (type == TYPE_PLAYER) ! validthing = skipdark ? (IsPlayer(thing) && !Dark(thing) ! && Connected(thing)) : IsPlayer(thing); else ! validthing = skipdark ? (!Dark(thing)) : 1; if (validthing) { if (buff) { if (first) --- 610,621 ---- (enactor == loc))) { first = 1; DOLIST_VISIBLE(thing, startdb, executor) { + validthing = can_interact(thing, executor, INTERACT_SEE); if (type == TYPE_PLAYER) ! validthing &= (skipdark ? (IsPlayer(thing) && !Dark(thing) ! && Connected(thing)) : IsPlayer(thing)); else ! validthing &= (skipdark ? (!Dark(thing)) : 1); if (validthing) { if (buff) { if (first) *************** *** 989,995 **** if (!GoodObject(thing)) safe_str(T(e_notvis), buff, bp); else ! safe_boolean(sees_flag(executor, thing, args[1]), buff, bp); } } --- 971,977 ---- if (!GoodObject(thing)) safe_str(T(e_notvis), buff, bp); else ! safe_boolean(sees_flag("FLAG", executor, thing, args[1]), buff, bp); } } *************** *** 1032,1059 **** FUNCTION(fun_orflags) { dbref it = match_thing(executor, args[0]); ! safe_boolean(flaglist_check("FLAG", executor, it, args[1], 0), buff, bp); } /* ARGSUSED */ FUNCTION(fun_andflags) { dbref it = match_thing(executor, args[0]); ! safe_boolean(flaglist_check("FLAG", executor, it, args[1], 1), buff, bp); } /* ARGSUSED */ FUNCTION(fun_orlflags) { dbref it = match_thing(executor, args[0]); ! safe_boolean(flaglist_check_long("FLAG", executor, it, args[1], 0), buff, bp); } /* ARGSUSED */ FUNCTION(fun_andlflags) { dbref it = match_thing(executor, args[0]); ! safe_boolean(flaglist_check_long("FLAG", executor, it, args[1], 1), buff, bp); } static lock_type --- 1014,1057 ---- FUNCTION(fun_orflags) { dbref it = match_thing(executor, args[0]); ! if (!strcmp(called_as, "ORPOWERS")) ! safe_boolean(flaglist_check("POWER", executor, it, args[1], 0), buff, bp); ! else ! safe_boolean(flaglist_check("FLAG", executor, it, args[1], 0), buff, bp); } /* ARGSUSED */ FUNCTION(fun_andflags) { dbref it = match_thing(executor, args[0]); ! if (!strcmp(called_as, "ANDPOWERS")) ! safe_boolean(flaglist_check("POWER", executor, it, args[1], 1), buff, bp); ! else ! safe_boolean(flaglist_check("FLAG", executor, it, args[1], 1), buff, bp); } /* ARGSUSED */ FUNCTION(fun_orlflags) { dbref it = match_thing(executor, args[0]); ! if (!strcmp(called_as, "ORLPOWERS")) ! safe_boolean(flaglist_check_long("POWER", executor, it, args[1], 0), buff, ! bp); ! else ! safe_boolean(flaglist_check_long("FLAG", executor, it, args[1], 0), buff, ! bp); } /* ARGSUSED */ FUNCTION(fun_andlflags) { dbref it = match_thing(executor, args[0]); ! if (!strcmp(called_as, "ANDLPOWERS")) ! safe_boolean(flaglist_check_long("POWER", executor, it, args[1], 1), buff, ! bp); ! else ! safe_boolean(flaglist_check_long("FLAG", executor, it, args[1], 1), buff, ! bp); } static lock_type *************** *** 1364,1370 **** * if its owner is no_pay. Softcode can check money(owner(XX)) if * they want to allow objects to pay like their owners. */ ! if (Hasprivs(it) || (Powers(it) & NO_PAY)) safe_integer(MAX_PENNIES, buff, bp); else safe_integer(Pennies(it), buff, bp); --- 1362,1368 ---- * if its owner is no_pay. Softcode can check money(owner(XX)) if * they want to allow objects to pay like their owners. */ ! if (has_power_by_name(it, "NO_PAY", NOTYPE)) safe_integer(MAX_PENNIES, buff, bp); else safe_integer(Pennies(it), buff, bp); *** 1_7_7.848/src/function.c Wed, 10 Mar 2004 15:33:12 -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) --- 1_7_7.919(w)/src/function.c Wed, 28 Apr 2004 10:33:08 -0500 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.6 660) *************** *** 181,192 **** --- 181,195 ---- {"ACCNAME", fun_accname, 1, 1, FN_REG}, {"ADD", fun_add, 2, INT_MAX, FN_REG}, {"AFTER", fun_after, 2, 2, FN_REG}, + {"ALIGN", fun_align, 2, INT_MAX, FN_REG}, {"ALLOF", fun_allof, 2, INT_MAX, FN_NOPARSE}, {"ALPHAMAX", fun_alphamax, 1, INT_MAX, FN_REG}, {"ALPHAMIN", fun_alphamin, 1, INT_MAX, FN_REG}, {"AND", fun_and, 2, INT_MAX, FN_REG}, {"ANDFLAGS", fun_andflags, 2, 2, FN_REG}, {"ANDLFLAGS", fun_andlflags, 2, 2, FN_REG}, + {"ANDLPOWERS", fun_andlflags, 2, 2, FN_REG}, + {"ANDPOWERS", fun_andflags, 2, 2, FN_REG}, {"ANSI", fun_ansi, 2, -2, FN_NOPARSE}, {"APOSS", fun_aposs, 1, 1, FN_REG}, {"ART", fun_art, 1, 1, FN_REG}, *************** *** 384,390 **** {"NEXT", fun_next, 1, 1, FN_REG}, {"NOR", fun_nor, 1, INT_MAX, FN_REG}, {"NOT", fun_not, 1, 1, FN_REG}, ! {"NSPEMIT", fun_nspemit, 2, 2, FN_REG}, {"NUM", fun_num, 1, 1, FN_REG}, {"NULL", fun_null, 1, INT_MAX, FN_REG}, {"OBJ", fun_obj, 1, 1, FN_REG}, --- 387,398 ---- {"NEXT", fun_next, 1, 1, FN_REG}, {"NOR", fun_nor, 1, INT_MAX, FN_REG}, {"NOT", fun_not, 1, 1, FN_REG}, ! {"NSEMIT", fun_emit, 1, -1, FN_REG}, ! {"NSLEMIT", fun_lemit, 1, -1, FN_REG}, ! {"NSOEMIT", fun_oemit, 2, -2, FN_REG}, ! {"NSPEMIT", fun_pemit, 2, -2, FN_REG}, ! {"NSREMIT", fun_remit, 2, -2, FN_REG}, ! {"NSZEMIT", fun_zemit, 2, -2, FN_REG}, {"NUM", fun_num, 1, 1, FN_REG}, {"NULL", fun_null, 1, INT_MAX, FN_REG}, {"OBJ", fun_obj, 1, 1, FN_REG}, *************** *** 397,402 **** --- 405,412 ---- {"ORD", fun_ord, 1, 1, FN_REG}, {"ORFLAGS", fun_orflags, 2, 2, FN_REG}, {"ORLFLAGS", fun_orlflags, 2, 2, FN_REG}, + {"ORLPOWERS", fun_orlflags, 2, 2, FN_REG}, + {"ORPOWERS", fun_orflags, 2, 2, FN_REG}, {"OWNER", fun_owner, 1, 1, FN_REG}, {"PARENT", fun_parent, 1, 2, FN_REG}, {"PCREATE", fun_pcreate, 1, 2, FN_REG}, *************** *** 415,420 **** --- 425,431 ---- {"R", fun_r, 1, 1, FN_REG}, {"RAND", fun_rand, 1, 2, FN_REG}, {"RANDWORD", fun_randword, 1, 2, FN_REG}, + {"RECV", fun_recv, 1, 1, FN_REG}, {"REGEDIT", fun_regreplace, 3, INT_MAX, FN_NOPARSE}, {"REGEDITALL", fun_regreplace, 3, INT_MAX, FN_NOPARSE}, {"REGEDITALLI", fun_regreplace, 3, INT_MAX, FN_NOPARSE}, *************** *** 448,457 **** {"ROOM", fun_room, 1, 1, FN_REG}, {"ROOT", fun_root, 2, 2, FN_REG}, {"S", fun_s, 1, -1, FN_REG}, ! {"SCAN", fun_scan, 2, -2, FN_REG}, {"SCRAMBLE", fun_scramble, 1, -1, FN_REG}, {"SECS", fun_secs, 0, 0, FN_REG}, {"SECURE", fun_secure, 1, -1, FN_REG}, {"SET", fun_set, 2, 2, FN_REG}, {"SETQ", fun_setq, 2, 2, FN_REG}, {"SETR", fun_setq, 2, 2, FN_REG}, --- 459,469 ---- {"ROOM", fun_room, 1, 1, FN_REG}, {"ROOT", fun_root, 2, 2, FN_REG}, {"S", fun_s, 1, -1, FN_REG}, ! {"SCAN", fun_scan, 1, -2, FN_REG}, {"SCRAMBLE", fun_scramble, 1, -1, FN_REG}, {"SECS", fun_secs, 0, 0, FN_REG}, {"SECURE", fun_secure, 1, -1, FN_REG}, + {"SENT", fun_sent, 1, 1, FN_REG}, {"SET", fun_set, 2, 2, FN_REG}, {"SETQ", fun_setq, 2, 2, FN_REG}, {"SETR", fun_setq, 2, 2, FN_REG}, *** 1_7_7.848/src/flags.c Wed, 10 Mar 2004 16:24:40 -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) --- 1_7_7.919(w)/src/flags.c Wed, 28 Apr 2004 10:33:08 -0500 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.10 660) *************** *** 8,13 **** --- 8,14 ---- * in some cases). * * Flag functions actually involve with several related entities: + * Flag spaces (FLAGSPACE objects) * Flag definitions (FLAG objects) * Bitmasks representing sets of flags (object_flag_type's). The * bits involved may differ between dbs. *************** *** 49,58 **** static int can_set_flag(dbref player, dbref thing, FLAG *flagp, int negate); static FLAG *letter_to_flagptr(FLAGSPACE * n, char c, int type); static void flag_add(FLAGSPACE * n, const char *name, FLAG *f); ! static int has_flag(dbref thing, FLAG *f); - void decompile_flags(dbref player, dbref thing, const char *name); - void decompile_powers(dbref player, dbref thing, const char *name); static FLAG *flag_read(FILE * in); static void flag_write(FILE * out, FLAG *f, const char *name); static FLAG *flag_hash_lookup(FLAGSPACE * n, const char *name, int type); --- 50,57 ---- static int can_set_flag(dbref player, dbref thing, FLAG *flagp, int negate); static FLAG *letter_to_flagptr(FLAGSPACE * n, char c, int type); static void flag_add(FLAGSPACE * n, const char *name, FLAG *f); ! static int has_flag_ns(FLAGSPACE * n, dbref thing, FLAG *f); static FLAG *flag_read(FILE * in); static void flag_write(FILE * out, FLAG *f, const char *name); static FLAG *flag_hash_lookup(FLAGSPACE * n, const char *name, int type); *************** *** 60,69 **** static FLAG *new_flag(void); static void flag_add_additional(void); static char *list_aliases(FLAGSPACE * n, FLAG *given); ! static void realloc_object_flag_bitmasks(int numbytes); static FLAG *match_flag_ns(FLAGSPACE * n, const char *name); PTAB ptab_flag; /**< Table of flags by name, inc. aliases */ HASHTAB htab_flagspaces; /**< Hash of flagspaces */ extern PTAB ptab_command; /* Uses flag bitmasks */ --- 59,69 ---- static FLAG *new_flag(void); static void flag_add_additional(void); static char *list_aliases(FLAGSPACE * n, FLAG *given); ! static void realloc_object_flag_bitmasks(FLAGSPACE * n); static FLAG *match_flag_ns(FLAGSPACE * n, const char *name); PTAB ptab_flag; /**< Table of flags by name, inc. aliases */ + PTAB ptab_power; /**< Table of powers by name, inc. aliases */ HASHTAB htab_flagspaces; /**< Hash of flagspaces */ extern PTAB ptab_command; /* Uses flag bitmasks */ *************** *** 75,81 **** * table in the db that counts, not this one. */ /* Name Letter Type(s) Flag Perms Negate_Perm */ ! FLAG flag_table[] = { {"CHOWN_OK", 'C', NOTYPE, CHOWN_OK, F_ANY, F_ANY}, {"DARK", 'D', NOTYPE, DARK, F_ANY, F_ANY}, {"GOING", 'G', NOTYPE, GOING, F_INTERNAL, F_ANY}, --- 75,81 ---- * table in the db that counts, not this one. */ /* Name Letter Type(s) Flag Perms Negate_Perm */ ! static FLAG flag_table[] = { {"CHOWN_OK", 'C', NOTYPE, CHOWN_OK, F_ANY, F_ANY}, {"DARK", 'D', NOTYPE, DARK, F_ANY, F_ANY}, {"GOING", 'G', NOTYPE, GOING, F_INTERNAL, F_ANY}, *************** *** 210,254 **** {NULL, NULL} }; ! /** A table of powers and associated bitmasks. ! * One day, this will get folded into the flag system instead. */ /* Name Flag */ ! static POWER power_table[] = { ! {"Announce", CAN_WALL}, ! {"Boot", CAN_BOOT}, ! {"Builder", CAN_BUILD}, ! {"Cemit", CEMIT}, ! {"Chat_Privs", CHAT_PRIVS}, ! {"Functions", GLOBAL_FUNCS}, ! {"Guest", IS_GUEST}, ! {"Halt", HALT_ANYTHING}, ! {"Hide", CAN_HIDE}, ! {"Idle", UNLIMITED_IDLE}, ! {"Immortal", NO_PAY | NO_QUOTA | UNKILLABLE}, ! {"Link_Anywhere", LINK_ANYWHERE}, ! {"Login", LOGIN_ANYTIME}, ! {"Long_Fingers", LONG_FINGERS}, ! {"No_Pay", NO_PAY}, ! {"No_Quota", NO_QUOTA}, ! {"Open_Anywhere", OPEN_ANYWHERE}, ! {"Pemit_All", PEMIT_ALL}, ! {"Player_Create", CREATE_PLAYER}, ! {"Poll", SET_POLL}, ! {"Queue", HUGE_QUEUE}, ! {"Quotas", CHANGE_QUOTAS}, ! {"Search", SEARCH_EVERYTHING}, ! {"See_All", SEE_ALL}, ! {"See_Queue", PS_ALL}, ! {"Tport_Anything", TEL_OTHER}, ! {"Tport_Anywhere", TEL_ANYWHERE}, ! {"Unkillable", UNKILLABLE}, ! {"Can_nspemit", CAN_NSPEMIT}, ! {NULL, 0} }; /** A table of aliases for powers. */ ! static POWER_ALIAS power_alias_tab[] = { {"@cemit", "Cemit"}, {"@wall", "Announce"}, {"wall", "Announce"}, --- 210,256 ---- {NULL, NULL} }; ! /** This is the old defaultpowr table. We still use it when we ! * have to convert old dbs, but once you have a converted db, ! * it's the power table in the db that counts, not this one. */ /* Name Flag */ ! static FLAG power_table[] = { ! {"Announce", '\0', NOTYPE, CAN_WALL, F_WIZARD, F_WIZARD}, ! {"Boot", '\0', NOTYPE, CAN_BOOT, F_WIZARD, F_WIZARD}, ! {"Builder", '\0', NOTYPE, CAN_BUILD, F_WIZARD, F_WIZARD}, ! {"Cemit", '\0', NOTYPE, CEMIT, F_WIZARD, F_WIZARD}, ! {"Chat_Privs", '\0', NOTYPE, CHAT_PRIVS, F_WIZARD, F_WIZARD}, ! {"Functions", '\0', NOTYPE, GLOBAL_FUNCS, F_WIZARD, F_WIZARD}, ! {"Guest", '\0', NOTYPE, IS_GUEST, F_WIZARD, F_WIZARD}, ! {"Halt", '\0', NOTYPE, HALT_ANYTHING, F_WIZARD, F_WIZARD}, ! {"Hide", '\0', NOTYPE, CAN_HIDE, F_WIZARD, F_WIZARD}, ! {"Idle", '\0', NOTYPE, UNLIMITED_IDLE, F_WIZARD, F_WIZARD}, ! {"Immortal", '\0', NOTYPE, NO_PAY | NO_QUOTA | UNKILLABLE, F_WIZARD, ! F_WIZARD}, ! {"Link_Anywhere", '\0', NOTYPE, LINK_ANYWHERE, F_WIZARD, F_WIZARD}, ! {"Login", '\0', NOTYPE, LOGIN_ANYTIME, F_WIZARD, F_WIZARD}, ! {"Long_Fingers", '\0', NOTYPE, LONG_FINGERS, F_WIZARD, F_WIZARD}, ! {"No_Pay", '\0', NOTYPE, NO_PAY, F_WIZARD, F_WIZARD}, ! {"No_Quota", '\0', NOTYPE, NO_QUOTA, F_WIZARD, F_WIZARD}, ! {"Open_Anywhere", '\0', NOTYPE, OPEN_ANYWHERE, F_WIZARD, F_WIZARD}, ! {"Pemit_All", '\0', NOTYPE, PEMIT_ALL, F_WIZARD, F_WIZARD}, ! {"Player_Create", '\0', NOTYPE, CREATE_PLAYER, F_WIZARD, F_WIZARD}, ! {"Poll", '\0', NOTYPE, SET_POLL, F_WIZARD, F_WIZARD}, ! {"Queue", '\0', NOTYPE, HUGE_QUEUE, F_WIZARD, F_WIZARD}, ! {"Quotas", '\0', NOTYPE, CHANGE_QUOTAS, F_WIZARD, F_WIZARD}, ! {"Search", '\0', NOTYPE, SEARCH_EVERYTHING, F_WIZARD, F_WIZARD}, ! {"See_All", '\0', NOTYPE, SEE_ALL, F_WIZARD, F_WIZARD}, ! {"See_Queue", '\0', NOTYPE, PS_ALL, F_WIZARD, F_WIZARD}, ! {"Tport_Anything", '\0', NOTYPE, TEL_OTHER, F_WIZARD, F_WIZARD}, ! {"Tport_Anywhere", '\0', NOTYPE, TEL_ANYWHERE, F_WIZARD, F_WIZARD}, ! {"Unkillable", '\0', NOTYPE, UNKILLABLE, F_WIZARD, F_WIZARD}, ! {"Can_nspemit", '\0', NOTYPE, CAN_NSPEMIT, F_WIZARD, F_WIZARD}, ! {NULL, '\0', 0, 0, 0, 0} }; /** A table of aliases for powers. */ ! static FLAG_ALIAS power_alias_tab[] = { {"@cemit", "Cemit"}, {"@wall", "Announce"}, {"wall", "Announce"}, *************** *** 292,297 **** --- 294,310 ---- * \param name name of flag to find. * \return poiner to flag structure, or NULL. */ + FLAG * + match_power(const char *name) + { + return (FLAG *) match_flag_ns(hashfind("POWER", &htab_flagspaces), name); + } + + /** Convenience function to return a pointer to a flag struct + * given the name. + * \param name name of flag to find. + * \return poiner to flag structure, or NULL. + */ static FLAG * match_flag_ns(FLAGSPACE * n, const char *name) { *************** *** 326,336 **** return f; } ! /* provided for backwards compatibility: type flag checking */ ! if (n->flag_table == flag_table) { ! for (f = type_table; f->name != NULL; f++) ! if (string_prefix(name, f->name)) ! return f; } return NULL; --- 339,351 ---- return f; } ! if (n->tab == &ptab_flag) { ! /* provided for backwards compatibility: type flag checking */ ! if (n->flag_table == flag_table) { ! for (f = type_table; f->name != NULL; f++) ! if (string_prefix(name, f->name)) ! return f; ! } } return NULL; *************** *** 424,448 **** * all the flags on all our objects to get them an additional * byte. */ ! realloc_object_flag_bitmasks((n->flagbits + 7) / 8); } } } - /* Eventually, this need to compute numbytes itself from the - * total bytes required for flags + powers - */ static void ! realloc_object_flag_bitmasks(int numbytes) { dbref it; object_flag_type p; COMMAND_INFO *command; for (it = 0; it < db_top; it++) { ! Flags(it) = (object_flag_type) realloc(Flags(it), numbytes); /* Zero them out */ - p = Flags(it) + numbytes - 1; memset(p, 0, 1); } /* We also need to make sure that all the command flagmasks are --- 439,466 ---- * all the flags on all our objects to get them an additional * byte. */ ! realloc_object_flag_bitmasks(n); } } } static void ! realloc_object_flag_bitmasks(FLAGSPACE * n) { dbref it; object_flag_type p; COMMAND_INFO *command; + int numbytes = (n->flagbits + 7) / 8; for (it = 0; it < db_top; it++) { ! if (n->tab == &ptab_flag) { ! Flags(it) = (object_flag_type) realloc(Flags(it), numbytes); ! p = Flags(it) + numbytes - 1; ! } else { ! Powers(it) = (object_flag_type) realloc(Powers(it), numbytes); ! p = Powers(it) + numbytes - 1; ! } /* Zero them out */ memset(p, 0, 1); } /* We also need to make sure that all the command flagmasks are *************** *** 450,462 **** */ command = (COMMAND_INFO *) ptab_firstentry(&ptab_command); while (command) { ! if (command->flagmask) { command->flagmask = (object_flag_type) realloc(command->flagmask, numbytes); /* Zero them out */ p = command->flagmask + numbytes - 1; memset(p, 0, 1); } command = (COMMAND_INFO *) ptab_nextentry(&ptab_command); } } --- 468,486 ---- */ command = (COMMAND_INFO *) ptab_firstentry(&ptab_command); while (command) { ! if (n->tab == &ptab_flag && command->flagmask) { command->flagmask = (object_flag_type) realloc(command->flagmask, numbytes); /* Zero them out */ p = command->flagmask + numbytes - 1; memset(p, 0, 1); } + if (n->tab == &ptab_power && command->powers) { + command->powers = (object_flag_type) realloc(command->powers, numbytes); + /* Zero them out */ + p = command->powers + numbytes - 1; + memset(p, 0, 1); + } command = (COMMAND_INFO *) ptab_nextentry(&ptab_command); } } *************** *** 485,491 **** } static FLAG * ! flag_alias_read(FILE * in, char *alias) { FLAG *f; char *c; --- 509,515 ---- } static FLAG * ! flag_alias_read(FILE * in, char *alias, FLAGSPACE * n) { FLAG *f; char *c; *************** *** 495,501 **** mush_free(c, "flag alias"); return NULL; /* We're done */ } ! f = match_flag(c); if (!f) { /* Corrupt db. Recover as well as we can. */ do_rawlog(LT_ERR, --- 519,525 ---- mush_free(c, "flag alias"); return NULL; /* We're done */ } ! f = match_flag_ns(n, c); if (!f) { /* Corrupt db. Recover as well as we can. */ do_rawlog(LT_ERR, *************** *** 539,545 **** flag_add(n, f->name, f); } /* Assumes we'll always have at least one alias */ ! while ((f = flag_alias_read(in, alias))) { flag_add(n, alias, f); } flag_add_additional(); --- 563,569 ---- flag_add(n, f->name, f); } /* Assumes we'll always have at least one alias */ ! while ((f = flag_alias_read(in, alias, n))) { flag_add(n, alias, f); } flag_add_additional(); *************** *** 619,624 **** --- 643,655 ---- flags->flag_table = flag_table; flags->flag_alias_table = flag_alias_tab; hashadd("FLAG", (void *) flags, &htab_flagspaces); + flags = (FLAGSPACE *) mush_malloc(sizeof(FLAGSPACE), "flagspace"); + flags->tab = &ptab_power; + flags->flagbits = 0; + flags->flags = NULL; + flags->flag_table = power_table; + flags->flag_alias_table = power_alias_tab; + hashadd("POWER", (void *) flags, &htab_flagspaces); } *************** *** 665,670 **** --- 696,703 ---- flag_add_additional(void) { FLAG *f; + FLAGSPACE *flags; + add_flag("MISTRUST", 'm', TYPE_THING | TYPE_EXIT | TYPE_ROOM, F_INHERIT, F_INHERIT); add_flag("ORPHAN", 'i', NOTYPE, F_ANY, F_ANY); *************** *** 681,690 **** f->letter = '\0'; } f = add_flag("CHAN_USEFIRSTMATCH", '\0', NOTYPE, F_INHERIT, F_INHERIT); if (!match_flag("CHAN_FIRSTMATCH")) ! flag_add(hashfind("FLAG", &htab_flagspaces), "CHAN_FIRSTMATCH", f); if (!match_flag("CHAN_MATCHFIRST")) ! flag_add(hashfind("FLAG", &htab_flagspaces), "CHAN_MATCHFIRST", f); local_flags(); } --- 714,724 ---- f->letter = '\0'; } f = add_flag("CHAN_USEFIRSTMATCH", '\0', NOTYPE, F_INHERIT, F_INHERIT); + flags = hashfind("FLAG", &htab_flagspaces); if (!match_flag("CHAN_FIRSTMATCH")) ! flag_add(flags, "CHAN_FIRSTMATCH", f); if (!match_flag("CHAN_MATCHFIRST")) ! flag_add(flags, "CHAN_MATCHFIRST", f); local_flags(); } *************** *** 720,752 **** * This function takes the flag and toggle bitfields from older databases, * allocates a new flag bitmask, and populates it appropriately * by looking up each flag/toggle value in the old flag table. * \param old_flags an old-style flag bitmask. * \param old_toggles an old-style toggle bitmask. * \param type the object type. * \return a newly allocated flag bitmask representing the flags and toggles. */ object_flag_type ! flags_from_old_flags(long old_flags, long old_toggles, int type) { FLAG *f, *newf; ! object_flag_type bitmask = new_flag_bitmask("FLAG"); ! for (f = flag_table; f->name; f++) { if (f->type == NOTYPE) { if (f->bitpos & old_flags) { ! newf = match_flag(f->name); set_flag_bitmask(bitmask, newf->bitpos); } } else if (f->type & type) { if (f->bitpos & old_toggles) { ! newf = match_flag(f->name); set_flag_bitmask(bitmask, newf->bitpos); } } } for (f = hack_table; f->name; f++) { if ((f->type & type) && (f->bitpos & old_toggles)) { ! newf = match_flag(f->name); set_flag_bitmask(bitmask, newf->bitpos); } } --- 754,790 ---- * This function takes the flag and toggle bitfields from older databases, * allocates a new flag bitmask, and populates it appropriately * by looking up each flag/toggle value in the old flag table. + * It also works for powers (in which case old_toggles should be 0). + * \param ns flagspace in which to locate values. * \param old_flags an old-style flag bitmask. * \param old_toggles an old-style toggle bitmask. * \param type the object type. * \return a newly allocated flag bitmask representing the flags and toggles. */ object_flag_type ! flags_from_old_flags(const char *ns, long old_flags, long old_toggles, int type) { FLAG *f, *newf; ! FLAGSPACE *n; ! object_flag_type bitmask = new_flag_bitmask(ns); ! Flagspace_Lookup(n, ns); ! for (f = n->flag_table; f->name; f++) { if (f->type == NOTYPE) { if (f->bitpos & old_flags) { ! newf = match_flag_ns(n, f->name); set_flag_bitmask(bitmask, newf->bitpos); } } else if (f->type & type) { if (f->bitpos & old_toggles) { ! newf = match_flag_ns(n, f->name); set_flag_bitmask(bitmask, newf->bitpos); } } } for (f = hack_table; f->name; f++) { if ((f->type & type) && (f->bitpos & old_toggles)) { ! newf = match_flag_ns(n, f->name); set_flag_bitmask(bitmask, newf->bitpos); } } *************** *** 767,774 **** /* Doh! Kludge-city. We'll ignore the CHOWN_OK flag on players, because * it's more useful to check 'C' as COLOR. Argle. */ ! if (!(is_flag(f, "CHOWN_OK") && (type == TYPE_PLAYER)) && ! ((f->letter == c) && (f->type & type))) return f; } /* Do we need to do this? */ --- 805,813 ---- /* Doh! Kludge-city. We'll ignore the CHOWN_OK flag on players, because * it's more useful to check 'C' as COLOR. Argle. */ ! if ((n->tab == &ptab_flag) ! && !(is_flag(f, "CHOWN_OK") && (type == TYPE_PLAYER)) ! && ((f->letter == c) && (f->type & type))) return f; } /* Do we need to do this? */ *************** *** 1040,1045 **** --- 1079,1085 ---- /** Check an object for a flag. * This function tests to see if an object has a flag. It is the * function to use for this purpose from outside of this file. + * \param ns name of flagspace to use. * \param thing object to check. * \param flag name of flag to check for (a string). * \param type allowed types of flags to check for. *************** *** 1047,1075 **** * \retval 0 object does not have the flag. */ int ! has_flag_by_name(dbref thing, const char *flag, int type) { FLAG *f; FLAGSPACE *n; ! n = hashfind("FLAG", &htab_flagspaces); f = flag_hash_lookup(n, flag, type); if (!f) return 0; ! return has_flag(thing, f); } static int ! has_flag(dbref thing, FLAG *f) { if (!GoodObject(thing) || IsGarbage(thing)) return 0; ! return has_bit(Flags(thing), f->bitpos); } static int ! can_set_flag(dbref player, dbref thing, FLAG *flagp, int negate) { - /* returns 1 if player can set a flag on thing. */ int myperms; if (!flagp || !GoodObject(player) || !GoodObject(thing)) return 0; --- 1087,1116 ---- * \retval 0 object does not have the flag. */ int ! has_flag_in_space_by_name(const char *ns, dbref thing, const char *flag, ! int type) { FLAG *f; FLAGSPACE *n; ! n = hashfind(ns, &htab_flagspaces); f = flag_hash_lookup(n, flag, type); if (!f) return 0; ! return has_flag_ns(n, thing, f); } static int ! has_flag_ns(FLAGSPACE * n, dbref thing, FLAG *f) { if (!GoodObject(thing) || IsGarbage(thing)) return 0; ! return (n->tab == &ptab_flag) ? ! has_bit(Flags(thing), f->bitpos) : has_bit(Powers(thing), f->bitpos); } static int ! can_set_flag_generic(dbref player, dbref thing, FLAG *flagp, int negate) { int myperms; if (!flagp || !GoodObject(player) || !GoodObject(thing)) return 0; *************** *** 1081,1086 **** --- 1122,1156 ---- if ((myperms & F_INHERIT) && !Wizard(player) && (!Inheritable(player) || !Owns(player, thing))) return 0; + if ((myperms & F_WIZARD) && !Wizard(player)) + return 0; + else if ((myperms & F_ROYAL) && !Hasprivs(player)) + return 0; + else if ((myperms & F_GOD) && !God(player)) + return 0; + return 1; + } + + static int + can_set_power(dbref player, dbref thing, FLAG *flagp, int negate) + { + if (!can_set_flag_generic(player, thing, flagp, negate)) + return 0; + if (Hasprivs(thing) && (is_flag(flagp, "GUEST"))) { + notify(player, T("You can't make admin into guests.")); + return 0; + } + return 1; + + } + + + static int + can_set_flag(dbref player, dbref thing, FLAG *flagp, int negate) + { + if (!can_set_flag_generic(player, thing, flagp, negate)) + return 0; + /* You've got to *own* something (or be Wizard) to set it * chown_ok or dest_ok. This prevents subversion of the * zone-restriction on @chown and @dest *************** *** 1091,1097 **** else return 1; } - /* You must be privileged to set/clear the MONITOR flag on a player */ if (IsPlayer(thing) && is_flag(flagp, "MONITOR") && !Hasprivs(player)) return 0; --- 1161,1166 ---- ***************