This is patch09 to PennMUSH 1.7.7. After applying this patch, you will have version 1.7.7p9 To apply this patch, save it to a file in your top-level MUSH directory, and do the following: patch -p1 < 1.7.7-patch09 make install If you use GNU patch 2.2, you probably want the above to be 'patch -b -p1', not just 'patch -p1'. 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. Then @shutdown and restart your MUSH. - Alan/Javelin In this patch: Functions: * New function scan() works like @scan. Suggested by Viila@M*U*S*H. Flags: * New flag, MISTRUST, prevents an object from controlling anything but itself. Configuration: * mush.cnf directives ansi_justify, globals, and global_connects have been removed (they are now always on). * New unconnected_idle_timeout directive in mush.cnf controls timeouts for connections idle at the connect screen. * New max_guests directive in mush.cnf can limit the number of guests allowed to connect at once. Suggested by Sholevi@M*U*SH. Minor Changes: * New lflags search class takes a list of flag names. * Improved connection failure messages. * Somewhat more informative message when you @chan/gag,hide,mute all channels at once. Suggested by Tanaku and Kevin@M*U*S*H. * Began commenting files using doxygen. * Internal code cleanup. Mostly converting some magic numbers to #define'd symbols, and some #define'd symbols to enums for better debugging and improved readability. Also some conversion of old K&R style functions. [SW] * sort() and the set functions understand all the same comparison types as comp(). [SW] * Case-sensitive comparison currently isn't always possible, depending on the locale the mush is running on. Help files reflect this. [SW] * @uptime shows the time of the last successful database save, and the time of future events like saves, not just the time until them. Suggested by Cheetah@M*U*S*H. [SW] * Improvements to reporting of failed saves. [SW] * Code cleanup. [SW] * tel() now takes a third argument that makes it function like @tel/silent. Suggested by Cheetah@M*U*S*H. [SW] * @idescformat operates like @descformat for internal descriptions. Suggested by Tanya@M*U*S*H. Fixes: * local_startup() was getting run earlier than in the past due to changes in the startup sequence. This has been rectified, so local_startup() again runs after all other initialization (and just before all object startups are triggered). Report by BladedThoth and grapenut@M*U*S*H. * Improved testing for openssl libraries in Configure. The old approach used to cause problems on systems with runtime-only openssl installations without development libraries. * help opaque mentions that opaque blocks look/outside. Suggested by Cheetah@M*U*S*H. * itext() and inum() now generate an error on a null argument, regardless of tiny_math and null_eq_zero settings. Reported by Intrevis@M*U*S*H. * Another fix to the new matcher. Bug report by Kyieren@M*U*S*H. * @flag/alias was broken. Fixed. Reported by Kevin@M*U*S*H. Prereq: 1.7.7p8 *** 1_7_7.154/Patchlevel Mon, 27 Jan 2003 09:40:07 -0600 dunemush (pennmush/5_Patchlevel 1.17.1.11.1.10 600) --- 1_7_7.222(w)/Patchlevel Thu, 20 Feb 2003 09:32:38 -0600 dunemush (pennmush/5_Patchlevel 1.17.1.11.1.10 600) *************** *** 1,2 **** Do not edit this file. It is maintained by the official PennMUSH patches. ! This is PennMUSH 1.7.7p8 --- 1,2 ---- Do not edit this file. It is maintained by the official PennMUSH patches. ! This is PennMUSH 1.7.7p9 *** 1_7_7.154/CHANGES.OLD Wed, 14 Nov 2001 14:49:26 -0600 dunemush (pennmush/7_CHANGES.OL 1.6.1.4 600) --- 1_7_7.222(w)/CHANGES.OLD Wed, 19 Feb 2003 13:19:14 -0600 dunemush (pennmush/7_CHANGES.OL 1.6.1.4.1.1 600) *************** *** 1719,1731 **** * @tel me=home or @tel home now works in all cases where 'home' works. Report by Vedui. - - Version 1.6.10 patchlevel 6 May 11, 1997 - - Fixes: - * inc() and dec() didn't work right with NULL_EQ_ZERO. - Fixed. Report by Dennis DeMarco - Version 1.7.1 patchlevel 3 January 12, 1998 Minor Changes: --- 1719,1724 ---- *************** *** 1814,1824 **** * help @list fixed to show the correct @config switches. Reported by Leo@ATS TrekMUSH * @chan/gag now works correctly. Report by Vedui. - - - Version 1.7.0 patchlevel 11 November 18, 1997 - - Fixes: * Help for remove() updated. Reported by Vedui@Robotech. * hasattr() didn't check if the invoker had permission to read the attribute. Reported by Vedui@Robotech. --- 1807,1812 ---- *** 1_7_7.154/CHANGES Mon, 27 Jan 2003 09:40:07 -0600 dunemush (pennmush/g/23_CHANGES 1.47 600) --- 1_7_7.222(w)/CHANGES Thu, 20 Feb 2003 09:32:58 -0600 dunemush (pennmush/g/23_CHANGES 1.48.1.17 600) *************** *** 18,23 **** --- 18,78 ---- ========================================================================== + Version 1.7.7 patchlevel 9 February 20, 2003 + + Functions: + * New function scan() works like @scan. Suggested by Viila@M*U*S*H. + Flags: + * New flag, MISTRUST, prevents an object from controlling anything + but itself. + Configuration: + * mush.cnf directives ansi_justify, globals, and global_connects have + been removed (they are now always on). + * New unconnected_idle_timeout directive in mush.cnf controls + timeouts for connections idle at the connect screen. + * New max_guests directive in mush.cnf can limit the number of + guests allowed to connect at once. Suggested by Sholevi@M*U*SH. + Minor Changes: + * New lflags search class takes a list of flag names. + * Improved connection failure messages. + * Somewhat more informative message when you @chan/gag,hide,mute + all channels at once. Suggested by Tanaku and Kevin@M*U*S*H. + * Began commenting files using doxygen. + * Internal code cleanup. Mostly converting some magic numbers to + #define'd symbols, and some #define'd symbols to enums for better + debugging and improved readability. Also some conversion of old + K&R style functions. [SW] + * sort() and the set functions understand all the same comparison + types as comp(). [SW] + * Case-sensitive comparison currently isn't always possible, depending + on the locale the mush is running on. Help files reflect this. [SW] + * @uptime shows the time of the last successful database save, and + the time of future events like saves, not just the time until them. + Suggested by Cheetah@M*U*S*H. [SW] + * Improvements to reporting of failed saves. [SW] + * Code cleanup. [SW] + * tel() now takes a third argument that makes it function like + @tel/silent. Suggested by Cheetah@M*U*S*H. [SW] + * @idescformat operates like @descformat for internal descriptions. + Suggested by Tanya@M*U*S*H. + Fixes: + * local_startup() was getting run earlier than in the past due to + changes in the startup sequence. This has been rectified, so + local_startup() again runs after all other initialization (and + just before all object startups are triggered). Report by + BladedThoth and grapenut@M*U*S*H. + * Improved testing for openssl libraries in Configure. The old + approach used to cause problems on systems with runtime-only + openssl installations without development libraries. + * help opaque mentions that opaque blocks look/outside. Suggested + by Cheetah@M*U*S*H. + * itext() and inum() now generate an error on a null argument, + regardless of tiny_math and null_eq_zero settings. Reported by + Intrevis@M*U*S*H. + * Another fix to the new matcher. Bug report by Kyieren@M*U*S*H. + * @flag/alias was broken. Fixed. Reported by Kevin@M*U*S*H. + + Version 1.7.7 patchlevel 8 January 27, 2003 Minor Changes: *** 1_7_7.154/game/txt/hlp/pennvers.hlp Mon, 27 Jan 2003 09:40:07 -0600 dunemush (pennmush/12_pennvers.h 1.169.1.42.1.3.1.2.2.2.1.1.1.3.1.1.1.5.1.4.1.1.1.1.1.1.1.1.1.5.1.1.1.3.1.1.1.3.1.1.1.54.1.10.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.7.1.1.1.1.1.2.1.1.1.4.1.2.1.1.1.1.1.1.1.2.1.1.1.2.1.1.1.1.1.1.1.1.1.8 600) --- 1_7_7.222(w)/game/txt/hlp/pennvers.hlp Wed, 19 Feb 2003 13:20:09 -0600 dunemush (pennmush/12_pennvers.h 1.169.1.42.1.3.1.2.2.2.1.1.1.3.1.1.1.5.1.4.1.1.1.1.1.1.1.1.1.5.1.1.1.3.1.1.1.3.1.1.1.54.1.10.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.7.1.1.1.1.1.2.1.1.1.4.1.2.1.1.1.1.1.1.1.2.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2 600) *************** *** 1,5 **** & changes ! & 1.7.7p8 This is a list of changes in this patchlevel which are probably of interest to players. More information about new commands and functions can probably be gotten via 'help '. 'help credits' --- 1,5 ---- & changes ! & 1.7.7p9 This is a list of changes in this patchlevel which are probably of interest to players. More information about new commands and functions can probably be gotten via 'help '. 'help credits' *************** *** 11,16 **** --- 11,72 ---- A list of the patchlevels associated with each release can be read in 'help patchlevels'. + Version 1.7.7 patchlevel 9 January 27, 2003 + + Functions: + * New function scan() works like @scan. Suggested by Viila@M*U*S*H. + Flags: + * New flag, MISTRUST, prevents an object from controlling anything + but itself. + Configuration: + * mush.cnf directives ansi_justify, globals, and global_connects have + been removed (they are now always on). + * New unconnected_idle_timeout directive in mush.cnf controls + timeouts for connections idle at the connect screen. + * New max_guests directive in mush.cnf can limit the number of + guests allowed to connect at once. Suggested by Sholevi@M*U*SH. + Minor Changes: + * New lflags search class takes a list of flag names. + * Improved connection failure messages. + * Somewhat more informative message when you @chan/gag,hide,mute + all channels at once. Suggested by Tanaku and Kevin@M*U*S*H. + * Began commenting files using doxygen. + * Internal code cleanup. Mostly converting some magic numbers to + #define'd symbols, and some #define'd symbols to enums for better + debugging and improved readability. Also some conversion of old + K&R style functions. [SW] + * sort() and the set functions understand all the same comparison + types as comp(). [SW] + * Case-sensitive comparison currently isn't always possible, depending + on the locale the mush is running on. Help files reflect this. [SW] + * @uptime shows the time of the last successful database save, and + the time of future events like saves, not just the time until them. + Suggested by Cheetah@M*U*S*H. [SW] + * Improvements to reporting of failed saves. [SW] + * Code cleanup. [SW] + * tel() now takes a third argument that makes it function like + @tel/silent. Suggested by Cheetah@M*U*S*H. [SW] + * @idescformat operates like @descformat for internal descriptions. + Suggested by Tanya@M*U*S*H. + Fixes: + * local_startup() was getting run earlier than in the past due to + changes in the startup sequence. This has been rectified, so + local_startup() again runs after all other initialization (and + just before all object startups are triggered). Report by + BladedThoth and grapenut@M*U*S*H. + * Improved testing for openssl libraries in Configure. The old + approach used to cause problems on systems with runtime-only + openssl installations without development libraries. + * help opaque mentions that opaque blocks look/outside. Suggested + by Cheetah@M*U*S*H. + * itext() and inum() now generate an error on a null argument, + regardless of tiny_math and null_eq_zero settings. Reported by + Intrevis@M*U*S*H. + * Another fix to the new matcher. Bug report by Kyieren@M*U*S*H. + * @flag/alias was broken. Fixed. Reported by Kevin@M*U*S*H. + + + & 1.7.7p8 Version 1.7.7 patchlevel 8 January 27, 2003 Minor Changes: *************** *** 1397,1402 **** --- 1453,1471 ---- * Indentation fixes [SW] * Fixes up to 1.7.4p12 merged in. + & 1.7.6p7 + Version 1.7.6 patchlevel 7 January 23, 2003 + + Fixes: + * Some sloppy coding in src/access.c could generate runtime + debugging exceptions. Reported by BladedThoth@M*U*S*H. + * wrap() could behave incorrectly when a line was exactly the length + of the wrap width and the total input size was larger than + any previously wrapped input. Reported by Liam@Firdeloth. + * Extra NUL characters were sent after telnet codes, which + confused Mudnet and maybe some clients. Patch by Alierak. + + & 1.7.6p6 Version 1.7.6 patchlevel 6 January 23, 2003 *************** *** 3368,3381 **** * @tel me=home or @tel home now works in all cases where 'home' works. Report by Vedui. - - & 1.6.10p6 - Version 1.6.10 patchlevel 6 May 11, 1997 - - Fixes: - * inc() and dec() didn't work right with NULL_EQ_ZERO. - Fixed. Report by Dennis DeMarco - & 1.7.1p3 Version 1.7.1 patchlevel 3 January 12, 1998 --- 3437,3442 ---- *************** *** 3468,3479 **** * help @list fixed to show the correct @config switches. Reported by Leo@ATS TrekMUSH * @chan/gag now works correctly. Report by Vedui. - - - & 1.7.0p11 - Version 1.7.0 patchlevel 11 November 18, 1997 - - Fixes: * Help for remove() updated. Reported by Vedui@Robotech. * hasattr() didn't check if the invoker had permission to read the attribute. Reported by Vedui@Robotech. --- 3529,3534 ---- *************** *** 6045,6052 **** For information on a specific patchlevel of one of the versions listed, type 'help p'. For example, 'help 1.7.2p3' ! 1.7.7: 0, 1, 2, 3, 4, 5, 6, 7, 8 ! 1.7.6: 0, 1, 2, 3, 4, 5, 6 1.7.5: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 1.7.4: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 --- 6100,6107 ---- For information on a specific patchlevel of one of the versions listed, type 'help p'. For example, 'help 1.7.2p3' ! 1.7.7: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ! 1.7.6: 0, 1, 2, 3, 4, 5, 6, 7 1.7.5: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 1.7.4: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 *************** *** 6054,6061 **** 1.7.2: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 1.7.1: 0, 1, 2, 3 ! 1.7.0: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 11 ! 1.6.10: 0, 1, 2, 3, 4, 5, 6, 6 1.6.9: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 1.6.8: 0, 1 1.6.7: 0, 1, 2, 3, 4, 5, 6 --- 6109,6116 ---- 1.7.2: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 1.7.1: 0, 1, 2, 3 ! 1.7.0: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ! 1.6.10: 0, 1, 2, 3, 4, 5, 6 1.6.9: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 1.6.8: 0, 1 1.6.7: 0, 1, 2, 3, 4, 5, 6 *** 1_7_7.154/game/txt/hlp/penntop.hlp Thu, 23 Jan 2003 10:16:40 -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.4 600) --- 1_7_7.222(w)/game/txt/hlp/penntop.hlp Tue, 04 Feb 2003 22:08:13 -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.5 600) *************** *** 320,338 **** 2. If V is Wizard, O must be Wizard or God 3. If O is a Wizard, O controls V 4. If V is Royalty, O must be Royalty, Wizard or God ! 5. If V and O are owned by the same player: ! 5a. If V is not TRUST, O controls V ! 5b. If V is TRUST, O must be TRUST or the player must be TRUST ! 6. If V is on a zone, and isn't a player and isn't TRUST, O controls V if O passes the zone-lock of the zone. ! 7. If V is owned by a SHARED player, and V isn't a player and isn't set TRUST, O controls V if O passes the zone-lock of the SHARED player. ! Step 6 is skipped if config(zone_control_zmp_only) is on. There's also one special case: anyone can @link an unlinked exit (at which point the exit is @chowned to the linker). ! See also: controls(), TRUST, ZONES, SHARED PLAYERS & COSTS These are usually: --- 320,339 ---- 2. If V is Wizard, O must be Wizard or God 3. If O is a Wizard, O controls V 4. If V is Royalty, O must be Royalty, Wizard or God ! 5. If O is MISTRUST, O must be V to control V ! 6. If V and O are owned by the same player: ! 6a. If V is not TRUST, O controls V ! 6b. If V is TRUST, O must be TRUST or the player must be TRUST ! 7. If V is on a zone, and isn't a player and isn't TRUST, O controls V if O passes the zone-lock of the zone. ! 8. If V is owned by a SHARED player, and V isn't a player and isn't set TRUST, O controls V if O passes the zone-lock of the SHARED player. ! Step 7 is skipped if config(zone_control_zmp_only) is on. There's also one special case: anyone can @link an unlinked exit (at which point the exit is @chowned to the linker). ! See also: controls(), TRUST, MISTRUST, ZONES, SHARED PLAYERS & COSTS These are usually: *** 1_7_7.154/game/txt/hlp/pennfunc.hlp Thu, 09 Jan 2003 21:37:52 -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.5 600) --- 1_7_7.222(w)/game/txt/hlp/pennfunc.hlp Wed, 12 Feb 2003 15:05:21 -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.8 600) *************** *** 214,222 **** isint() isnum() isword() localize() link() list() lnum() mudname() null() objeval() open() pcreate() r-function rand() restarts() ! s-function set() setq() setr() soundex() ! soundslike() tel() textfile() valid() version() ! wipe() @@() & @@() & NULL() --- 214,222 ---- isint() isnum() isword() localize() link() list() lnum() mudname() null() objeval() open() pcreate() r-function rand() restarts() ! s-function scan() set() setq() setr() ! soundex() soundslike() tel() textfile() valid() ! version() wipe() @@() & @@() & NULL() *************** *** 624,634 **** comparison. By giving the optional , the comparison can be specified: Comparison ! A Case-sensitive lexicographic (default) ! I Case-insensitive lexicographic D Dbrefs of valid objects N Integers F Floating point numbers & CON() con() --- 624,637 ---- comparison. By giving the optional , the comparison can be specified: Comparison ! A Maybe case-sensitive lexicographic (default) ! I Always case-insensitive lexicographic D Dbrefs of valid objects N Integers F Floating point numbers + + Whether or not the a sort type is case-sensitive or not depends + on the particular mush and its environment. & CON() con() *************** *** 2781,2810 **** type @trigger /ve, it would return "This is ", but if vf were @trigger me/ve, then triggering the vf makes the ve return "This is " ! & SCRAMBLE() scramble() ! ! This function scrambles a string, returning a random permutation of its characters. For example, "[scramble(abcdef)]" might return "cfaedb". Note that this function does not pay any attention to spaces or other special characters; it will scramble these characters just like normal characters. ! & SECS() secs() ! This function takes no arguments, and returns the number of elapsed seconds since midnight, January 1, 1970 UTC. UTC is the base time zone, formerly GMT. This is a good way of synchronizing things that must run at a certain time. & SECURE() secure() ! This function returns with all "dangerous" characters replaced ! by spaces. Dangerous characters are ( ) [ ] { } $ % , ^ and ; ! This can make output slightly ugly, but it's a good way of preventing ! other people from doing nasty things with your objects. See also: ESCAPE() --- 2784,2821 ---- type @trigger /ve, it would return "This is ", but if vf were @trigger me/ve, then triggering the vf makes the ve return "This is " ! ! & 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. ! & SCRAMBLE() scramble() ! ! This function scrambles a string, returning a random permutation of its characters. For example, "[scramble(abcdef)]" might return "cfaedb". Note that this function does not pay any attention to spaces or other special characters; it will scramble these characters just like normal characters. ! & SECS() secs() ! This function takes no arguments, and returns the number of elapsed seconds since midnight, January 1, 1970 UTC. UTC is the base time zone, formerly GMT. This is a good way of synchronizing things that must run at a certain time. & SECURE() secure() ! This function returns with all "dangerous" characters replaced ! by spaces. Dangerous characters are ( ) [ ] { } $ % , ^ and ; This ! can make output slightly ugly, but it's a good way of preventing other ! people from doing nasty things with your objects. See also: ESCAPE() *************** *** 2969,2978 **** The following letters as a second argument specify a certain sort: ! 'a': Sort lexicographically. ! 'd': Sort dbrefs. ! 'n': Sort integer numbers. ! 'f': Sort decimal numbers. The optional third argument gives the list's delimiter character. If not present, defaults to a space. --- 2980,2993 ---- The following letters as a second argument specify a certain sort: ! a: Sort lexicographically (Maybe case-sensitive). ! i: Sort lexicographically (Always case-insensitive). ! d: Sort dbrefs. ! n: Sort integer numbers. ! f: Sort decimal numbers. ! ! Whether or not the a sort type is case-sensitive or not depends ! on the particular mush and its environment. The optional third argument gives the list's delimiter character. If not present, defaults to a space. *************** *** 3286,3295 **** See HELP CTU() for more on the angle type. & TEL() ! tel(,) This function will teleport to , exactly as ! @tel =. See also: @tel & TEXTFILE() --- 3301,3311 ---- See HELP CTU() for more on the angle type. & TEL() ! tel(,[,]) This function will teleport to , exactly as ! @tel =. is an optional boolean that, ! if true, makes the function act like @tel/silent. See also: @tel & TEXTFILE() *** 1_7_7.154/game/txt/hlp/pennflag.hlp Wed, 08 Jan 2003 16:41:25 -0600 dunemush (pennmush/17_pennflag.h 1.1.1.1.1.2.1.1.1.2.1.1.1.2.1.1.2.1.2.1.1.1.1.2.1.4.1.2.1.1 600) --- 1_7_7.222(w)/game/txt/hlp/pennflag.hlp Tue, 04 Feb 2003 22:25:23 -0600 dunemush (pennmush/17_pennflag.h 1.1.1.1.1.2.1.1.1.2.1.1.1.2.1.1.2.1.2.1.1.1.1.2.1.4.1.2.1.4 600) *************** *** 50,56 **** a - Audible b - Debug c - Connected, Cloudy d - Destroy_Ok e - Enter_Ok g - Gagged h - Halt j - Jury_Ok l - Light ! m - Myopic n - No_Command o - On-Vacation p - Puppet, Paranoid r - Royalty s - Suspect t - Transparent u - Uninspected v - Verbose w - No_Warn x - Terse ? - Unregistered --- 50,56 ---- a - Audible b - Debug c - Connected, Cloudy d - Destroy_Ok e - Enter_Ok g - Gagged h - Halt j - Jury_Ok l - Light ! m - Myopic, Mistrust n - No_Command o - On-Vacation p - Puppet, Paranoid r - Royalty s - Suspect t - Transparent u - Uninspected v - Verbose w - No_Warn x - Terse ? - Unregistered *************** *** 405,410 **** --- 405,429 ---- players are automatically considered to be MYOPIC. See also: DBREF + & MISTRUST + Flag: MISTRUST (things, rooms, exits) + + Mistrust prevents an object from controlling anything but + itself. This will also usually prevent it from examining anything else + non-VISUAL owned by the same player. It also prevents the object + from benefitting from its owner's no_pay, no_kill, and no_quota + powers, if any. + + This flag can be used when you wish a single player to retain ownership + of objects that other players will use to run arbitrary commands, + and don't want those objects to be able to affect your objects. + + (Note, however, that a Wizard object will ignore this flag, a see_all + object will still be able to examine anything, a no_pay object will + still have unlimited money, etc. This flag works best when no other + privileges are granted to the object.) + + See also: control & NOACCENTS Flag: NOACCENTS (players) *************** *** 494,503 **** & OPAQUE Flag: OPAQUE (all types) ! When set on yourself, it prevents other players from ! seeing what you are carrying in your inventory. This applies to ! everyone and everything, even wizards and royalty, or to stuff ! that you own. It works the same way on objects. When set on an exit in a TRANSPARENT room, the exit is displayed as if the room weren't TRANSPARENT. --- 513,523 ---- & OPAQUE Flag: OPAQUE (all types) ! When set on yourself, it prevents other players from seeing what you are ! carrying in your inventory. This applies to everyone and everything, ! even wizards and royalty, or to stuff that you own. It works the same ! way on objects. This flag also prevents people inside an object ! from using look/outside. When set on an exit in a TRANSPARENT room, the exit is displayed as if the room weren't TRANSPARENT. *** 1_7_7.154/game/txt/hlp/penncmd.hlp Thu, 23 Jan 2003 10:17:00 -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.4.1.3 600) --- 1_7_7.222(w)/game/txt/hlp/penncmd.hlp Sun, 09 Feb 2003 21:33:58 -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.4.1.5 600) *************** *** 33,41 **** @aahear @aclone @aconnect @adisconnect @amhear @away @charges @cost @conformat @descformat @ealias @exitformat @filter @forwardlist @haven ! @idle @infilter @inprefix @lalias @listen ! @nameformat @oxenter @oxleave @oxmove @oxtport ! @prefix @runout @sex @startup See also: ATTRIBUTES, NON-STANDARD ATTRIBUTES & @-BUILDING --- 33,41 ---- @aahear @aclone @aconnect @adisconnect @amhear @away @charges @cost @conformat @descformat @ealias @exitformat @filter @forwardlist @haven ! @idescformat @idle @infilter @inprefix @lalias ! @listen @nameformat @oxenter @oxleave @oxmove ! @oxtport @prefix @runout @sex @startup See also: ATTRIBUTES, NON-STANDARD ATTRIBUTES & @-BUILDING *************** *** 600,606 **** This is useful for things like room parents that enforce a consistent "look" for each room's @desc. ! See also: @exitformat, @nameformat, @conformat & @nameaccent @nameaccent [=] --- 600,618 ---- This is useful for things like room parents that enforce a consistent "look" for each room's @desc. ! See also: @exitformat, @nameformat, @conformat, @idescformat ! & @idescformat ! @idescformat [=] ! ! Replaces the usual description of the object when it is looked at from ! within by player-specified text. The evaluated IDESCRIBE attribute ! is passed as %0; the unevaluated IDESCRIBE can be acquired through ! v(IDESCRIBE). ! ! This is useful for things like object parents that enforce a consistent ! "look" for each object's @idesc. ! ! See also: @exitformat, @nameformat, @conformat, @descformat & @nameaccent @nameaccent [=] *************** *** 1490,1496 **** If [=] or [=] omitted, the attribute will be reset. ! See also: enter, @enter, ENTER_OK, @describe, look & @hook @hook/ [=, ] --- 1502,1508 ---- If [=] or [=] omitted, the attribute will be reset. ! See also: enter, @enter, ENTER_OK, @describe, look, @idescformat & @hook @hook/ [=, ] *************** *** 2596,2603 **** If a argument is supplied, only objects owned by that player will be listed. If a argument is supplied only objects of a certain class will be listed. Possible es include TYPE, NAME, ! ZONE, PARENT, EXITS, OBJECTS (Or THINGS), ROOMS, PLAYERS, FLAGS, POWERS, ! EVAL, EPLAYER, EROOM, EEXIT, and EOBJECT (Or ETHING). If =TYPE, possible s include OBJECT (Or THING), ROOM, EXIT, PLAYER. This shows all objects of the specified type. --- 2608,2615 ---- If a argument is supplied, only objects owned by that player will be listed. If a argument is supplied only objects of a certain class will be listed. Possible es include TYPE, NAME, ! ZONE, PARENT, EXITS, OBJECTS (Or THINGS), ROOMS, PLAYERS, FLAGS, LFLAGS, ! POWERS, EVAL, EPLAYER, EROOM, EEXIT, and EOBJECT (Or ETHING). If =TYPE, possible s include OBJECT (Or THING), ROOM, EXIT, PLAYER. This shows all objects of the specified type. *************** *** 2611,2620 **** 'help @search2' for more. & @search2 If =EXITS, OBJECTS, ROOMS, or PLAYERS, only objects of that type ! If =FLAGS, only objects with the list of flags specified by ! will be listed. Flag names should be specified by single ! letters. Flag names are case-sensitive. If =POWERS, only objects with the given power are listed. Only one power may be specified. --- 2623,2657 ---- 'help @search2' for more. & @search2 If =EXITS, OBJECTS, ROOMS, or PLAYERS, only objects of that type + + If =FLAGS or LFLAGS, only objects with the list of flags + specified by will be listed. For FLAGS, flags to match + should be given as a string of single flag letters, with appropriate + case. For LFLAGS, flags to match should be given as a space-separated + list of flag names. + + If =POWERS, only objects with the given power are listed. Only + one power may be specified. ! If =EVAL, only objects for which evaluates to a ! true boolean value will be listed. The token '##' in , which ! is a function, is replaced by each dbref sequentially. Classes EPLAYER, ! EROOM, EEXIT, and EOBJECT work like EVAL but are restricted to a single type. ! ! See "help @search3" for more. ! & @search3 ! For the class TYPE=PLAYER, and for PLAYER=, anyone may ! obtain information on any player. In all other cases, only wizards may ! obtain information about other players. This is computationally ! expensive, costing 100 pennies. It is generally faster than @find. ! ! Examples: ! @search flags=Wc <-- search for connected wizards. ! @search type=room <-- list all rooms owned by me. ! @search zone=#50 <-- list all objects belong to zone #50. ! @search Joe eval=1,100,200 <-- list objects from #100-#200 owned by Joe. ! @search eval=gt(money(##),10) <-- list all objects owned by me ! worth more than 10 coins. If =POWERS, only objects with the given power are listed. Only one power may be specified. *** 1_7_7.154/game/mushcnf.dst Thu, 23 Jan 2003 10:47:45 -0600 dunemush (pennmush/41_mushcnf.ds 1.1.1.19.1.1.1.2.1.1.1.8.1.1.1.1.1.6 600) --- 1_7_7.222(w)/game/mushcnf.dst Sun, 16 Feb 2003 21:22:43 -0600 dunemush (pennmush/41_mushcnf.ds 1.1.1.19.1.1.1.2.1.1.1.8.1.1.1.1.1.9 600) *************** *** 117,122 **** --- 117,129 ---- # If you don't want a timeout, set it to 0. idle_timeout 0 + # Should there be a limit on how long connections at the connect screen + # (without an associated player) can be idle? + # If you want one, set unconnected_idle_timeout to the # number of MINUTES + # a connection may idle before getting disconnected. + # If you don't want a timeout, set it to 0. + unconnected_idle_timeout 5 + # Should there be a limit on the number of logins the MUSH # can accept? If your operating system has a limited number of # file descriptors per process, you should set this to *************** *** 124,129 **** --- 131,146 ---- # set this to 0. max_logins 120 + # Should there be a limit on the number of concurrent guest logins the MUSH + # will allow? This option can take 3 values: + # 0 = no limit, any number of guests. Logins beyond the number of established + # guest characters will result in multiple players being logged into the + # same guest character. + # -1 = limited to the number of guests in the database. To allow more guests + # to log in, create more guest characters. + # Any other number = the number of guest connections allowed at once. + max_guests 0 + # How much MUSH money do players get when they're created? starting_money 150 *************** *** 404,419 **** # passwords don't work, try changing this setting. reverse_shs yes - ### - ### Master Room and @aconnect/disconnect - ### - - # enable global exits and commands? - globals yes - - # check zones and the master room for aconnect/adisconnect? - global_connects yes - # trigger @aconnect/@adisconnect in a connecting player's location # if the location is a room or thing? room_connects no --- 421,426 ---- *************** *** 534,543 **** # show room/object/player names in bold for ansi players? ansi_names yes - # should ljust(), rjust(), center(), and table() ignore ansi when - # figuring out how to justify a string? - ansi_justify yes - # show exit lists with commas (a, b, and c)? comma_exit_list no --- 541,546 ---- *** 1_7_7.154/config_h.SH Fri, 06 Dec 2002 22:51:58 -0600 dunemush (pennmush/b/17_config_h.S 1.17.1.2.1.1.1.6 660) --- 1_7_7.222(w)/config_h.SH Sun, 02 Feb 2003 10:39:04 -0600 dunemush (pennmush/b/17_config_h.S 1.17.1.2.1.1.1.7 660) *************** *** 599,609 **** */ #$d_newstyle CAN_NEWSTYLE /**/ - /* HAS_OPENSSL: - * Defined if openssl 0.9.6+ is available. - */ - #$d_openssl HAS_OPENSSL /**/ - /* HAS_RANDOM: * Have we got random(), our first choice for number generation? */ --- 599,604 ---- *************** *** 818,822 **** --- 813,822 ---- */ #$i_stdarg I_STDARG /**/ + /* HAS_OPENSSL: + * Defined if openssl 0.9.6+ is available. + */ + #$d_openssl HAS_OPENSSL /**/ + #endif !GROK!THIS! *** 1_7_7.154/src/wiz.c Tue, 14 Jan 2003 22:56:21 -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.2 660) --- 1_7_7.222(w)/src/wiz.c Thu, 20 Feb 2003 09:33:05 -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.3 660) *************** *** 1236,1242 **** } enum search_class { S_OWNER, S_TYPE, S_PARENT, S_ZONE, S_FLAG, ! S_POWER, S_EVAL, S_NAME }; /* Does the actual searching */ --- 1236,1242 ---- } enum search_class { S_OWNER, S_TYPE, S_PARENT, S_ZONE, S_FLAG, ! S_POWER, S_EVAL, S_NAME, S_LFLAG }; /* Does the actual searching */ *************** *** 1369,1375 **** /* Handle the checking later. */ sclass = S_FLAG; if (!restriction || !*restriction) { ! notify(player, T("You must give a flag list.")); return -1; } } else { --- 1369,1382 ---- /* Handle the checking later. */ sclass = S_FLAG; if (!restriction || !*restriction) { ! notify(player, T("You must give a string of flag characters.")); ! return -1; ! } ! } else if (string_prefix("lflags", class)) { ! /* Handle the checking later. */ ! sclass = S_LFLAG; ! if (!restriction || !*restriction) { ! notify(player, T("You must give a list of flag names.")); return -1; } } else { *************** *** 1529,1538 **** } break; case S_FLAG: for (n = low; n <= high; n++) { if ((restrict_owner == ANY_OWNER || Owner(n) == restrict_owner) && (restrict_type == NOTYPE || Typeof(n) == restrict_type) ! && flaglist_check(player, n, restriction, 1)) { if (nresults >= result_size) { dbref *newresults; result_size *= 2; --- 1536,1547 ---- } 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(player, n, restriction, 1) ! : flaglist_check_long(player, n, restriction, 1))) { if (nresults >= result_size) { dbref *newresults; result_size *= 2; *** 1_7_7.154/src/strutil.c Tue, 17 Dec 2002 00:18:29 -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.3 660) --- 1_7_7.222(w)/src/strutil.c Thu, 20 Feb 2003 09:33:05 -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.4 660) *************** *** 906,914 **** if (!p) return 0; - if (!ANSI_JUSTIFY) - return strlen(p); - while (*p) { if (*p == ESC_CHAR) { while ((*p) && (*p != 'm')) --- 906,911 ---- *** 1_7_7.154/src/speech.c Tue, 14 Jan 2003 22:56:21 -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.2.2 660) --- 1_7_7.222(w)/src/speech.c Thu, 20 Feb 2003 09:33:05 -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.2.3 660) *************** *** 34,40 **** const char *msg); void do_one_remit(dbref player, const char *target, const char *msg, int noisy); dbref na_zemit(dbref current, void *data); ! extern int WIN32_CDECL i_comp(const void *s1, const void *s2); static const char *spname(dbref thing); static const char * --- 34,40 ---- const char *msg); 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); static const char * *************** *** 1194,1207 **** void do_remit(dbref player, char *arg1, const char *arg2, int flags) { ! if (flags & 0x2) { /* @remit/list */ char *current; arg1 = trim_space_sep(arg1, ' '); while ((current = split_token(&arg1, ' ')) != NULL) ! do_one_remit(player, current, arg2, flags & 0x1); } else { ! do_one_remit(player, arg1, arg2, flags & 0x1); } } --- 1194,1207 ---- void do_remit(dbref player, char *arg1, const char *arg2, int flags) { ! if (flags & PEMIT_LIST) { /* @remit/list */ 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)); } } *** 1_7_7.154/src/predicat.c Fri, 17 Jan 2003 17:42:29 -0600 dunemush (pennmush/b/44_predicat.c 1.1.1.34.1.1.1.3.1.4.2.12 660) --- 1_7_7.222(w)/src/predicat.c Thu, 20 Feb 2003 09:33:04 -0600 dunemush (pennmush/b/44_predicat.c 1.1.1.34.1.1.1.3.1.4.2.13 660) *************** *** 333,338 **** --- 333,339 ---- controls(dbref who, dbref what) { /* Wizard controls everything + * Untrusted objects control only themselves. * owners control their stuff * something which is in the enterlock of a ZMO controls non-INHERIT * and non-player objects. *************** *** 355,360 **** --- 356,364 ---- if (Wizard(what) || (Hasprivs(what) && !Hasprivs(who))) return 0; + if (Mistrust(who) && (who != what)) + return 0; + if (Owns(who, what) && (!Inheritable(what) || Inheritable(who))) return 1; *** 1_7_7.154/src/player.c Wed, 22 Jan 2003 21:45:40 -0600 dunemush (pennmush/b/47_player.c 1.15.1.1.1.1.1.4.1.6.1.5 660) --- 1_7_7.222(w)/src/player.c Thu, 20 Feb 2003 09:33:04 -0600 dunemush (pennmush/b/47_player.c 1.15.1.1.1.1.1.4.1.6.1.8 660) *************** *** 104,117 **** } dbref ! connect_player(name, password, host, ip) ! const char *name; ! const char *password; ! const char *host; ! const char *ip; { dbref player; ! dbref i; if (!name || !*name) return NOTHING; --- 104,117 ---- } dbref ! connect_player(const char *name, const char *password, const char *host, ! const char *ip, char *errbuf) { dbref player; ! ! /* Default error */ ! strcpy(errbuf, ! T("Either that player does not exist, or has a different password.")); if (!name || !*name) return NOTHING; *************** *** 132,137 **** --- 132,138 ---- do_log(LT_CONN, 0, 0, T("Connection to %s (GUEST) not allowed from %s (%s)"), name, host, ip); + strcpy(errbuf, T("Guest connections not allowed.")); } return NOTHING; } else if (!Guest(player) *************** *** 141,146 **** --- 142,148 ---- do_log(LT_CONN, 0, 0, T("Connection to %s (Non-GUEST) not allowed from %s (%s)"), name, host, ip); + strcpy(errbuf, T("Player connections not allowed.")); } return NOTHING; } *************** *** 154,170 **** } /* If it's a Guest player, and already connected, search the * db for another Guest player to connect them to. */ ! if (Guest(player) && Connected(player)) { ! /* Search db for an unconnected Guest */ ! for (i = 0; i < db_top; i++) { ! if (IsPlayer(i) && !Hasprivs(i) && Guest(i) && !Connected(i)) { ! player = i; ! break; ! } ! } ! if (i == db_top) { ! /* We failed to find an unconnected Guest */ ! do_log(LT_CONN, 0, 0, T("Multiple connection to Guest #%d"), player); } } if (Suspect_Site(host, player) || Suspect_Site(ip, player)) { --- 156,168 ---- } /* If it's a Guest player, and already connected, search the * db for another Guest player to connect them to. */ ! if (Guest(player)) { ! /* Enforce guest limit */ ! player = guest_to_connect(player); ! if (!GoodObject(player)) { ! do_log(LT_CONN, 0, 0, T("Can't connect to a guest (too many connected)")); ! strcpy(errbuf, T("Too many guests are connected now.")); ! return NOTHING; } } if (Suspect_Site(host, player) || Suspect_Site(ip, player)) { *** 1_7_7.154/src/move.c Fri, 03 Jan 2003 00:35:08 -0600 dunemush (pennmush/b/51_move.c 1.1.1.18.1.5.1.13.1.3.1.9.1.1.1.1.1.2.1.1.1.1.1.10 660) --- 1_7_7.222(w)/src/move.c Thu, 20 Feb 2003 09:33:04 -0600 dunemush (pennmush/b/51_move.c 1.1.1.18.1.5.1.13.1.3.1.9.1.1.1.1.1.2.1.1.1.1.1.12 660) *************** *** 337,346 **** void ! do_move(player, direction, type) ! dbref player; ! const char *direction; ! int type; /* type 0 is normal, type 1 is global, type 2 is zone */ { dbref exit_m, loc, var_dest; if (!strcasecmp(direction, "home")) { --- 337,343 ---- void ! do_move(dbref player, const char *direction, enum move_type type) { dbref exit_m, loc, var_dest; if (!strcasecmp(direction, "home")) { *************** *** 364,374 **** safe_tel(player, HOME, 0); } else { /* find the exit */ ! if (DO_GLOBALS && (type == 1)) exit_m = match_result(player, direction, TYPE_EXIT, MAT_ENGLISH | MAT_EXIT | MAT_GLOBAL | MAT_CHECK_KEYS); ! else if (DO_GLOBALS && (type == 2)) exit_m = match_result(player, direction, TYPE_EXIT, MAT_ENGLISH | MAT_EXIT | MAT_REMOTES | MAT_CHECK_KEYS); --- 361,371 ---- safe_tel(player, HOME, 0); } else { /* find the exit */ ! if (type == MOVE_GLOBAL) exit_m = match_result(player, direction, TYPE_EXIT, MAT_ENGLISH | MAT_EXIT | MAT_GLOBAL | MAT_CHECK_KEYS); ! else if (type == MOVE_ZONE) exit_m = match_result(player, direction, TYPE_EXIT, MAT_ENGLISH | MAT_EXIT | MAT_REMOTES | MAT_CHECK_KEYS); *************** *** 754,773 **** notify(player, T("You can't do that IC!")); return; } ! if (DO_GLOBALS) { ! if (can_move(player, command)) ! do_move(player, command, 0); ! else ! if ((Zone(Location(player)) != NOTHING) && remote_exit(player, command)) ! do_move(player, command, 2); ! else if ((Location(player) != MASTER_ROOM) ! && global_exit(player, command)) ! do_move(player, command, 1); ! else ! do_move(player, command, 0); ! } else { do_move(player, command, 0); - } } /* Routines for dealing with the follow commands */ --- 751,765 ---- notify(player, T("You can't do that IC!")); return; } ! if (can_move(player, command)) ! do_move(player, command, 0); ! else if ((Zone(Location(player)) != NOTHING) && remote_exit(player, command)) ! do_move(player, command, 2); ! else if ((Location(player) != MASTER_ROOM) ! && global_exit(player, command)) ! do_move(player, command, 1); ! else do_move(player, command, 0); } /* Routines for dealing with the follow commands */ *** 1_7_7.154/src/match.c Thu, 23 Jan 2003 09:34:35 -0600 dunemush (pennmush/c/2_match.c 1.24.1.1.1.4.1.1.1.1.1.1.1.1.1.1.1.14 660) --- 1_7_7.222(w)/src/match.c Thu, 20 Feb 2003 09:33:04 -0600 dunemush (pennmush/c/2_match.c 1.24.1.1.1.4.1.1.1.1.1.1.1.1.1.1.1.16 660) *************** *** 218,224 **** RUN_MATCH_FUNC(match_possession, NOTHING); if (flags & MAT_NEIGHBOR) RUN_MATCH_FUNC(match_neighbor, NOTHING); ! if (DO_GLOBALS && (flags & MAT_REMOTE_CONTENTS)) RUN_MATCH_FUNC(match_possession, NOTHING); if (flags & MAT_EXIT) RUN_MATCH_FUNC(match_exit, NOTHING); --- 218,224 ---- RUN_MATCH_FUNC(match_possession, NOTHING); if (flags & MAT_NEIGHBOR) RUN_MATCH_FUNC(match_neighbor, NOTHING); ! if (flags & MAT_REMOTE_CONTENTS) RUN_MATCH_FUNC(match_possession, NOTHING); if (flags & MAT_EXIT) RUN_MATCH_FUNC(match_exit, NOTHING); *************** *** 233,240 **** /* nth exact match? */ if (!exact_matches_to_go) match = exact_match; ! else match = last_match; /* nth exact-or-partial match, or nothing? */ } else if (GoodObject(exact_match)) { /* How many exact matches? */ if (exact_matches_to_go == -1) --- 233,244 ---- /* nth exact match? */ if (!exact_matches_to_go) match = exact_match; ! else if (GoodObject(last_match)) match = last_match; /* nth exact-or-partial match, or nothing? */ + /* This shouldn't happen, but just in case we have a valid match, + * and an invalid last_match in the matchnum case, fall through and + * use the match. + */ } else if (GoodObject(exact_match)) { /* How many exact matches? */ if (exact_matches_to_go == -1) *************** *** 503,508 **** --- 507,515 ---- match_type = MATCH_PARTIAL; } } + /* If we've made the nth partial match in this round, there's none to go */ + if (nth_match && *matches_to_go < 0) + *matches_to_go = 0; return match_type; } *************** *** 510,526 **** { dbref loc; loc = (IsRoom(who)) ? who : Location(who); ! if (DO_GLOBALS) { ! if (flags & MAT_REMOTES) { ! if (GoodObject(loc)) ! return match_exit_internal(who, name, type, flags, Zone(loc), ! match, exact_matches_to_go, matches_to_go); ! else ! return NOTHING; ! } else if (flags & MAT_GLOBAL) ! return match_exit_internal(who, name, type, flags, MASTER_ROOM, match, exact_matches_to_go, matches_to_go); ! } return match_exit_internal(who, name, type, flags, loc, match, exact_matches_to_go, matches_to_go); } --- 517,531 ---- { dbref loc; loc = (IsRoom(who)) ? who : Location(who); ! if (flags & MAT_REMOTES) { ! if (GoodObject(loc)) ! return match_exit_internal(who, name, type, flags, Zone(loc), match, exact_matches_to_go, matches_to_go); ! else ! return NOTHING; ! } else if (flags & MAT_GLOBAL) ! return match_exit_internal(who, name, type, flags, MASTER_ROOM, ! match, exact_matches_to_go, matches_to_go); return match_exit_internal(who, name, type, flags, loc, match, exact_matches_to_go, matches_to_go); } *************** *** 562,567 **** --- 567,575 ---- } } } + /* If we've made the nth partial match in this round, there's none to go */ + if (nth_match && *matches_to_go < 0) + *matches_to_go = 0; return match_type; } *** 1_7_7.154/src/look.c Thu, 26 Dec 2002 14:28:58 -0600 dunemush (pennmush/c/4_look.c 1.21.1.2.1.9.1.1.1.3 660) --- 1_7_7.222(w)/src/look.c Thu, 20 Feb 2003 09:33:04 -0600 dunemush (pennmush/c/4_look.c 1.21.1.2.1.9.1.1.1.5 660) *************** *** 34,40 **** 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); static void look_simple(dbref player, dbref thing); ! static void look_description(dbref player, dbref thing, char *def); static int decompile_helper (dbref player, dbref thing, char const *pattern, ATTR *atr, void *args); static int look_helper --- 34,41 ---- 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); static void look_simple(dbref player, dbref thing); ! static void look_description(dbref player, dbref thing, char *def, ! const char *descname, const char *descformatname); static int decompile_helper (dbref player, dbref thing, char const *pattern, ATTR *atr, void *args); static int look_helper *************** *** 49,58 **** void decompile_locks(dbref player, dbref thing, const char *name, int skipdef); static void ! look_exits(player, loc, exit_name) ! dbref player; ! dbref loc; ! const char *exit_name; { dbref thing; char *tbuf1, *tbuf2, *nbuf; --- 50,56 ---- void decompile_locks(dbref player, dbref thing, const char *name, int skipdef); static void ! look_exits(dbref player, dbref loc, const char *exit_name) { dbref thing; char *tbuf1, *tbuf2, *nbuf; *************** *** 230,239 **** static void ! look_contents(player, loc, contents_name) ! dbref player; ! dbref loc; ! const char *contents_name; { dbref thing; dbref can_see_loc; --- 228,234 ---- static void ! look_contents(dbref player, dbref loc, const char *contents_name) { dbref thing; dbref can_see_loc; *************** *** 389,397 **** } static void ! look_simple(player, thing) ! dbref player; ! dbref thing; { int flag = 0; PUEBLOBUFF; --- 384,390 ---- } static void ! look_simple(dbref player, dbref thing) { int flag = 0; PUEBLOBUFF; *************** *** 400,406 **** tag_wrap("FONT", "SIZE=+2", unparse_object_myopic(player, thing)); PEND; notify(player, pbuff); ! look_description(player, thing, T("You see nothing special.")); did_it(player, thing, NULL, NULL, "ODESCRIBE", NULL, "ADESCRIBE", NOTHING); if (IsExit(thing) && Transparented(thing)) { if (Cloudy(thing)) --- 393,400 ---- tag_wrap("FONT", "SIZE=+2", unparse_object_myopic(player, thing)); PEND; notify(player, pbuff); ! look_description(player, thing, T("You see nothing special."), "DESCRIBE", ! "DESCFORMAT"); did_it(player, thing, NULL, NULL, "ODESCRIBE", NULL, "ADESCRIBE", NOTHING); if (IsExit(thing) && Transparented(thing)) { if (Cloudy(thing)) *************** *** 418,427 **** } void ! look_room(player, loc, flag) ! dbref player; ! dbref loc; ! int flag; { /* look at a room. Flag value of this function: * 0 -- normal look, caused by "look" command. --- 412,418 ---- } void ! look_room(dbref player, dbref loc, enum look_type style) { /* look at a room. Flag value of this function: * 0 -- normal look, caused by "look" command. *************** *** 438,447 **** return; /* don't give the unparse if looking through Transparent exit */ ! if ((flag == 0) || (flag == 2)) { PUSE; tag("XCH_PAGE CLEAR=\"LINKS IMAGES PLUGINS\""); ! if (SUPPORT_PUEBLO && flag == 2) { a = atr_get(loc, "VRML_URL"); if (a) { tag(tprintf("IMG XCH_GRAPH=LOAD HREF=\"%s\"", uncompress(a->value))); --- 429,438 ---- return; /* don't give the unparse if looking through Transparent exit */ ! if (style == LOOK_NORMAL || style == LOOK_AUTO) { PUSE; tag("XCH_PAGE CLEAR=\"LINKS IMAGES PLUGINS\""); ! if (SUPPORT_PUEBLO && style == LOOK_AUTO) { a = atr_get(loc, "VRML_URL"); if (a) { tag(tprintf("IMG XCH_GRAPH=LOAD HREF=\"%s\"", uncompress(a->value))); *************** *** 455,489 **** notify_by(loc, player, pbuff); } if (!IsRoom(loc)) { ! if ((flag != 2) || !Terse(player)) { ! if (atr_get(loc, "IDESCRIBE")) ! did_it(player, loc, "IDESCRIBE", NULL, "OIDESCRIBE", NULL, "AIDESCRIBE", NOTHING); ! else ! look_description(player, loc, NULL); } } /* tell him the description */ else { ! if ((flag == 0) || (flag == 2)) { ! if ((flag == 0) || !Terse(player)) { ! look_description(player, loc, NULL); did_it(player, loc, NULL, NULL, "ODESCRIBE", NULL, "ADESCRIBE", NOTHING); } else did_it(player, loc, NULL, NULL, "ODESCRIBE", NULL, "ADESCRIBE", NOTHING); ! } else if (flag != 4) ! look_description(player, loc, NULL); } /* tell him the appropriate messages if he has the key */ ! if (IsRoom(loc) && ((flag == 0) || (flag == 2))) { ! if ((flag == 2) && Terse(player)) { if (could_doit(player, loc)) did_it(player, loc, NULL, NULL, "OSUCCESS", NULL, "ASUCCESS", NOTHING); else did_it(player, loc, NULL, NULL, "OFAILURE", NULL, "AFAILURE", NOTHING); ! } else if ((flag != 4) && could_doit(player, loc)) did_it(player, loc, "SUCCESS", NULL, "OSUCCESS", NULL, "ASUCCESS", NOTHING); else --- 446,481 ---- notify_by(loc, player, pbuff); } if (!IsRoom(loc)) { ! if (style != LOOK_AUTO || !Terse(player)) { ! if (atr_get(loc, "IDESCRIBE")) { ! look_description(player, loc, NULL, "IDESCRIBE", "IDESCFORMAT"); ! did_it(player, loc, NULL, NULL, "OIDESCRIBE", NULL, "AIDESCRIBE", NOTHING); ! } else ! look_description(player, loc, NULL, "DESCRIBE", "DESCFORMAT"); } } /* tell him the description */ else { ! if (style == LOOK_NORMAL || style == LOOK_AUTO) { ! if (style == LOOK_NORMAL || !Terse(player)) { ! look_description(player, loc, NULL, "DESCRIBE", "DESCFORMAT"); did_it(player, loc, NULL, NULL, "ODESCRIBE", NULL, "ADESCRIBE", NOTHING); } else did_it(player, loc, NULL, NULL, "ODESCRIBE", NULL, "ADESCRIBE", NOTHING); ! } else if (style != LOOK_CLOUDY) ! look_description(player, loc, NULL, "DESCRIBE", "DESCFORMAT"); } /* tell him the appropriate messages if he has the key */ ! if (IsRoom(loc) && (style == LOOK_NORMAL || style == LOOK_AUTO)) { ! if (style == LOOK_AUTO && Terse(player)) { if (could_doit(player, loc)) did_it(player, loc, NULL, NULL, "OSUCCESS", NULL, "ASUCCESS", NOTHING); else did_it(player, loc, NULL, NULL, "OFAILURE", NULL, "AFAILURE", NOTHING); ! } else if (could_doit(player, loc)) did_it(player, loc, "SUCCESS", NULL, "OSUCCESS", NULL, "ASUCCESS", NOTHING); else *************** *** 491,505 **** NOTHING); } /* tell him the contents */ ! if (flag != 3) look_contents(player, loc, T("Contents:")); ! if ((flag == 0) || (flag == 2)) { look_exits(player, loc, T("Obvious exits:")); } } static void ! look_description(dbref player, dbref thing, char *def) { /* Show thing's description to player, obeying DESCFORMAT if set */ ATTR *a, *f; --- 483,498 ---- NOTHING); } /* tell him the contents */ ! if (style != LOOK_CLOUDYTRANS) look_contents(player, loc, T("Contents:")); ! if (style == LOOK_NORMAL || style == LOOK_AUTO) { look_exits(player, loc, T("Obvious exits:")); } } static void ! look_description(dbref player, dbref thing, char *def, const char *descname, ! const char *descformatname) { /* Show thing's description to player, obeying DESCFORMAT if set */ ATTR *a, *f; *************** *** 513,519 **** return; save_global_regs("look_desc_save", preserveq); save_global_env("look_desc_save", preserves); ! a = atr_get(thing, "DESCRIBE"); if (a) { /* We have a DESCRIBE, evaluate it into buff */ asave = safe_uncompress(a->value); --- 506,512 ---- return; save_global_regs("look_desc_save", preserveq); save_global_env("look_desc_save", preserves); ! a = atr_get(thing, descname); if (a) { /* We have a DESCRIBE, evaluate it into buff */ asave = safe_uncompress(a->value); *************** *** 524,530 **** *bp = '\0'; free((Malloc_t) asave); } ! f = atr_get(thing, "DESCFORMAT"); if (f) { /* We have a DESCFORMAT, evaluate it into fbuff and use it */ /* If we have a DESCRIBE, pass the evaluated version as %0 */ --- 517,523 ---- *bp = '\0'; free((Malloc_t) asave); } ! f = atr_get(thing, descformatname); if (f) { /* We have a DESCFORMAT, evaluate it into fbuff and use it */ /* If we have a DESCRIBE, pass the evaluated version as %0 */ *************** *** 549,568 **** } void ! do_look_around(player) ! dbref player; { dbref loc; if ((loc = Location(player)) == NOTHING) return; ! look_room(player, loc, 2); /* auto-look. Obey TERSE. */ } void ! do_look_at(player, name, key) ! dbref player; ! const char *name; ! int key; /* 0 is normal, 1 is "outside" */ { dbref thing; dbref loc; --- 542,558 ---- } void ! do_look_around(dbref player) { dbref loc; if ((loc = Location(player)) == NOTHING) return; ! look_room(player, loc, LOOK_AUTO); /* auto-look. Obey TERSE. */ } void ! do_look_at(dbref player, const char *name, int key) ! /* 0 is normal, 1 is "outside" */ { dbref thing; dbref loc; *************** *** 583,589 **** /* look at location of location */ if (*name == '\0') { ! look_room(player, loc, 0); return; } thing = --- 573,579 ---- /* look at location of location */ if (*name == '\0') { ! look_room(player, loc, LOOK_NORMAL); return; } thing = *************** *** 598,604 **** } } else { /* regular look */ if (*name == '\0') { ! look_room(player, Location(player), 0); return; } /* look at a thing in location */ --- 588,594 ---- } } else { /* regular look */ if (*name == '\0') { ! look_room(player, Location(player), LOOK_NORMAL); return; } /* look at a thing in location */ *************** *** 628,639 **** * while inside an object. */ if (Location(player) == thing) { ! look_room(player, thing, 0); return; } switch (Typeof(thing)) { case TYPE_ROOM: ! look_room(player, thing, 0); break; case TYPE_THING: case TYPE_PLAYER: --- 618,629 ---- * while inside an object. */ if (Location(player) == thing) { ! look_room(player, thing, LOOK_NORMAL); return; } switch (Typeof(thing)) { case TYPE_ROOM: ! look_room(player, thing, LOOK_NORMAL); break; case TYPE_THING: case TYPE_PLAYER: *************** *** 650,657 **** #ifdef CHAT_SYSTEM static const char * ! channel_description(player) ! dbref player; { static char buf[BUFFER_LEN]; char *bp; --- 640,646 ---- #ifdef CHAT_SYSTEM static const char * ! channel_description(dbref player) { static char buf[BUFFER_LEN]; char *bp; *************** *** 672,682 **** #endif void ! do_examine(player, name, brief, all) ! dbref player; ! const char *name; ! int brief; ! int all; { dbref thing; ATTR *a; --- 661,667 ---- #endif void ! do_examine(dbref player, const char *name, int brief, int all) { dbref thing; ATTR *a; *************** *** 889,896 **** } void ! do_score(player) ! dbref player; { notify_format(player, --- 874,880 ---- } void ! do_score(dbref player) { notify_format(player, *************** *** 899,906 **** } void ! do_inventory(player) ! dbref player; { dbref thing; if ((thing = Contents(player)) == NOTHING) { --- 883,889 ---- } void ! do_inventory(dbref player) { dbref thing; if ((thing = Contents(player)) == NOTHING) { *************** *** 916,925 **** } void ! do_find(player, name, argv) ! dbref player; ! const char *name; ! char *argv[]; { dbref i; int count = 0; --- 899,905 ---- } void ! do_find(dbref player, const char *name, char *argv[]) { dbref i; int count = 0; *************** *** 965,973 **** /* check the current location for bugs */ void ! do_sweep(player, arg1) ! dbref player; ! const char *arg1; { char tbuf1[BUFFER_LEN]; char *p; --- 945,951 ---- /* check the current location for bugs */ void ! do_sweep(dbref player, const char *arg1) { char tbuf1[BUFFER_LEN]; char *p; *************** *** 1087,1095 **** } void ! do_whereis(player, name) ! dbref player; ! const char *name; { dbref thing; if (*name == '\0') { --- 1065,1071 ---- } void ! do_whereis(dbref player, const char *name) { dbref thing; if (*name == '\0') { *************** *** 1115,1125 **** } void ! do_entrances(player, where, argv, val) ! dbref player; ! const char *where; ! char *argv[]; ! int val; /* 0 all, 1 exits, 2 things, 3 players, 4 rooms */ { dbref place; dbref counter; --- 1091,1097 ---- } void ! do_entrances(dbref player, const char *where, char *argv[], enum ent_type val) { dbref place; dbref counter; *************** *** 1128,1133 **** --- 1100,1107 ---- int bot = 0; int top = db_top; + exc = tc = pc = rc = exd = td = pd = rd = 0; + if (!where || !*where) { if ((place = Location(player)) == NOTHING) return; *************** *** 1148,1175 **** } /* figure out what we're looking for */ switch (val) { ! case 1: exd = 1; td = pd = rd = 0; break; ! case 2: td = 1; exd = pd = rd = 0; break; ! case 3: pd = 1; exd = td = rd = 0; break; ! case 4: rd = 1; exd = td = pd = 0; break; ! default: exd = td = pd = rd = 1; } - exc = tc = pc = rc = 0; - /* determine range */ if (argv[1] && *argv[1]) bot = atoi(argv[1]); --- 1122,1147 ---- } /* figure out what we're looking for */ switch (val) { ! case ENT_EXITS: exd = 1; td = pd = rd = 0; break; ! case ENT_THINGS: td = 1; exd = pd = rd = 0; break; ! case ENT_PLAYERS: pd = 1; exd = td = rd = 0; break; ! case ENT_ROOMS: rd = 1; exd = td = pd = 0; break; ! case ENT_ALL: exd = td = pd = rd = 1; } /* determine range */ if (argv[1] && *argv[1]) bot = atoi(argv[1]); *************** *** 1240,1251 **** }; static int ! decompile_helper(player, thing, pattern, atr, args) ! dbref player; ! dbref thing __attribute__ ((__unused__)); ! char const *pattern __attribute__ ((__unused__)); ! ATTR *atr; ! void *args; { struct dh_args *dh = args; ATTR *ptr; --- 1212,1220 ---- }; static int ! decompile_helper(dbref player, dbref thing ! __attribute__ ((__unused__)), const char *pattern ! __attribute__ ((__unused__)), ATTR *atr, void *args) { struct dh_args *dh = args; ATTR *ptr; *************** *** 1291,1303 **** } void ! decompile_atrs(player, thing, name, pattern, prefix, skipdef) ! dbref player; ! dbref thing; ! const char *name; ! const char *pattern; ! const char *prefix; ! int skipdef; { struct dh_args dh; dh.prefix = prefix; --- 1260,1267 ---- } void ! decompile_atrs(dbref player, dbref thing, const char *name, const char *pattern, ! const char *prefix, int skipdef) { struct dh_args dh; dh.prefix = prefix; *************** *** 1338,1348 **** } void ! do_decompile(player, name, dbflag, skipdef) ! dbref player; ! const char *name; ! int dbflag; /* 0 = normal, 1 = db, 2 = tf, 3=flag,4=attr */ ! int skipdef; { dbref thing; const char *object = NULL; --- 1302,1308 ---- } void ! do_decompile(dbref player, const char *name, enum dec_type dbflag, int skipdef) { dbref thing; const char *object = NULL; *************** *** 1373,1382 **** /* if we have an attribute arg specified, wild match on it */ if (attrib && *attrib) { switch (dbflag) { ! case 1: decompile_atrs(player, thing, dbnum, attrib, "", skipdef); break; ! case 2: if (((a = atr_get_noparent(player, "TFPREFIX")) != NULL) && AL_STR(a) && *AL_STR(a)) { decompile_atrs(player, thing, dbnum, attrib, uncompress(AL_STR(a)), --- 1333,1342 ---- /* if we have an attribute arg specified, wild match on it */ if (attrib && *attrib) { switch (dbflag) { ! case DEC_DB: decompile_atrs(player, thing, dbnum, attrib, "", skipdef); break; ! case DEC_TF: if (((a = atr_get_noparent(player, "TFPREFIX")) != NULL) && AL_STR(a) && *AL_STR(a)) { decompile_atrs(player, thing, dbnum, attrib, uncompress(AL_STR(a)), *************** *** 1403,1443 **** case TYPE_PLAYER: if (!strcasecmp(name, "me")) object = "me"; ! else if (dbflag == 1) object = dbnum; else object = Name(thing); break; case TYPE_THING: ! if (dbflag == 1) { object = dbnum; break; } else object = Name(thing); ! if (dbflag != 4) notify_format(player, "@create %s", object); break; case TYPE_ROOM: ! if (dbflag == 1) { object = dbnum; break; } else object = "here"; ! if (dbflag != 4) notify_format(player, "@dig/teleport %s", Name(thing)); break; case TYPE_EXIT: ! if (dbflag == 1) { object = dbnum; } else { object = shortname(thing); ! if (dbflag != 4) notify_format(player, "@open %s", Name(thing)); } break; } ! if (dbflag != 4) { if (Mobile(thing)) { if (GoodObject(Home(thing))) notify_format(player, "@link %s = #%d", object, Home(thing)); --- 1363,1403 ---- case TYPE_PLAYER: if (!strcasecmp(name, "me")) object = "me"; ! else if (dbflag == DEC_DB) object = dbnum; else object = Name(thing); break; case TYPE_THING: ! if (dbflag == DEC_DB) { object = dbnum; break; } else object = Name(thing); ! if (dbflag != DEC_ATTR) notify_format(player, "@create %s", object); break; case TYPE_ROOM: ! if (dbflag == DEC_DB) { object = dbnum; break; } else object = "here"; ! if (dbflag != DEC_ATTR) notify_format(player, "@dig/teleport %s", Name(thing)); break; case TYPE_EXIT: ! if (dbflag == DEC_DB) { object = dbnum; } else { object = shortname(thing); ! if (dbflag != DEC_ATTR) notify_format(player, "@open %s", Name(thing)); } break; } ! if (dbflag != DEC_ATTR) { if (Mobile(thing)) { if (GoodObject(Home(thing))) notify_format(player, "@link %s = #%d", object, Home(thing)); *************** *** 1461,1467 **** decompile_flags(player, thing, object); decompile_powers(player, thing, object); } ! if (dbflag != 3) { decompile_atrs(player, thing, object, "*", "", skipdef); } } --- 1421,1427 ---- decompile_flags(player, thing, object); decompile_powers(player, thing, object); } ! if (dbflag != DEC_FLAG) { decompile_atrs(player, thing, object, "*", "", skipdef); } } *** 1_7_7.154/src/info_slave.c Sun, 08 Dec 2002 22:36:08 -0600 dunemush (pennmush/c/7_info_slave 1.9.1.4.1.2 660) --- 1_7_7.222(w)/src/info_slave.c Thu, 20 Feb 2003 09:33:04 -0600 dunemush (pennmush/c/7_info_slave 1.9.1.4.1.3 660) *************** *** 100,106 **** if (argc < 2) { fprintf(stderr, "info_slave needs a port number!\n"); ! exit(1); } port = atoi(argv[1]); use_ident = 1; --- 100,106 ---- if (argc < 2) { fprintf(stderr, "info_slave needs a port number!\n"); ! return EXIT_FAILURE; } port = atoi(argv[1]); use_ident = 1; *************** *** 124,130 **** mush = make_socket_conn("127.0.0.1", NULL, 0, port, NULL); if (mush == -1) { /* Couldn't connect */ fprintf(stderr, "Couldn't connect to mush!\n"); ! exit(1); } #endif /* yes, we are _blocking_ */ --- 124,130 ---- mush = make_socket_conn("127.0.0.1", NULL, 0, port, NULL); if (mush == -1) { /* Couldn't connect */ fprintf(stderr, "Couldn't connect to mush!\n"); ! return EXIT_FAILURE; } #endif /* yes, we are _blocking_ */ *************** *** 136,142 **** len = read(mush, &rlen, sizeof rlen); if (len < (int) sizeof rlen) { perror("info_slave reading remote size"); ! exit(1); } /* Now the first address and len of the second. */ dat[0].iov_base = (char *) &remote.data; --- 136,142 ---- len = read(mush, &rlen, sizeof rlen); if (len < (int) sizeof rlen) { perror("info_slave reading remote size"); ! return EXIT_FAILURE; } /* Now the first address and len of the second. */ dat[0].iov_base = (char *) &remote.data; *************** *** 147,153 **** len = readv(mush, dat, 2); if (len < size) { perror("info_slave reading remote sockaddr and local size"); ! exit(1); } /* Now the second address and fd. */ --- 147,153 ---- len = readv(mush, dat, 2); if (len < size) { perror("info_slave reading remote sockaddr and local size"); ! return EXIT_FAILURE; } /* Now the second address and fd. */ *************** *** 159,165 **** len = readv(mush, dat, 2); if (len < size) { perror("info_slave reading local sockaddr and fd"); ! exit(1); } if (!fd) --- 159,165 ---- len = readv(mush, dat, 2); if (len < size) { perror("info_slave reading local sockaddr and fd"); ! return EXIT_FAILURE; } if (!fd) *************** *** 207,213 **** size = dat[0].iov_len + dat[1].iov_len + dat[2].iov_len; if (len < size) { perror("info_slave write packet"); ! exit(1); } } } --- 207,214 ---- size = dat[0].iov_len + dat[1].iov_len + dat[2].iov_len; if (len < size) { perror("info_slave write packet"); ! return EXIT_FAILURE; } } + return EXIT_SUCCESS; } *** 1_7_7.154/src/game.c Sat, 25 Jan 2003 23:35:07 -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.2.1.2 660) --- 1_7_7.222(w)/src/game.c Thu, 20 Feb 2003 09:33:04 -0600 dunemush (pennmush/c/10_game.c 1.50.1.8.1.1.1.1.2.1.1.1.2.1.1.4.1.1.1.1.1.1.1.1.1.1.2.1.1.2.1.1.1.1.1.1.1.2.1.1.1.2.1.1.1.1.1.1.1.1.1.5.1.3.1.2.1.2.1.1.1.2.1.16 660) *************** *** 88,93 **** --- 88,94 ---- char dumpfile[200]; time_t start_time; /* MUSH start time (since process exec'd) */ time_t first_start_time = 0; /* MUSH start time (since last shutdown) */ + time_t last_dump_time = 0; /* Time of last successful db save */ int reboot_count = 0; static int epoch = 0; int reserved; *************** *** 102,108 **** int paranoid_checkpt = 0; /* write out an okay message every x objs */ extern long indb_flags; extern void conf_default_set(void); ! static void dump_database_internal(void); static FILE *db_open(const char *filename); static FILE *db_open_write(const char *filename); static void db_close(FILE * f); --- 103,109 ---- int paranoid_checkpt = 0; /* write out an okay message every x objs */ extern long indb_flags; extern void conf_default_set(void); ! static int dump_database_internal(void); static FILE *db_open(const char *filename); static FILE *db_open_write(const char *filename); static void db_close(FILE * f); *************** *** 137,173 **** dbref orator = NOTHING; - #ifdef WIN32 - void Win32stats(dbref player); - #endif - #ifdef COMP_STATS extern void compress_stats(long *entries, long *mem_used, long *total_uncompressed, long *total_compressed); #endif - #ifdef WIN32 - void - Win32stats(dbref player) - { /* written by NJG */ - MEMORYSTATUS memstat; - double mem; - memstat.dwLength = sizeof(memstat); - GlobalMemoryStatus(&memstat); - notify(player, "---------- Windows memory usage ------------"); - notify_format(player, "%10ld %% memory in use", memstat.dwMemoryLoad); - mem = memstat.dwAvailPhys / 1024.0 / 1024.0; - notify_format(player, "%10.3f Mb free physical memory", mem); - mem = memstat.dwTotalPhys / 1024.0 / 1024.0; - notify_format(player, "%10.3f Mb total physical memory", mem); - mem = memstat.dwAvailPageFile / 1024.0 / 1024.0; - notify_format(player, "%10.3f Mb available in the paging file ", mem); - mem = memstat.dwTotalPageFile / 1024.0 / 1024.0; - notify_format(player, "%10.3f Mb total paging file size", mem); - } /* end of calc_memory_used */ - #endif Pid_t forked_dump_pid = -1; --- 138,150 ---- *************** *** 177,196 **** */ void ! do_dump(player, num, flag) ! dbref player; ! char *num; ! int flag; { - /* flag: 0 = normal, 1 = paranoid, 2 = debug */ if (Wizard(player)) { #ifdef ALWAYS_PARANOID if (1) { #else ! if (flag) { #endif /* want to do a scan before dumping each object */ ! paranoid_dump = flag; if (num && *num) { /* checkpoint interval given */ paranoid_checkpt = atoi(num); --- 154,169 ---- */ void ! do_dump(dbref player, char *num, enum dump_type flag) { if (Wizard(player)) { #ifdef ALWAYS_PARANOID if (1) { #else ! if (flag != DUMP_NORMAL) { #endif /* want to do a scan before dumping each object */ ! paranoid_dump = 1; if (num && *num) { /* checkpoint interval given */ paranoid_checkpt = atoi(num); *************** *** 205,211 **** if (paranoid_checkpt < 1) paranoid_checkpt = 1; } ! if (flag == 1) { notify_format(player, T("Paranoid dumping, checkpoint interval %d."), paranoid_checkpt); do_rawlog(LT_CHECK, --- 178,184 ---- if (paranoid_checkpt < 1) paranoid_checkpt = 1; } ! if (flag == DUMP_PARANOID) { notify_format(player, T("Paranoid dumping, checkpoint interval %d."), paranoid_checkpt); do_rawlog(LT_CHECK, *************** *** 280,290 **** #endif /* HAS_GETRUSAGE */ void ! do_shutdown(player, flag) ! dbref player; ! int flag; /* -1 = panic shutdown, 0 = normal, 1 = paranoid */ { ! if (flag == -1 && !God(player)) { notify(player, T("It takes a God to make me panic.")); return; } --- 253,261 ---- #endif /* HAS_GETRUSAGE */ void ! do_shutdown(dbref player, enum shutdown_type flag) { ! if (flag == SHUT_PANIC && !God(player)) { notify(player, T("It takes a God to make me panic.")); return; } *************** *** 298,307 **** system("touch NORESTART"); #endif ! if (flag == -1) { panic("@shutdown/panic"); } else { ! if (flag == 1) { paranoid_checkpt = db_top / 5; if (paranoid_checkpt < 1) paranoid_checkpt = 1; --- 269,278 ---- system("touch NORESTART"); #endif ! if (flag == SHUT_PANIC) { panic("@shutdown/panic"); } else { ! if (flag == SHUT_PARANOID) { paranoid_checkpt = db_top / 5; if (paranoid_checkpt < 1) paranoid_checkpt = 1; *************** *** 316,322 **** jmp_buf db_err; ! static void dump_database_internal() { char realdumpfile[2048]; --- 287,293 ---- jmp_buf db_err; ! static int dump_database_internal() { char realdumpfile[2048]; *************** *** 337,342 **** --- 308,314 ---- #ifdef HAS_ITIMER install_sig_handler(SIGPROF, signal_cpu_limit); #endif + return 1; } else { local_dump_database(); *************** *** 371,380 **** /* Win32 systems can't rename over an existing file, so unlink first */ unlink(realdumpfile); #endif ! if (rename(realtmpfl, realdumpfile) < 0) perror(realtmpfl); ! } else perror(realtmpfl); #ifdef USE_MAILER sprintf(realdumpfile, "%s%s", options.mail_db, options.compresssuff); strcpy(tmpfl, make_new_epoch_file(options.mail_db, epoch)); --- 343,356 ---- /* Win32 systems can't rename over an existing file, so unlink first */ unlink(realdumpfile); #endif ! if (rename(realtmpfl, realdumpfile) < 0) { perror(realtmpfl); ! longjmp(db_err, 1); ! } ! } else { perror(realtmpfl); + longjmp(db_err, 1); + } #ifdef USE_MAILER sprintf(realdumpfile, "%s%s", options.mail_db, options.compresssuff); strcpy(tmpfl, make_new_epoch_file(options.mail_db, epoch)); *************** *** 386,395 **** #ifdef WIN32 unlink(realdumpfile); #endif ! if (rename(realtmpfl, realdumpfile) < 0) perror(realtmpfl); ! } else perror(realtmpfl); } #endif /* USE_MAILER */ #ifdef CHAT_SYSTEM --- 362,375 ---- #ifdef WIN32 unlink(realdumpfile); #endif ! if (rename(realtmpfl, realdumpfile) < 0) { perror(realtmpfl); ! longjmp(db_err, 1); ! } ! } else { perror(realtmpfl); + longjmp(db_err, 1); + } } #endif /* USE_MAILER */ #ifdef CHAT_SYSTEM *************** *** 402,423 **** #ifdef WIN32 unlink(realdumpfile); #endif ! if (rename(realtmpfl, realdumpfile) < 0) perror(realtmpfl); ! } else perror(realtmpfl); #endif /* CHAT_SYSTEM */ } #endif #ifdef HAS_ITIMER install_sig_handler(SIGPROF, signal_cpu_limit); #endif } void ! panic(message) ! const char *message; { const char *panicfile = options.crash_db; FILE *f = NULL; --- 382,409 ---- #ifdef WIN32 unlink(realdumpfile); #endif ! if (rename(realtmpfl, realdumpfile) < 0) { perror(realtmpfl); ! longjmp(db_err, 1); ! } ! } else { perror(realtmpfl); + longjmp(db_err, 1); + } #endif /* CHAT_SYSTEM */ + time(&last_dump_time); } #endif #ifdef HAS_ITIMER install_sig_handler(SIGPROF, signal_cpu_limit); #endif + + return 0; } void ! panic(const char *message) { const char *panicfile = options.crash_db; FILE *f = NULL; *************** *** 472,481 **** } void ! fork_and_dump(forking) ! int forking; { ! int child, nofork; epoch++; do_rawlog(LT_CHECK, "CHECKPOINTING: %s.#%d#\n", dumpfile, epoch); --- 458,466 ---- } void ! fork_and_dump(int forking) { ! int child, nofork, status; epoch++; do_rawlog(LT_CHECK, "CHECKPOINTING: %s.#%d#\n", dumpfile, epoch); *************** *** 526,534 **** #ifndef WIN32 close(reserved); /* get that file descriptor back */ #endif ! dump_database_internal(); if (!nofork) { ! _exit(0); /* !!! */ } else { #ifndef WIN32 reserved = open("/dev/null", O_RDWR); --- 511,519 ---- #ifndef WIN32 close(reserved); /* get that file descriptor back */ #endif ! status = dump_database_internal(); if (!nofork) { ! _exit(status); /* !!! */ } else { #ifndef WIN32 reserved = open("/dev/null", O_RDWR); *************** *** 589,596 **** extern struct db_stat_info current_state; void ! init_game_config(conf) ! const char *conf; { int a; --- 574,580 ---- extern struct db_stat_info current_state; void ! init_game_config(const char *conf) { int a; *************** *** 632,638 **** } /* Code that should be run after dbs are loaded (usually because we ! * need to have the flag table loaded */ void init_game_postdb(const char *conf) --- 616,622 ---- } /* Code that should be run after dbs are loaded (usually because we ! * need to have the flag table loaded, or because they run last. */ void init_game_postdb(const char *conf) *************** *** 643,648 **** --- 627,636 ---- function_init_postconfig(); /* Load further restrictions from config file */ config_file_startup(conf, 1); + /* Call Local Startup */ + local_startup(); + /* everything else ok. Restart all objects. */ + do_restart(); } *************** *** 715,721 **** if (!GoodObject(PLAYER_START) || (!IsRoom(PLAYER_START))) do_rawlog(LT_ERR, T("WARNING: Player_start (#%d) is NOT a room."), PLAYER_START); ! if (DO_GLOBALS && (!GoodObject(MASTER_ROOM) || (!IsRoom(MASTER_ROOM)))) do_rawlog(LT_ERR, T("WARNING: Master room (#%d) is NOT a room."), MASTER_ROOM); if (!GoodObject(GOD) || (!IsPlayer(GOD))) --- 703,709 ---- if (!GoodObject(PLAYER_START) || (!IsRoom(PLAYER_START))) do_rawlog(LT_ERR, T("WARNING: Player_start (#%d) is NOT a room."), PLAYER_START); ! if (!GoodObject(MASTER_ROOM) || (!IsRoom(MASTER_ROOM))) do_rawlog(LT_ERR, T("WARNING: Master room (#%d) is NOT a room."), MASTER_ROOM); if (!GoodObject(GOD) || (!IsPlayer(GOD))) *************** *** 786,802 **** strcpy(dumpfile, outfile); init_timer(); - /* Call Local Startup */ - local_startup(); - - /* everything else ok. Restart all objects. */ - do_restart(); return 0; } void ! do_readcache(player) ! dbref player; { if (!Wizard(player)) { notify(player, T("Permission denied.")); --- 774,784 ---- strcpy(dumpfile, outfile); init_timer(); return 0; } void ! do_readcache(dbref player) { if (!Wizard(player)) { notify(player, T("Permission denied.")); *************** *** 810,823 **** #define cmd_match(x) atr_comm_match(x, player, '$', ':', cptr, 0, NULL, NULL); void ! process_command(player, command, cause, from_port) ! dbref player; ! char *command; ! dbref cause; ! int from_port; /* 1 if this is direct input from a port ! * (i.e. typed directly by a player). ! * attrib sets don't get parsed then. ! */ { int a; char *p; /* utility */ --- 792,802 ---- #define cmd_match(x) atr_comm_match(x, player, '$', ':', cptr, 0, NULL, NULL); void ! process_command(dbref player, char *command, dbref cause, int from_port) ! /* from_port = 1 if this is direct input from a port (i.e. typed ! * directly by a player). attrib sets ! * don't get parsed then. ! */ { int a; char *p; /* utility */ *************** *** 936,942 **** /* now do check on zones */ if ((!a) && (Zone(Location(player)) != NOTHING)) { ! if (DO_GLOBALS && IsRoom(Zone(Location(player)))) { /* zone of player's location is a zone master room */ --- 915,921 ---- /* now do check on zones */ if ((!a) && (Zone(Location(player)) != NOTHING)) { ! if (IsRoom(Zone(Location(player)))) { /* zone of player's location is a zone master room */ *************** *** 972,995 **** a += cmd_match(Zone(player)); } /* end of zone stuff */ ! if (DO_GLOBALS) { ! /* check global exits only if no other commands are matched */ ! if ((!a) && (Location(player) != MASTER_ROOM)) { ! if (global_exit(player, cptr)) { ! if (!Mobile(player)) ! goto done; ! else { ! do_move(player, cptr, 1); ! goto done; ! } ! } else ! /* global user-defined commands checked if all else fails. ! * May match more than one command in the master room. ! */ ! a += list_match(Contents(MASTER_ROOM)); ! } ! /* end of master room check */ } } /* end of special checks */ if (!a) { notify(player, T("Huh? (Type \"help\" for help.)")); --- 951,972 ---- a += cmd_match(Zone(player)); } /* end of zone stuff */ ! /* check global exits only if no other commands are matched */ ! if ((!a) && (Location(player) != MASTER_ROOM)) { ! if (global_exit(player, cptr)) { ! if (!Mobile(player)) ! goto done; ! else { ! do_move(player, cptr, 1); ! goto done; ! } ! } else ! /* global user-defined commands checked if all else fails. ! * May match more than one command in the master room. ! */ ! a += list_match(Contents(MASTER_ROOM)); } + /* end of master room check */ } /* end of special checks */ if (!a) { notify(player, T("Huh? (Type \"help\" for help.)")); *************** *** 1047,1056 **** } int ! alias_list_check(thing, command, type) ! dbref thing; ! const char *command; ! const char *type; { ATTR *a; char alias[BUFFER_LEN]; --- 1024,1030 ---- } int ! alias_list_check(dbref thing, const char *command, const char *type) { ATTR *a; char alias[BUFFER_LEN]; *************** *** 1068,1077 **** } int ! loc_alias_check(loc, command, type) ! dbref loc; ! const char *command; ! const char *type; { ATTR *a; char alias[BUFFER_LEN]; --- 1042,1048 ---- } int ! loc_alias_check(dbref loc, const char *command, const char *type) { ATTR *a; char alias[BUFFER_LEN]; *************** *** 1084,1091 **** } int ! Hearer(thing) ! dbref thing; { ALIST *ptr; int cmp; --- 1055,1061 ---- } int ! Hearer(dbref thing) { ALIST *ptr; int cmp; *************** *** 1109,1116 **** } int ! Commer(thing) ! dbref thing; { ALIST *ptr; --- 1079,1085 ---- } int ! Commer(dbref thing) { ALIST *ptr; *************** *** 1126,1133 **** } int ! Listener(thing) ! dbref thing; { /* If a monitor flag is set on a room or thing, it's a listener. * Otherwise not (even if ^patterns are present) --- 1095,1101 ---- } int ! Listener(dbref thing) { /* If a monitor flag is set on a room or thing, it's a listener. * Otherwise not (even if ^patterns are present) *************** *** 1136,1144 **** } void ! do_poor(player, arg1) ! dbref player; ! char *arg1; { int amt = atoi(arg1); dbref a; --- 1104,1110 ---- } void ! do_poor(dbref player, char *arg1) { int amt = atoi(arg1); dbref a; *************** *** 1158,1167 **** void ! do_writelog(player, str, ltype) ! dbref player; ! char *str; ! int ltype; { if (!Wizard(player)) { notify(player, T("Permission denied.")); --- 1124,1130 ---- void ! do_writelog(dbref player, char *str, int ltype) { if (!Wizard(player)) { notify(player, T("Permission denied.")); *************** *** 1196,1216 **** mush_free(command, "strip_braces.buff"); } - void - do_scan(player, command, flag) - dbref player; - char *command; - int flag; - { - /* scan for possible matches of user-def'ed commands */ - char atrname[BUFFER_LEN]; - char *ptr; - #define ScanFind(p,x) \ (Can_Examine(p,x) && \ ((num = atr_comm_match(x, p, '$', ':', command, 1, atrname, &ptr)) != 0)) dbref thing; int num; --- 1159,1267 ---- mush_free(command, "strip_braces.buff"); } #define ScanFind(p,x) \ (Can_Examine(p,x) && \ ((num = atr_comm_match(x, p, '$', ':', command, 1, atrname, &ptr)) != 0)) + char * + scan_list(dbref player, char *command) + { + /* scan for possible matches of user-def'd commands from the + * viewpoint of player, and return as a string. + * Assumes that atr_comm_match returns atrname with a leading space. + */ + static char tbuf[BUFFER_LEN]; + char *tp; + dbref thing; + char atrname[BUFFER_LEN]; + char *ptr; + int num; + if (!GoodObject(Location(player))) { + strcpy(tbuf, T("#-1 INVALID LOCATION")); + return tbuf; + } + if (!command || !*command) { + strcpy(tbuf, T("#-1 NO COMMAND")); + return tbuf; + } + tp = tbuf; + ptr = atrname; + DOLIST(thing, Contents(Location(player))) { + if (ScanFind(player, thing)) { + *ptr = '\0'; + safe_str(atrname, tbuf, &tp); + ptr = atrname; + } + } + ptr = atrname; + if (ScanFind(player, Location(player))) { + *ptr = '\0'; + safe_str(atrname, tbuf, &tp); + } + ptr = atrname; + DOLIST(thing, Contents(player)) { + if (ScanFind(player, thing)) { + *ptr = '\0'; + safe_str(atrname, tbuf, &tp); + ptr = atrname; + } + } + /* zone checks */ + ptr = atrname; + if (Zone(Location(player)) != NOTHING) { + if (IsRoom(Zone(Location(player)))) { + /* zone of player's location is a zone master room */ + if (Location(player) != Zone(player)) { + DOLIST(thing, Contents(Zone(Location(player)))) { + if (ScanFind(player, thing)) { + *ptr = '\0'; + safe_str(atrname, tbuf, &tp); + ptr = atrname; + } + } + } + } else { + /* regular zone object */ + if (ScanFind(player, Zone(Location(player)))) { + *ptr = '\0'; + safe_str(atrname, tbuf, &tp); + } + } + ptr = atrname; + if ((Zone(player) != NOTHING) && (Zone(player) != Zone(Location(player)))) { + /* check the player's personal zone */ + if (ScanFind(player, Zone(player))) { + *ptr = '\0'; + safe_str(atrname, tbuf, &tp); + } + } + } + ptr = atrname; + if ((Location(player) != MASTER_ROOM) + && (Zone(Location(player)) != MASTER_ROOM) + && (Zone(player) != MASTER_ROOM)) { + /* try Master Room stuff */ + DOLIST(thing, Contents(MASTER_ROOM)) { + if (ScanFind(player, thing)) { + *ptr = '\0'; + safe_str(atrname, tbuf, &tp); + ptr = atrname; + } + } + } + *tp = '\0'; + if (*tbuf && *tbuf == ' ') + return tbuf + 1; /* atrname comes with leading spaces */ + return tbuf; + } + + void + do_scan(dbref player, char *command, int flag) + { + /* scan for possible matches of user-def'ed commands */ + char atrname[BUFFER_LEN]; + char *ptr; dbref thing; int num; *************** *** 1291,1297 **** } } ptr = atrname; ! if ((Zone(player) != NOTHING) && (Zone(player) != Zone(Location(player)))) { /* check the player's personal zone */ if (ScanFind(player, Zone(player))) { *ptr = '\0'; --- 1342,1349 ---- } } ptr = atrname; ! if ((Zone(player) != NOTHING) ! && (Zone(player) != Zone(Location(player)))) { /* check the player's personal zone */ if (ScanFind(player, Zone(player))) { *ptr = '\0'; *************** *** 1302,1308 **** } } ptr = atrname; ! if (DO_GLOBALS && (flag & CHECK_GLOBAL) && (Location(player) != MASTER_ROOM) && (Zone(Location(player)) != MASTER_ROOM) && (Zone(player) != MASTER_ROOM)) { --- 1354,1360 ---- } } ptr = atrname; ! if ((flag & CHECK_GLOBAL) && (Location(player) != MASTER_ROOM) && (Zone(Location(player)) != MASTER_ROOM) && (Zone(player) != MASTER_ROOM)) { *************** *** 1415,1485 **** } } ! void ! do_uptime(dbref player, int mortal) { char tbuf1[BUFFER_LEN]; - char *p; - - #if defined(HAS_UPTIME) && !defined(linux) FILE *fp; ! char c; ! int i; ! #endif ! int pid; int psize; #ifdef HAS_GETRUSAGE struct rusage usage; - #endif /* HAS_GETRUSAGE */ - #ifdef linux - FILE *fp; - char line[128]; /* Overkill */ - char *nl; #endif - sprintf(tbuf1, T(" Up since: %s"), ctime(&first_start_time)); - if ((p = strchr(tbuf1, '\n'))) - *p = '\0'; - notify(player, tbuf1); - - sprintf(tbuf1, T(" Last reboot: %s"), ctime(&start_time)); - if ((p = strchr(tbuf1, '\n'))) - *p = '\0'; - notify(player, tbuf1); - - sprintf(tbuf1, T("Total reboots: %d"), reboot_count); - notify(player, tbuf1); - - sprintf(tbuf1, T(" Time now: %s"), ctime(&mudtime)); - if ((p = strchr(tbuf1, '\n'))) - *p = '\0'; - notify(player, tbuf1); - - /* calculate times until various events */ - notify_format(player, - T("Time until next database save: %ld minutes %ld seconds."), - (options.dump_counter - mudtime) / 60, - (options.dump_counter - mudtime) % 60); - notify_format(player, - T(" Time until next dbck check: %ld minutes %ld seconds."), - (options.dbck_counter - mudtime) / 60, - (options.dbck_counter - mudtime) % 60); - notify_format(player, - T(" Time until next purge: %ld minutes %ld seconds."), - (options.purge_counter - mudtime) / 60, - (options.purge_counter - mudtime) % 60); - if (options.warn_interval) - notify_format(player, - T(" Time until next @warnings: %ld minutes %ld seconds."), - (options.warn_counter - mudtime) / 60, - (options.warn_counter - mudtime) % 60); - - /* Mortals, go no further! */ - if (!Wizard(player) || mortal) - return; - #ifdef linux - /* Use /proc files instead of calling the external uptime program on linux */ - /* Current time */ { struct tm *t; --- 1467,1491 ---- } } ! static void linux_uptime(dbref player) __attribute__ ((__unused__)); ! static void unix_uptime(dbref player) __attribute__ ((__unused__)); ! static void win32_uptime(dbref player) __attribute__ ((__unused__)); ! ! static void ! linux_uptime(dbref player __attribute__ ((__unused__))) { + #ifdef linux + /* Use /proc files instead of calling the external uptime program on linux */ char tbuf1[BUFFER_LEN]; FILE *fp; ! char line[128]; /* Overkill */ ! char *nl; ! Pid_t pid; int psize; #ifdef HAS_GETRUSAGE struct rusage usage; #endif /* Current time */ { struct tm *t; *************** *** 1535,1564 **** *nl = '\0'; notify(player, tbuf1); - #else /* linux */ - #ifdef HAS_UPTIME - fp = - #ifdef __LCC__ - (FILE *) - #endif - popen(UPTIME_PATH, "r"); - - /* just in case the system is screwy */ - if (fp == NULL) { - notify(player, T("Error -- cannot execute uptime.")); - do_rawlog(LT_ERR, T("** ERROR ** popen for @uptime returned NULL.")); - return; - } - /* print system uptime */ - for (i = 0; (c = getc(fp)) != '\n'; i++) - tbuf1[i] = c; - tbuf1[i] = '\0'; - pclose(fp); - - notify(player, tbuf1); - #endif /* HAS_UPTIME */ - #endif /* !linux */ - /* do process stats */ pid = getpid(); --- 1541,1546 ---- *************** *** 1566,1572 **** notify_format(player, T("\nProcess ID: %10u %10d bytes per page"), pid, psize); - #ifdef linux /* Linux's getrusage() is mostly unimplemented. Just has times, page faults and swapouts. We use /proc/self/status */ --- 1548,1553 ---- *************** *** 1603,1609 **** fclose(fp); ! #else /* LINUX */ #ifdef HAS_GETRUSAGE getrusage(RUSAGE_SELF, &usage); notify_format(player, T("Time used: %10ld user %10ld sys"), --- 1584,1637 ---- fclose(fp); ! #endif ! } ! ! static void ! unix_uptime(dbref player __attribute__ ((__unused__))) ! { ! #ifdef HAS_UPTIME ! FILE *fp; ! char c; ! int i; ! #endif ! #ifdef HAS_GETRUSAGE ! struct rusage usage; ! #endif ! char tbuf1[BUFFER_LEN]; ! Pid_t pid; ! int psize; ! ! #ifdef HAS_UPTIME ! fp = ! #ifdef __LCC__ ! (FILE *) ! #endif ! popen(UPTIME_PATH, "r"); ! ! /* just in case the system is screwy */ ! if (fp == NULL) { ! notify(player, T("Error -- cannot execute uptime.")); ! do_rawlog(LT_ERR, T("** ERROR ** popen for @uptime returned NULL.")); ! return; ! } ! /* print system uptime */ ! for (i = 0; (c = getc(fp)) != '\n'; i++) ! tbuf1[i] = c; ! tbuf1[i] = '\0'; ! pclose(fp); ! ! notify(player, tbuf1); ! #endif /* HAS_UPTIME */ ! ! /* do process stats */ ! ! pid = getpid(); ! psize = getpagesize(); ! notify_format(player, T("\nProcess ID: %10u %10d bytes per page"), ! pid, psize); ! ! #ifdef HAS_GETRUSAGE getrusage(RUSAGE_SELF, &usage); notify_format(player, T("Time used: %10ld user %10ld sys"), *************** *** 1627,1644 **** usage.ru_nivcsw); notify_format(player, "Signals: %10ld", usage.ru_nsignals); #endif /* HAS_GETRUSAGE */ - #endif /* LINUX */ #ifdef WIN32 ! Win32stats(player); #endif } /* Open a db file, which may be compressed, and return a file pointer */ static FILE * ! db_open(filename) ! const char *filename; { FILE *f; #ifndef macintosh --- 1655,1763 ---- usage.ru_nivcsw); notify_format(player, "Signals: %10ld", usage.ru_nsignals); #endif /* HAS_GETRUSAGE */ + } + + static void + win32_uptime(dbref player __attribute__ ((__unused__))) + { /* written by NJG */ #ifdef WIN32 ! MEMORYSTATUS memstat; ! double mem; ! memstat.dwLength = sizeof(memstat); ! GlobalMemoryStatus(&memstat); ! notify(player, "---------- Windows memory usage ------------"); ! notify_format(player, "%10ld %% memory in use", memstat.dwMemoryLoad); ! mem = memstat.dwAvailPhys / 1024.0 / 1024.0; ! notify_format(player, "%10.3f Mb free physical memory", mem); ! mem = memstat.dwTotalPhys / 1024.0 / 1024.0; ! notify_format(player, "%10.3f Mb total physical memory", mem); ! mem = memstat.dwAvailPageFile / 1024.0 / 1024.0; ! notify_format(player, "%10.3f Mb available in the paging file ", mem); ! mem = memstat.dwTotalPageFile / 1024.0 / 1024.0; ! notify_format(player, "%10.3f Mb total paging file size", mem); ! #endif ! } ! ! ! void ! do_uptime(dbref player, int mortal) ! { ! char tbuf1[BUFFER_LEN]; ! struct tm *when; ! ! when = localtime(&first_start_time); ! strftime(tbuf1, sizeof tbuf1, T(" Up since %a %b %d %X %Z %Y"), when); ! notify(player, tbuf1); ! ! when = localtime(&start_time); ! strftime(tbuf1, sizeof tbuf1, T(" Last reboot: %a %b %d %X %Z %Y"), when); ! notify(player, tbuf1); ! ! notify_format(player, T("Total reboots: %d"), reboot_count); ! ! when = localtime(&mudtime); ! strftime(tbuf1, sizeof tbuf1, T(" Time now: %a %b %d %X %Z %Y"), when); ! notify(player, tbuf1); ! ! if (last_dump_time > 0) { ! when = localtime(&last_dump_time); ! strftime(tbuf1, sizeof tbuf1, ! T(" Time of last database save: %a %b %d %X %Z %Y"), when); ! notify(player, tbuf1); ! } ! ! /* calculate times until various events */ ! when = localtime(&options.dump_counter); ! strftime(tbuf1, sizeof tbuf1, "%X", when); ! notify_format(player, ! T ! ("Time until next database save: %ld minutes %ld seconds, at %s"), ! (options.dump_counter - mudtime) / 60, ! (options.dump_counter - mudtime) % 60, tbuf1); ! ! when = localtime(&options.dbck_counter); ! strftime(tbuf1, sizeof tbuf1, "%X", when); ! notify_format(player, ! T ! (" Time until next dbck check: %ld minutes %ld seconds, at %s."), ! (options.dbck_counter - mudtime) / 60, ! (options.dbck_counter - mudtime) % 60, tbuf1); ! ! when = localtime(&options.purge_counter); ! strftime(tbuf1, sizeof tbuf1, "%X", when); ! notify_format(player, ! T ! (" Time until next purge: %ld minutes %ld seconds, at %s."), ! (options.purge_counter - mudtime) / 60, ! (options.purge_counter - mudtime) % 60, tbuf1); ! ! if (options.warn_interval) { ! when = localtime(&options.warn_counter); ! strftime(tbuf1, sizeof tbuf1, "%X", when); ! notify_format(player, ! T ! (" Time until next @warnings: %ld minutes %ld seconds, at %s."), ! (options.warn_counter - mudtime) / 60, ! (options.warn_counter - mudtime) % 60, tbuf1); ! } ! ! /* Mortals, go no further! */ ! if (!Wizard(player) || mortal) ! return; ! #if defined(linux) ! linux_uptime(player); ! #elif defined(WIN32) ! win32_uptime(player); ! #else ! unix_uptime(player); #endif } /* Open a db file, which may be compressed, and return a file pointer */ static FILE * ! db_open(const char *filename) { FILE *f; #ifndef macintosh *************** *** 1676,1683 **** /* Open a file or pipe (if compressing) for writing */ static FILE * ! db_open_write(filename) ! const char *filename; { FILE *f; #ifndef macintosh --- 1795,1801 ---- /* Open a file or pipe (if compressing) for writing */ static FILE * ! db_open_write(const char *filename) { FILE *f; #ifndef macintosh *************** *** 1711,1718 **** /* Close a db file, which may really be a pipe */ static void ! db_close(f) ! FILE *f; { #ifndef macintosh #ifndef WIN32 --- 1829,1835 ---- /* Close a db file, which may really be a pipe */ static void ! db_close(FILE * f) { #ifndef macintosh #ifndef WIN32 *************** *** 1727,1736 **** } void ! do_list(player, arg, lc) ! dbref player; ! char *arg; ! int lc; { if (!arg || !*arg) notify(player, T("I don't understand what you want to @list.")); --- 1844,1850 ---- } void ! do_list(dbref player, char *arg, int lc) { if (!arg || !*arg) notify(player, T("I don't understand what you want to @list.")); *************** *** 1829,1837 **** } char * ! make_new_epoch_file(basename, the_epoch) ! const char *basename; ! int the_epoch; { static char result[BUFFER_LEN]; /* STATIC! */ /* Unlink the last the_epoch and create a new one */ --- 1943,1949 ---- } char * ! make_new_epoch_file(const char *basename, int the_epoch) { static char result[BUFFER_LEN]; /* STATIC! */ /* Unlink the last the_epoch and create a new one */ *** 1_7_7.154/src/funstr.c Tue, 24 Dec 2002 15:20:25 -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.9 660) --- 1_7_7.222(w)/src/funstr.c Thu, 20 Feb 2003 09:33:03 -0600 dunemush (pennmush/c/13_funstr.c 1.28.1.1.1.2.1.4.1.6.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.3.1.5.1.3.1.2.1.2 660) *************** *** 1548,1554 **** * so %r will not mess with any alignment * functions. */ ! while (i <= length + 1) { if ((str[i] == '\n') || (str[i] == '\r')) return i; i++; --- 1548,1554 ---- * so %r will not mess with any alignment * functions. */ ! while (i < length) { if ((str[i] == '\n') || (str[i] == '\r')) return i; i++; *** 1_7_7.154/src/funmisc.c Sat, 30 Nov 2002 15:49:22 -0600 dunemush (pennmush/c/14_funmisc.c 1.30.1.1.1.12 660) --- 1_7_7.222(w)/src/funmisc.c Thu, 20 Feb 2003 09:33:03 -0600 dunemush (pennmush/c/14_funmisc.c 1.30.1.1.1.16 660) *************** *** 11,16 **** --- 11,18 ---- #include "extchat.h" #include "htab.h" #include "flags.h" + #include "match.h" + #include "mushdb.h" #include "dbdefs.h" #include "parse.h" #include "function.h" *************** *** 58,64 **** return; } orator = executor; ! do_pemit_list(executor, args[0], args[1], 1); } /* ARGSUSED */ --- 60,66 ---- return; } orator = executor; ! do_pemit_list(executor, args[0], args[1], PEMIT_LIST); } /* ARGSUSED */ *************** *** 509,511 **** --- 511,531 ---- safe_str("#-1", buff, bp); return; } + + /* ARGSUSED */ + FUNCTION(fun_scan) + { + dbref thing; + + 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; + } + safe_str(scan_list(thing, args[1]), buff, bp); + } *** 1_7_7.154/src/funlist.c Fri, 03 Jan 2003 18:45:37 -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.2 660) --- 1_7_7.222(w)/src/funlist.c Thu, 20 Feb 2003 09:33:03 -0600 dunemush (pennmush/c/16_funlist.c 1.3.1.1.1.5.1.2.1.1.1.1.1.4.1.2.1.2.1.19.1.2.1.1.1.2.1.5.1.1.1.1.1.1.1.1.1.1.2.1.1.3.1.2.1.1.1.1.1.1.1.1.1.1.1.12.1.4 660) *************** *** 19,43 **** #include "lock.h" #include "confmagic.h" - - #define LISTTYPE_ERROR -1 - #define MAX_SORTSIZE (BUFFER_LEN / 2) static char *next_token(char *str, char sep); ! static int autodetect_list(char **ptrs, int nptrs); ! static int get_list_type(char **args, int nargs, ! int type_pos, char **ptrs, int nptrs); ! static int get_list_type_noauto(char **args, int nargs, int type_pos); ! static int WIN32_CDECL a_comp(const void *s1, const void *s2); ! int WIN32_CDECL i_comp(const void *s1, const void *s2); ! static int WIN32_CDECL f_comp(const void *s1, const void *s2); ! static int WIN32_CDECL u_comp(const void *s1, const void *s2); static int regrep_helper(dbref who, dbref what, char const *name, ATTR *atr, void *args); ! static void sane_qsort(void **array, int left, int right, ! int (WIN32_CDECL * compare) (const void *, ! const void *)); static void do_itemfuns(char *buff, char **bp, char *str, char *num, char *word, char *sep, int flag); --- 19,40 ---- #include "lock.h" #include "confmagic.h" #define MAX_SORTSIZE (BUFFER_LEN / 2) static char *next_token(char *str, char sep); ! static list_type autodetect_list(char **ptrs, int nptrs); ! static list_type get_list_type(char **args, int nargs, ! int type_pos, char **ptrs, int nptrs); ! static list_type get_list_type_noauto(char **args, int nargs, int type_pos); ! static int a_comp(const void *s1, const void *s2); ! static int ai_comp(const void *s1, const void *s2); ! int i_comp(const void *s1, const void *s2); ! static int f_comp(const void *s1, const void *s2); ! static int u_comp(const void *s1, const void *s2); static int regrep_helper(dbref who, dbref what, char const *name, ATTR *atr, void *args); ! typedef int (*comp_func) (const void *, const void *); ! static void sane_qsort(void **array, int left, int right, comp_func compare); static void do_itemfuns(char *buff, char **bp, char *str, char *num, char *word, char *sep, int flag); *************** *** 586,597 **** arr2list(words, n, buff, bp, osep); } ! static int ! autodetect_list(ptrs, nptrs) ! char *ptrs[]; ! int nptrs; { ! int sort_type, i; sort_type = NUMERIC_LIST; --- 583,593 ---- arr2list(words, n, buff, bp, osep); } ! static list_type ! autodetect_list(char *ptrs[], int nptrs) { ! list_type sort_type; ! int i; sort_type = NUMERIC_LIST; *************** *** 630,636 **** return sort_type; } ! static int get_list_type(char *args[], int nargs, int type_pos, char *ptrs[], int nptrs) { if (nargs >= type_pos) { --- 626,632 ---- return sort_type; } ! static list_type get_list_type(char *args[], int nargs, int type_pos, char *ptrs[], int nptrs) { if (nargs >= type_pos) { *************** *** 656,662 **** return autodetect_list(ptrs, nptrs); } ! static int get_list_type_noauto(char *args[], int nargs, int type_pos) { if (nargs >= type_pos) { --- 652,658 ---- return autodetect_list(ptrs, nptrs); } ! static list_type get_list_type_noauto(char *args[], int nargs, int type_pos) { if (nargs >= type_pos) { *************** *** 674,698 **** case 'f': return FLOAT_LIST; default: ! return LISTTYPE_ERROR; } } ! return LISTTYPE_ERROR; } ! static int WIN32_CDECL a_comp(const void *s1, const void *s2) { return strcoll(*(char *const *) s1, *(char *const *) s2); } typedef struct i_record i_rec; struct i_record { char *str; int num; }; ! int WIN32_CDECL i_comp(const void *s1, const void *s2) { if (((const i_rec *) s1)->num > ((const i_rec *) s2)->num) --- 670,700 ---- case 'f': return FLOAT_LIST; default: ! return UNKNOWN_LIST; } } ! return UNKNOWN_LIST; } ! static int a_comp(const void *s1, const void *s2) { return strcoll(*(char *const *) s1, *(char *const *) s2); } + static int + ai_comp(const void *s1, const void *s2) + { + return strcasecoll(*(char *const *) s1, *(char *const *) s2); + } + typedef struct i_record i_rec; struct i_record { char *str; int num; }; ! int i_comp(const void *s1, const void *s2) { if (((const i_rec *) s1)->num > ((const i_rec *) s2)->num) *************** *** 708,714 **** NVAL num; }; ! static int WIN32_CDECL f_comp(const void *s1, const void *s2) { if (((const f_rec *) s1)->num > ((const f_rec *) s2)->num) --- 710,716 ---- NVAL num; }; ! static int f_comp(const void *s1, const void *s2) { if (((const f_rec *) s1)->num > ((const f_rec *) s2)->num) *************** *** 722,728 **** static char ucomp_buff[BUFFER_LEN]; static PE_Info *ucomp_pe_info; ! static int WIN32_CDECL u_comp(const void *s1, const void *s2) { char result[BUFFER_LEN], *rp; --- 724,730 ---- static char ucomp_buff[BUFFER_LEN]; static PE_Info *ucomp_pe_info; ! static int u_comp(const void *s1, const void *s2) { char result[BUFFER_LEN], *rp; *************** *** 751,761 **** } /* Compare two values based on sort_type */ ! int WIN32_CDECL ! gencomp(a, b, sort_type) ! char *a; ! char *b; ! int sort_type; { switch (sort_type) { case NUMERIC_LIST: --- 753,760 ---- } /* Compare two values based on sort_type */ ! int ! gencomp(char *a, char *b, list_type sort_type) { switch (sort_type) { case NUMERIC_LIST: *************** *** 817,824 **** int qparse_dbref(const char *s); int ! qparse_dbref(s) ! const char *s; { /* Version of parse_dbref() that doesn't do GoodObject checks */ if (!s || (*s != NUMBER_TOKEN) || !*(s + 1)) --- 816,822 ---- int qparse_dbref(const char *s); int ! qparse_dbref(const char *s) { /* Version of parse_dbref() that doesn't do GoodObject checks */ if (!s || (*s != NUMBER_TOKEN) || !*(s + 1)) *************** *** 827,833 **** } void ! do_gensort(char *s[], int n, int sort_type) { int i; f_rec *fp; --- 825,831 ---- } void ! do_gensort(char *s[], int n, list_type sort_type) { int i; f_rec *fp; *************** *** 835,842 **** --- 833,844 ---- switch (sort_type) { case ALPHANUM_LIST: + case UNKNOWN_LIST: qsort(s, n, sizeof(char *), a_comp); break; + case INSENS_ALPHANUM_LIST: + qsort(s, n, sizeof(char *), ai_comp); + break; case NUMERIC_LIST: ip = (i_rec *) mush_malloc(n * sizeof(i_rec), "do_gensort.int_list"); for (i = 0; i < n; i++) { *************** *** 877,883 **** FUNCTION(fun_sort) { char *ptrs[MAX_SORTSIZE]; ! int nptrs, sort_type; char sep; char outsep[BUFFER_LEN]; --- 879,886 ---- FUNCTION(fun_sort) { char *ptrs[MAX_SORTSIZE]; ! int nptrs; ! list_type sort_type; char sep; char outsep[BUFFER_LEN]; *************** *** 900,909 **** } static void ! sane_qsort(array, left, right, compare) ! void *array[]; ! int left, right; ! int (WIN32_CDECL * compare) (const void *, const void *); { /* Andrew Molitor's qsort, which doesn't require transitivity between * comparisons (essential for preventing crashes due to boneheads --- 903,909 ---- } static void ! sane_qsort(void *array[], int left, int right, comp_func compare) { /* Andrew Molitor's qsort, which doesn't require transitivity between * comparisons (essential for preventing crashes due to boneheads *************** *** 934,940 **** /* Walk the array, looking for stuff that's less than our */ /* pivot. If it is, swap it with the next thing along */ ! if ((*compare) (array[i], array[left]) < 0) { last++; if (last == i) continue; --- 934,940 ---- /* Walk the array, looking for stuff that's less than our */ /* pivot. If it is, swap it with the next thing along */ ! if (compare(array[i], array[left]) < 0) { last++; if (last == i) continue; *************** *** 1024,1030 **** char **a1, **a2; char *tempbuff; int n1, i, a; ! int sort_type = ALPHANUM_LIST; char *osep = NULL, osepd[2] = { '\0', '\0' }; /* if no lists, then no work */ --- 1024,1030 ---- char **a1, **a2; char *tempbuff; int n1, i, a; ! list_type sort_type = ALPHANUM_LIST; char *osep = NULL, osepd[2] = { '\0', '\0' }; /* if no lists, then no work */ *************** *** 1053,1059 **** osep = osepd; } else if (nargs == 4) { sort_type = get_list_type_noauto(args, nargs, 4); ! if (sort_type == LISTTYPE_ERROR) { sort_type = ALPHANUM_LIST; osep = args[3]; } else { --- 1053,1059 ---- osep = osepd; } else if (nargs == 4) { sort_type = get_list_type_noauto(args, nargs, 4); ! if (sort_type == UNKNOWN_LIST) { sort_type = ALPHANUM_LIST; osep = args[3]; } else { *************** *** 1089,1095 **** char sep; char **a1, **a2; int n1, n2, x1, x2, val; ! int sort_type = ALPHANUM_LIST; int osepl = 0; char *osep = NULL, osepd[2] = { '\0', '\0' }; --- 1089,1095 ---- char sep; char **a1, **a2; int n1, n2, x1, x2, val; ! list_type sort_type = ALPHANUM_LIST; int osepl = 0; char *osep = NULL, osepd[2] = { '\0', '\0' }; *************** *** 1116,1122 **** osepl = 1; } else if (nargs == 4) { sort_type = get_list_type_noauto(args, nargs, 4); ! if (sort_type == LISTTYPE_ERROR) { sort_type = ALPHANUM_LIST; osep = args[3]; osepl = arglens[3]; --- 1116,1122 ---- osepl = 1; } else if (nargs == 4) { sort_type = get_list_type_noauto(args, nargs, 4); ! if (sort_type == UNKNOWN_LIST) { sort_type = ALPHANUM_LIST; osep = args[3]; osepl = arglens[3]; *************** *** 1204,1210 **** char sep; char **a1, **a2; int n1, n2, x1, x2, val; ! int sort_type = ALPHANUM_LIST; int osepl = 0; char *osep = NULL, osepd[2] = { '\0', '\0' }; --- 1204,1210 ---- char sep; char **a1, **a2; int n1, n2, x1, x2, val; ! list_type sort_type = ALPHANUM_LIST; int osepl = 0; char *osep = NULL, osepd[2] = { '\0', '\0' }; *************** *** 1231,1237 **** osepl = 1; } else if (nargs == 4) { sort_type = get_list_type_noauto(args, nargs, 4); ! if (sort_type == LISTTYPE_ERROR) { sort_type = ALPHANUM_LIST; osep = args[3]; osepl = arglens[3]; --- 1231,1237 ---- osepl = 1; } else if (nargs == 4) { sort_type = get_list_type_noauto(args, nargs, 4); ! if (sort_type == UNKNOWN_LIST) { sort_type = ALPHANUM_LIST; osep = args[3]; osepl = arglens[3]; *************** *** 2124,2130 **** { int i; ! if (!is_integer(args[0])) { safe_str(T(e_int), buff, bp); return; } --- 2124,2130 ---- { int i; ! if (!is_strict_integer(args[0])) { safe_str(T(e_int), buff, bp); return; } *************** *** 2143,2149 **** { int i; ! if (!is_integer(args[0])) { safe_str(T(e_int), buff, bp); return; } --- 2143,2149 ---- { int i; ! if (!is_strict_integer(args[0])) { safe_str(T(e_int), buff, bp); return; } *** 1_7_7.154/src/fundb.c Fri, 17 Jan 2003 17:42:29 -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.3 660) --- 1_7_7.222(w)/src/fundb.c Thu, 20 Feb 2003 09:33:03 -0600 dunemush (pennmush/c/17_fundb.c 1.1.1.1.1.1.1.1.1.1.1.1.1.3.1.1.1.1.1.7.1.3.1.3.1.3.1.2.1.2.1.3.2.1.2.1.2.1.1.1.1.4.1.1.1.1.1.1.1.1.1.1.1.3.1.1.2.2.2.1.1.1.1.1.1.4 660) *************** *** 1689,1699 **** /* ARGSUSED */ FUNCTION(fun_tel) { if (!command_check_byname(executor, "@tel") || fun->flags & FN_NOSIDEFX) { safe_str(T(e_perm), buff, bp); return; } ! do_teleport(executor, args[0], args[1], 0); } --- 1689,1702 ---- /* ARGSUSED */ FUNCTION(fun_tel) { + int silent = 0; if (!command_check_byname(executor, "@tel") || fun->flags & FN_NOSIDEFX) { safe_str(T(e_perm), buff, bp); return; } ! if (nargs == 3) ! silent = parse_boolean(args[2]); ! do_teleport(executor, args[0], args[1], silent); } *** 1_7_7.154/src/function.c Thu, 09 Jan 2003 21:37:52 -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 660) --- 1_7_7.222(w)/src/function.c Thu, 20 Feb 2003 09:33:03 -0600 dunemush (pennmush/c/18_function.c 1.29.1.14.1.3.1.6.1.1.1.1.1.14.1.2.1.1.1.7.1.2 660) *************** *** 404,409 **** --- 404,410 ---- {"RNUM", fun_rnum, 2, 2, FN_REG}, {"ROOM", fun_room, 1, 1, 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}, *************** *** 440,446 **** {"SWITCHALL", fun_switch, 3, INT_MAX, FN_NOPARSE}, {"T", fun_t, 1, 1, FN_REG}, {"TABLE", fun_table, 1, 5, FN_REG}, ! {"TEL", fun_tel, 2, 2, FN_REG}, {"TEXTFILE", fun_textfile, 2, 2, FN_REG}, {"TIME", fun_time, 0, 1, FN_REG}, {"TIMEFMT", fun_timefmt, 1, 2, FN_REG}, --- 441,447 ---- {"SWITCHALL", fun_switch, 3, INT_MAX, FN_NOPARSE}, {"T", fun_t, 1, 1, FN_REG}, {"TABLE", fun_table, 1, 5, FN_REG}, ! {"TEL", fun_tel, 2, 3, FN_REG}, {"TEXTFILE", fun_textfile, 2, 2, FN_REG}, {"TIME", fun_time, 0, 1, FN_REG}, {"TIMEFMT", fun_timefmt, 1, 2, FN_REG}, *** 1_7_7.154/src/flags.c Sat, 25 Jan 2003 22:43:25 -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.27 660) --- 1_7_7.222(w)/src/flags.c Thu, 20 Feb 2003 09:33:03 -0600 dunemush (pennmush/c/20_flags.c 1.1.1.1.1.1.1.1.1.1.1.1.1.6.1.2.1.1.1.1.1.2.2.2.2.1.2.1.1.3.1.2.1.1.1.1.1.1.1.1.1.3.1.9.1.2.2.1.1.2.1.32 660) *************** *** 1,16 **** ! /* flags.c */ ! ! /* Functions to cope with flags and powers (and also object types, ! * in some cases) ! */ ! ! /* Flag functions actually involve with several related entities: * Flag definitions (FLAG objects) * Bitmasks representing sets of flags (object_flag_type's). The * bits involved may differ between dbs. * Strings of space-separated flag names. This is a string representation * of a bitmask, suitable for display and storage * Strings of flag characters */ #include "config.h" --- 1,20 ---- ! /** ! * \file flags.c ! * ! * \brief Flags and powers (and sometimes object types) in PennMUSH ! * ! * ! * Functions to cope with flags and powers (and also object types, ! * in some cases). ! * ! * Flag functions actually involve with several related entities: * Flag definitions (FLAG objects) * Bitmasks representing sets of flags (object_flag_type's). The * bits involved may differ between dbs. * Strings of space-separated flag names. This is a string representation * of a bitmask, suitable for display and storage * Strings of flag characters + * */ #include "config.h" *************** *** 43,48 **** --- 47,54 ---- int can_set_flag(dbref player, dbref thing, FLAG *flagp, int negate); static FLAG *letter_to_flagptr(char c, int type); + static void flag_add(const char *name, 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); *************** *** 62,69 **** extern PTAB ptab_command; /* Uses flag bitmasks */ ! /* This is the old default flag table. We still use it when we have to ! * convert old dbs */ /* Name Letter Type(s) Flag Perms Negate_Perm */ FLAG flag_table[] = { --- 68,76 ---- extern PTAB ptab_command; /* Uses flag bitmasks */ ! /** This is the old default flag table. We still use it when we have to ! * convert old dbs, but once you have a converted db, it's the flag ! * table in the db that counts, not this one. */ /* Name Letter Type(s) Flag Perms Negate_Perm */ FLAG flag_table[] = { *************** *** 137,144 **** {NULL, '\0', 0, 0, 0, 0} }; ! /* ! * The old table to kludge multi-type toggles. Now used only * for conversion. */ static FLAG hack_table[] = { --- 144,150 ---- {NULL, '\0', 0, 0, 0, 0} }; ! /** The old table to kludge multi-type toggles. Now used only * for conversion. */ static FLAG hack_table[] = { *************** *** 153,158 **** --- 159,167 ---- }; + /** A table of types, as if they were flags. Some functions that + * expect flags also accept, for historical reasons, types. + */ static FLAG type_table[] = { {"PLAYER", 'P', TYPE_PLAYER, TYPE_PLAYER, F_INTERNAL, F_INTERNAL}, {"ROOM", 'R', TYPE_ROOM, TYPE_ROOM, F_INTERNAL, F_INTERNAL}, *************** *** 161,166 **** --- 170,176 ---- {NULL, '\0', 0, 0, 0, 0} }; + /** A table of types, as privileges. */ static PRIV type_privs[] = { {"PLAYER", 'P', TYPE_PLAYER, TYPE_PLAYER}, {"ROOM", 'R', TYPE_ROOM, TYPE_ROOM}, *************** *** 169,174 **** --- 179,188 ---- {NULL, '\0', 0, 0} }; + /** The old default aliases for flags. This table is only used in conversion + * of old databases. Once a database is converted, the alias list in the + * database is what counts. + */ static FLAG_ALIAS flag_alias_tab[] = { {"INHERIT", "TRUST"}, {"TRACE", "DEBUG"}, *************** *** 194,199 **** --- 208,216 ---- {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}, *************** *** 228,233 **** --- 245,251 ---- {NULL, 0} }; + /** A table of aliases for powers. */ static POWER_ALIAS power_alias_tab[] = { {"@cemit", "Cemit"}, {"@wall", "Announce"}, *************** *** 235,240 **** --- 253,259 ---- {NULL, NULL} }; + /** The table of flag privilege bits. */ static PRIV flag_privs[] = { {"trusted", '\0', F_INHERIT, F_INHERIT}, {"owned", '\0', F_OWNED, F_OWNED}, *************** *** 254,265 **** --- 273,299 ---- /*--------------------------------------------------------------------------- * Flag definition functions, including flag hash table handlers */ + + /** 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. + */ FLAG * match_flag(const char *name) { return (FLAG *) ptab_find(&ptab_flag, name); } + /** Given a flag name and mask of types, return a pointer to a flag struct. + * This function first attempts to match the flag name to a flag of the + * right type. If that fails, it tries to match flag characters if the + * name is a single character. If all else fails, it tries to match + * against an object type name. + * \param name name of flag to find. + * \param type mask of desired flag object types. + * \return pointer to flag structure, or NULL. + */ FLAG * flag_hash_lookup(const char *name, int type) { *************** *** 329,335 **** * auto-allocates the next bitpos. Otherwise, bitpos is ignored and * f->bitpos is used. */ ! void flag_add(const char *name, FLAG *f) { /* If this flag has no bitpos assigned, assign it the next one. --- 363,369 ---- * auto-allocates the next bitpos. Otherwise, bitpos is ignored and * f->bitpos is used. */ ! static void flag_add(const char *name, FLAG *f) { /* If this flag has no bitpos assigned, assign it the next one. *************** *** 461,466 **** --- 495,507 ---- return f; } + /** Read flags and aliases from the database. This function expects + * to receive file pointer that's already reading in a database file + * and pointing at the start of the flag table. It reads the flags, + * reads the aliases, and then does any additional flag adding that + * needs to happen. + * \param in file pointer to read from. + */ void flag_read_all(FILE * in) { *************** *** 499,505 **** putstring(out, name); } ! /* Write out all (user-defined) flags */ void flag_write_all(FILE * out) { --- 540,550 ---- putstring(out, name); } ! /** Write flags and aliases to the database. This function expects ! * to receive file pointer that's already writing in a database file. ! * It writes the flags, writes the aliases. ! * \param out file pointer to write to. ! */ void flag_write_all(FILE * out) { *************** *** 528,538 **** } ! /* Load the standard flags as a baseline (and for dbs that haven't ! * yet converted */ void ! init_flag_table() { FLAG *f, *cf; FLAG_ALIAS *a; --- 573,584 ---- } ! /** Initialize the flag table with defaults. ! * This function loads the standard flags as a baseline ! * (and for dbs that haven't yet converted). */ void ! init_flag_table(void) { FLAG *f, *cf; FLAG_ALIAS *a; *************** *** 561,569 **** --- 607,625 ---- static void flag_add_additional(void) { + add_flag("MISTRUST", 'm', TYPE_THING | TYPE_EXIT | TYPE_ROOM, F_INHERIT, + F_INHERIT); local_flags(); } + /** Extract object type from old-style flag value. + * Before 1.7.7p5, object types were stored in the lowest 3 bits of the + * flag value. Now they get their own place in the object structure, + * but if we're reading an older database, we need to extract the types + * from the old flag value. + * \param old_flags an old-style flag bitmask. + * \return a type bitflag. + */ int type_from_old_flags(long old_flags) { *************** *** 583,590 **** return -1; } ! /* Allocate a new flag bitmask and parse old-style flags and toggles ! * into it */ object_flag_type flags_from_old_flags(long old_flags, long old_toggles, int type) --- 639,652 ---- return -1; } ! /** Extract flags from old-style flag and toggle values. ! * 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) *************** *** 643,649 **** #define FlagByte(x) (x / 8) #define FlagBit(x) (7 - (x % 8)) ! /* Allocate a new flag bitmask */ object_flag_type new_flag_bitmask(void) { --- 705,716 ---- #define FlagByte(x) (x / 8) #define FlagBit(x) (7 - (x % 8)) ! /** Allocate a new flag bitmask. ! * This function allocates