# Patch name: SIDEFX Flag # Patch version: 1.0 # Author's name: David Cheatham (David@M*U*S*H) # Author's email: david@mush.cx # Version of PennMUSH: 1.7.3p3 # Date patch made: Sat Aug 5 15:55:35 EDT 2000 # Author is willing to support (yes/no): yes # Patch format: Context # # # This is a contributed PennMUSH patch. Its use is subject to the # same restrictions found in PennMUSH's hdrs/copyrite.h file. # # No warranty is given for this patch. It is not necessarily going # to work on your system, with any version of PennMUSH other than # the one above, etc. # # If the author given above was willing to support the patch, you # should write to the author if you have any questions or problems. Do # *NOT* send email messages to Javelin or any PennMUSH mailing list about # this patch! # # Below this line is the author's description of the patch, # followed by the patch itself. If the patch is in context diff # format, you'll probably apply it by typing: patch < patchfile # in your top-level MUSH directory, unless instructed otherwise # below. # # This patch adds the option to use the SIDEFX flag, which # works like the SIDEFX flag on various other servers. # You have to enable FUNCTION_SIDE_EFFECTS and SIDEFX_FLAG. *** /usr/local/mu/pennmush/src/conf.c Mon Jul 17 10:59:53 2000 --- src/conf.c Sat Aug 5 15:48:31 2000 *************** *** 865,871 **** On second thought after writing it, I think having config() set options as well as @config/set is a mistake. */ if (nargs == 2) { /* Set the option */ ! #ifdef FUNCTION_SIDE_EFFECTS if (!Wizard(executor)) { safe_str("#-1 PERMISSIION DENIED", buff, bp); return; --- 865,874 ---- On second thought after writing it, I think having config() set options as well as @config/set is a mistake. */ if (nargs == 2) { /* Set the option */ ! if (!SideFX(executor)) { ! safe_str("#-1 NO SIDEFX FOR OBJECT", buff, bp); ! return; ! } if (!Wizard(executor)) { safe_str("#-1 PERMISSIION DENIED", buff, bp); return; *************** *** 883,892 **** return; } /* Return the new value */ - #else - safe_str("#-1 TWO-ARGUMENT FORM OF FUNCTION DISABLED", buff, bp); - return; - #endif } if (args[0] && *args[0]) { --- 886,891 ---- *************** *** 963,968 **** --- 962,970 ---- #ifdef FUNCTION_SIDE_EFFECTS notify(player, " Side effect functions are enabled."); + #ifdef SIDEFX_FLAG + notify(player, " SIDEFX flag is enable."); + #endif #else notify(player, " Side effect functions are disabled."); #endif *** /usr/local/mu/pennmush/src/flags.c Mon Jul 17 10:59:53 2000 --- src/flags.c Sat Aug 5 14:13:19 2000 *************** *** 119,124 **** --- 119,127 ---- #endif {"TRANSPARENT", 't', NOTYPE, TRANSPARENTED, F_ANY, F_ANY}, {"VERBOSE", 'v', NOTYPE, VERBOSE, F_ANY, F_ANY}, + #ifdef SIDEFX_FLAG + {"SIDEFX", 'i', NOTYPE, SIDEFX, F_INHERIT, F_INHERIT}, + #endif {"ANSI", 'A', TYPE_PLAYER, PLAYER_ANSI, F_ANY, F_ANY}, #ifdef EXTENDED_ANSI *************** *** 190,195 **** --- 193,207 ---- }; static FLAG_ALIAS flag_alias_tab[] = { + #ifdef SIDEFX_FLAG + {"SIDE_FX", "SIDEFX"}, + {"SIDE_F", "SIDEFX"}, + {"SIDE_", "SIDEFX"}, + {"SIDEF", "SIDEFX"}, + {"SIDE", "SIDEFX"}, + {"SID", "SIDEFX"}, + {"SI", "SIDEFX"}, + #endif {"CHOWN_O", "CHOWN_OK"}, {"CHOWN_", "CHOWN_OK"}, {"CHOWN", "CHOWN_OK"}, *** /usr/local/mu/pennmush/src/fundb.c Mon Jul 17 10:59:53 2000 --- src/fundb.c Sat Aug 5 15:54:05 2000 *************** *** 953,964 **** safe_str("#-1 PERMISSION DENIED", buff, bp); return; } ! #ifdef FUNCTION_SIDE_EFFECTS ! do_lock(executor, args[0], args[1], ltype); ! #else ! safe_str("#-1 FUNCTION DISABLED", buff, bp); ! #endif ! return; } if ((it != NOTHING) && (ltype != NULL) && Can_Read_Lock(executor, it, ltype)) { --- 953,964 ---- safe_str("#-1 PERMISSION DENIED", buff, bp); return; } ! if (SideFX(executor)) { ! do_lock(executor, args[0], args[1], ltype); ! } else { ! safe_str("#-1 NO SIDEFX FOR OBJECT", buff, bp); ! return; ! } } if ((it != NOTHING) && (ltype != NULL) && Can_Read_Lock(executor, it, ltype)) { *************** *** 1114,1125 **** safe_str("#-1 PERMISSION DENIED", buff, bp); return; } ! #ifdef FUNCTION_SIDE_EFFECTS ! do_chzone(executor, args[0], args[1]); ! #else ! safe_str("#-1 FUNCTION DISABLED", buff, bp); ! return; ! #endif } it = match_thing(executor, args[0]); if (!GoodObject(it) || !Can_Examine(executor, it)) { --- 1114,1125 ---- safe_str("#-1 PERMISSION DENIED", buff, bp); return; } ! if (SideFX(executor)) { ! do_chzone(executor, args[0], args[1]); ! } else { ! safe_str("#-1 NO SIDEFX FOR OBJECT", buff, bp); ! return; ! } } it = match_thing(executor, args[0]); if (!GoodObject(it) || !Can_Examine(executor, it)) { *************** *** 1139,1150 **** safe_str("#-1 PERMISSION DENIED", buff, bp); return; } ! #ifdef FUNCTION_SIDE_EFFECTS ! do_parent(executor, args[0], args[1]); ! #else ! safe_str("#-1 FUNCTION DISABLED", buff, bp); ! return; ! #endif } it = match_thing(executor, args[0]); if (!GoodObject(it) || !Can_Examine(executor, it)) { --- 1139,1150 ---- safe_str("#-1 PERMISSION DENIED", buff, bp); return; } ! if (SideFX(executor)) { ! do_parent(executor, args[0], args[1]); ! } else { ! safe_str("#-1 NO SIDEFX FOR OBJECT", buff, bp); ! return; ! } } it = match_thing(executor, args[0]); if (!GoodObject(it) || !Can_Examine(executor, it)) { *************** *** 1248,1259 **** safe_str("#-1 PERMISSION DENIED", buff, bp); return; } ! #ifdef FUNCTION_SIDE_EFFECTS ! do_name(executor, args[0], args[1]); ! #else ! safe_str("#-1 FUNCTION DISABLED", buff, bp); ! return; ! #endif } if ((it = match_thing(executor, args[0])) != NOTHING) safe_str(shortname(it), buff, bp); --- 1248,1259 ---- safe_str("#-1 PERMISSION DENIED", buff, bp); return; } ! if (SideFX(executor)) { ! do_name(executor, args[0], args[1]); ! } else { ! safe_str("#-1 NO SIDEFX FOR OBJECT", buff, bp); ! return; ! } } if ((it = match_thing(executor, args[0])) != NOTHING) safe_str(shortname(it), buff, bp); *************** *** 1437,1442 **** --- 1437,1446 ---- FUNCTION(fun_create) { int cost; + if (!SideFX(executor)) { + safe_str("#-1 NO SIDEFX FOR OBJECT", buff, bp); + return; + } if (!command_check_byname(executor, "@create")) { safe_str("#-1 PERMISSION DENIED", buff, bp); *************** *** 1452,1457 **** --- 1456,1466 ---- /* ARGSUSED */ FUNCTION(fun_open) { + if (!SideFX(executor)) { + safe_str("#-1 NO SIDEFX FOR OBJECT", buff, bp); + return; + } + if (!command_check_byname(executor, "@open")) { safe_str("#-1 PERMISSION DENIED", buff, bp); return; *************** *** 1463,1468 **** --- 1472,1482 ---- /* ARGSUSED */ FUNCTION(fun_dig) { + if (!SideFX(executor)) { + safe_str("#-1 NO SIDEFX FOR OBJECT", buff, bp); + return; + } + if (!command_check_byname(executor, "@dig")) { safe_str("#-1 PERMISSION DENIED", buff, bp); return; *************** *** 1473,1478 **** --- 1487,1497 ---- /* ARGSUSED */ FUNCTION(fun_clone) { + if (!SideFX(executor)) { + safe_str("#-1 NO SIDEFX FOR OBJECT", buff, bp); + return; + } + if (!command_check_byname(executor, "@clone")) { safe_str("#-1 PERMISSION DENIED", buff, bp); return; *************** *** 1488,1493 **** --- 1507,1517 ---- /* ARGSUSED */ FUNCTION(fun_link) { + if (!SideFX(executor)) { + safe_str("#-1 NO SIDEFX FOR OBJECT", buff, bp); + return; + } + if (!command_check_byname(executor, "@link")) { safe_str("#-1 PERMISSION DENIED", buff, bp); return; *************** *** 1498,1503 **** --- 1522,1532 ---- /* ARGSUSED */ FUNCTION(fun_set) { + if (!SideFX(executor)) { + safe_str("#-1 NO SIDEFX FOR OBJECT", buff, bp); + return; + } + if (!command_check_byname(executor, "@set")) { safe_str("#-1 PERMISSION DENIED", buff, bp); return; *************** *** 1508,1513 **** --- 1537,1547 ---- /* ARGSUSED */ FUNCTION(fun_wipe) { + if (!SideFX(executor)) { + safe_str("#-1 NO SIDEFX FOR OBJECT", buff, bp); + return; + } + if (!command_check_byname(executor, "@wipe")) { safe_str("#-1 PERMISSION DENIED", buff, bp); return; *************** *** 1523,1528 **** --- 1557,1567 ---- /* ARGSUSED */ FUNCTION(fun_tel) { + if (!SideFX(executor)) { + safe_str("#-1 NO SIDEFX FOR OBJECT", buff, bp); + return; + } + if (!command_check_byname(executor, "@tel")) { safe_str("#-1 PERMISSION DENIED", buff, bp); return; *************** *** 1662,1681 **** ALIST *ptr; int status; ! #ifdef FUNCTION_SIDE_EFFECTS ! if (nargs == 1) ! status = 0; ! else { ! if (!strcasecmp(args[1], "on")) { ! status = 1; ! } else if (!strcasecmp(args[1], "off")) { ! status = 2; ! } else status = 0; } - #else - status = 0; - #endif if (!args[0] || !*args[0]) { safe_str("#-1 ARGUMENT MUST BE OBJ/ATTR", buff, bp); --- 1701,1720 ---- ALIST *ptr; int status; ! if (SideFX(executor)) { ! if (nargs == 1) status = 0; + else { + if (!strcasecmp(args[1], "on")) { + status = 1; + } else if (!strcasecmp(args[1], "off")) { + status = 2; + } else + status = 0; + } + } else { + status = 0; } if (!args[0] || !*args[0]) { safe_str("#-1 ARGUMENT MUST BE OBJ/ATTR", buff, bp); *************** *** 1843,1858 **** } if (nargs == 2) { ! #ifdef FUNCTION_SIDE_EFFECTS ! if (!command_check_byname(executor, "@clock")) { ! safe_str("#-1 PERMISSION DENIED", buff, bp); return; } - do_chan_lock(executor, args[0], args[1], which_lock); - return; - #else - safe_str("#-1 FUNCTION DISABLED", buff, bp); - #endif } if (Chan_Can_Decomp(c, executor)) { --- 1882,1897 ---- } if (nargs == 2) { ! if (SideFX(executor)) { ! if (!command_check_byname(executor, "@clock")) { ! safe_str("#-1 PERMISSION DENIED", buff, bp); ! return; ! } ! do_chan_lock(executor, args[0], args[1], which_lock); return; + } else { + safe_str("#-1 NO SIDEFX FOR OBJECT", buff, bp); } } if (Chan_Can_Decomp(c, executor)) { *** /usr/local/mu/pennmush/hdrs/dbdefs.h Mon Jul 17 10:59:52 2000 --- hdrs/dbdefs.h Fri Aug 4 19:42:00 2000 *************** *** 201,206 **** --- 201,220 ---- #define Verbose(x) (Flags(x) & VERBOSE) #define Visual(x) (Flags(x) & VISUAL) + #ifdef FUNCTION_SIDE_EFFECTS + #ifdef SIDEFX_FLAG + /* Check the flag */ + #define SideFX(x) (Flags(x) & SIDEFX) + #else + /* Side effects always enabled */ + #define SideFX(x) 1 + #endif + #else + /* Side effects always disabled */ + #define SideFX(x) 0 + #endif + + /* Non-mortal checks */ #define God(x) ((x) == GOD) #ifdef ROYALTY_FLAG *** /usr/local/mu/pennmush/hdrs/flags.h Mon Jul 17 10:59:52 2000 --- hdrs/flags.h Sat Aug 5 15:51:59 2000 *************** *** 90,95 **** --- 90,101 ---- * spared once. */ /* -- empty slot 0x80000000 -- */ + #ifdef FUNCTION_SIDE_EFFECTS + #ifdef SIDEFX_FLAG + #define SIDEFX 0x80000000 + #endif + #endif + /*-------------------------------------------------------------------------- * Player flags */ *** /usr/local/mu/pennmush/options.h.dist Tue Jul 18 07:20:51 2000 --- options.h.dist Fri Aug 4 19:23:43 2000 *************** *** 150,155 **** --- 150,161 ---- */ /* #define FUNCTION_SIDE_EFFECTS /* */ + /* This turns on the MUXish SIDEFX flag, which, when it and + * FUNCTION_SIDE_EFFECTS is enabled, allows side effect functions + * *only* on objects with the side effects flag. + */ + /* #define SIDEFX_FLAG /* */ + /* Comment this out if you don't wish to use the built-in mail system. * The @mail command provides a flexible hardcoded mail system, which * uses its own database to store messages.