# Patch name: SIDEFX Flag # Patch version: 1 # Author's name: David Cheatham # Author's email: david@mush.cx # Version of PennMUSH: 1.7.3p11 # Date patch made: Sat Dec 16 15:04:31 EST 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 removes the #define SIDE_EFFECT_FUNCTION # silliness, where it's either all or nothing, and lets # you use the SIDEFX flag instead. If, after applying # this patch, you find you don't want side effects at # all, simply disable people setting the flag. *** /home/david/pennmush/pennmush/src/conf.c Wed Dec 6 15:00:30 2000 --- src/conf.c Sat Dec 16 13:31:08 2000 *************** *** 940,946 **** On second thought after writing it, I think having config() set options as well as @config/set is a mistake. */ if (nargs == 2) { /* Set the option */ ! #ifdef FUNCTION_SIDE_EFFECTS if (!Wizard(executor)) { safe_str(T(e_perm), buff, bp); return; --- 940,949 ---- 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(T(e_perm), buff, bp); return; *************** *** 958,967 **** return; } /* Return the new value */ - #else - safe_str(T("#-1 TWO-ARGUMENT FORM OF FUNCTION DISABLED"), buff, bp); - return; - #endif } if (args[0] && *args[0]) { --- 961,966 ---- *************** *** 1061,1072 **** #endif notify(player, T(" Floating point functions are enabled.")); - - #ifdef FUNCTION_SIDE_EFFECTS - notify(player, T(" Side effect functions are enabled.")); - #else - notify(player, T(" Side effect functions are disabled.")); - #endif #ifdef USE_MAILER notify(player, --- 1060,1065 ---- *** /home/david/pennmush/pennmush/src/flags.c Wed Dec 6 15:00:30 2000 --- src/flags.c Sat Dec 16 13:49:49 2000 *************** *** 112,117 **** --- 112,118 ---- #endif {"TRANSPARENT", 't', NOTYPE, TRANSPARENTED, F_ANY, F_ANY}, {"VERBOSE", 'v', NOTYPE, VERBOSE, F_ANY, F_ANY}, + {"SIDEFX", 'i', NOTYPE, SIDEFX, F_INHERIT, F_INHERIT}, {"ANSI", 'A', TYPE_PLAYER, PLAYER_ANSI, F_ANY, F_ANY}, *************** *** 183,188 **** --- 184,196 ---- }; static FLAG_ALIAS flag_alias_tab[] = { + {"SIDE_FX", "SIDEFX"}, + {"SIDE_F", "SIDEFX"}, + {"SIDE_", "SIDEFX"}, + {"SIDEF", "SIDEFX"}, + {"SIDE", "SIDEFX"}, + {"SID", "SIDEFX"}, + {"SI", "SIDEFX"}, {"CHOWN_O", "CHOWN_OK"}, {"CHOWN_", "CHOWN_OK"}, {"CHOWN", "CHOWN_OK"}, *** /home/david/pennmush/pennmush/src/fundb.c Wed Dec 6 15:00:30 2000 --- src/fundb.c Sat Dec 16 13:32:32 2000 *************** *** 950,960 **** safe_str(T(e_perm), buff, bp); return; } ! #ifdef FUNCTION_SIDE_EFFECTS ! do_lock(executor, args[0], args[1], ltype); ! #else ! safe_str(T(e_disabled), buff, bp); ! #endif return; } if ((it != NOTHING) && (ltype != NULL) --- 950,959 ---- safe_str(T(e_perm), buff, bp); return; } ! if (SideFX(executor)) ! do_lock(executor, args[0], args[1], ltype); ! else ! safe_str(T(e_disabled), buff, bp); return; } if ((it != NOTHING) && (ltype != NULL) *************** *** 1101,1112 **** safe_str(T(e_perm), buff, bp); return; } ! #ifdef FUNCTION_SIDE_EFFECTS ! do_chzone(executor, args[0], args[1]); ! #else ! safe_str(T(e_disabled), buff, bp); return; - #endif } it = match_thing(executor, args[0]); if (!GoodObject(it) || !Can_Examine(executor, it)) { --- 1100,1110 ---- safe_str(T(e_perm), buff, bp); return; } ! if (SideFX(executor)) ! do_chzone(executor, args[0], args[1]); ! else ! safe_str(T(e_disabled), buff, bp); return; } it = match_thing(executor, args[0]); if (!GoodObject(it) || !Can_Examine(executor, it)) { *************** *** 1126,1137 **** safe_str(T(e_perm), buff, bp); return; } ! #ifdef FUNCTION_SIDE_EFFECTS ! do_parent(executor, args[0], args[1]); ! #else ! safe_str(T(e_disabled), buff, bp); return; - #endif } it = match_thing(executor, args[0]); if (!GoodObject(it) || !Can_Examine(executor, it)) { --- 1124,1134 ---- safe_str(T(e_perm), buff, bp); return; } ! if (SideFX(executor)) ! do_parent(executor, args[0], args[1]); ! else ! safe_str(T(e_disabled), buff, bp); return; } it = match_thing(executor, args[0]); if (!GoodObject(it) || !Can_Examine(executor, it)) { *************** *** 1244,1255 **** safe_str(T(e_perm), buff, bp); return; } ! #ifdef FUNCTION_SIDE_EFFECTS ! do_name(executor, args[0], args[1]); ! #else ! safe_str(T(e_disabled), buff, bp); return; - #endif } if ((it = match_thing(executor, args[0])) != NOTHING) safe_str(shortname(it), buff, bp); --- 1241,1251 ---- safe_str(T(e_perm), buff, bp); return; } ! if (SideFX(executor)) ! do_name(executor, args[0], args[1]); ! else ! safe_str(T(e_disabled), buff, bp); return; } if ((it = match_thing(executor, args[0])) != NOTHING) safe_str(shortname(it), buff, bp); *************** *** 1423,1430 **** safe_dbref(item, buff, bp); } - #ifdef FUNCTION_SIDE_EFFECTS - /* -------------------------------------------------------------------------- * Creation functions: CREATE, PCREATE, OPEN, DIG */ --- 1419,1424 ---- *************** *** 1433,1438 **** --- 1427,1436 ---- FUNCTION(fun_create) { int cost; + if (!SideFX(executor)) { + safe_str(T(e_disabled), buff, bp); + return; + } if (!command_check_byname(executor, "@create")) { safe_str(T(e_perm), buff, bp); *************** *** 1448,1453 **** --- 1446,1456 ---- /* ARGSUSED */ FUNCTION(fun_pcreate) { + if (!SideFX(executor)) { + safe_str(T(e_disabled), buff, bp); + return; + } + if (!command_check_byname(executor, "@pcreate")) { safe_str(T(e_perm), buff, bp); return; *************** *** 1458,1463 **** --- 1461,1471 ---- /* ARGSUSED */ FUNCTION(fun_open) { + if (!SideFX(executor)) { + safe_str(T(e_disabled), buff, bp); + return; + } + if (!command_check_byname(executor, "@open")) { safe_str(T(e_perm), buff, bp); return; *************** *** 1468,1473 **** --- 1476,1486 ---- /* ARGSUSED */ FUNCTION(fun_dig) { + if (!SideFX(executor)) { + safe_str(T(e_disabled), buff, bp); + return; + } + if (!command_check_byname(executor, "@dig")) { safe_str(T(e_perm), buff, bp); return; *************** *** 1478,1483 **** --- 1491,1501 ---- /* ARGSUSED */ FUNCTION(fun_clone) { + if (!SideFX(executor)) { + safe_str(T(e_disabled), buff, bp); + return; + } + if (!command_check_byname(executor, "@clone")) { safe_str(T(e_perm), buff, bp); return; *************** *** 1493,1498 **** --- 1511,1521 ---- /* ARGSUSED */ FUNCTION(fun_link) { + if (!SideFX(executor)) { + safe_str(T(e_disabled), buff, bp); + return; + } + if (!command_check_byname(executor, "@link")) { safe_str(T(e_perm), buff, bp); return; *************** *** 1503,1508 **** --- 1526,1536 ---- /* ARGSUSED */ FUNCTION(fun_set) { + if (!SideFX(executor)) { + safe_str(T(e_disabled), buff, bp); + return; + } + if (!command_check_byname(executor, "@set")) { safe_str(T(e_perm), buff, bp); return; *************** *** 1513,1518 **** --- 1541,1551 ---- /* ARGSUSED */ FUNCTION(fun_wipe) { + if (!SideFX(executor)) { + safe_str(T(e_disabled), buff, bp); + return; + } + if (!command_check_byname(executor, "@wipe")) { safe_str(T(e_perm), buff, bp); return; *************** *** 1528,1533 **** --- 1561,1571 ---- /* ARGSUSED */ FUNCTION(fun_tel) { + if (!SideFX(executor)) { + safe_str(T(e_disabled), buff, bp); + return; + } + if (!command_check_byname(executor, "@tel")) { safe_str(T(e_perm), buff, bp); return; *************** *** 1536,1599 **** } - #else - - /* ARGSUSED */ - FUNCTION(fun_create) - { - safe_str(T(e_disabled), buff, bp); - } - - /* ARGSUSED */ - FUNCTION(fun_pcreate) - { - safe_str(T(e_disabled), buff, bp); - } - - /* ARGSUSED */ - FUNCTION(fun_open) - { - safe_str(T(e_disabled), buff, bp); - } - - /* ARGSUSED */ - FUNCTION(fun_dig) - { - safe_str(T(e_disabled), buff, bp); - } - - /* ARGSUSED */ - FUNCTION(fun_clone) - { - safe_str(T(e_disabled), buff, bp); - } - - /* ARGSUSED */ - FUNCTION(fun_link) - { - safe_str(T(e_disabled), buff, bp); - } - - /* ARGSUSED */ - FUNCTION(fun_set) - { - safe_str(T(e_disabled), buff, bp); - } - - /* ARGSUSED */ - FUNCTION(fun_wipe) - { - safe_str(T(e_disabled), buff, bp); - } - - /* ARGSUSED */ - FUNCTION(fun_tel) - { - safe_str(T(e_disabled), buff, bp); - } - - #endif /* FUNCTION_SIDE_EFFECTS */ - /* ARGSUSED */ FUNCTION(fun_isdbref) { --- 1574,1579 ---- *************** *** 1673,1692 **** 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(T("#-1 ARGUMENT MUST BE OBJ/ATTR"), buff, bp); --- 1653,1672 ---- 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(T("#-1 ARGUMENT MUST BE OBJ/ATTR"), buff, bp); *************** *** 1860,1875 **** } if (nargs == 2) { ! #ifdef FUNCTION_SIDE_EFFECTS if (!command_check_byname(executor, "@clock")) { safe_str(T(e_perm), buff, bp); return; } do_chan_lock(executor, args[0], args[1], which_lock); return; - #else - safe_str(T(e_disabled), buff, bp); - #endif } if (Chan_Can_Decomp(c, executor)) { --- 1840,1855 ---- } if (nargs == 2) { ! if (!SideFX(executor)) { ! safe_str(T(e_disabled), buff, bp); ! return; ! } if (!command_check_byname(executor, "@clock")) { safe_str(T(e_perm), buff, bp); return; } do_chan_lock(executor, args[0], args[1], which_lock); return; } if (Chan_Can_Decomp(c, executor)) { *** /home/david/pennmush/pennmush/src/funufun.c Wed Dec 6 15:00:30 2000 --- src/funufun.c Sat Dec 16 13:35:34 2000 *************** *** 59,65 **** PT_DEFAULT, pe_info); *s = '\0'; - #ifdef FUNCTION_SIDE_EFFECTS /* The security hole created by function side effects is too great * to allow a see_all player to evaluate functions from someone else's * standpoint. We require control. --- 59,64 ---- *************** *** 67,80 **** if (((obj = match_thing(executor, name)) == NOTHING) || !controls(executor, obj)) obj = executor; - #else - /* In order to evaluate from something else's viewpoint, you - * must control it, or be able to see_all. - */ - if (((obj = match_thing(executor, name)) == NOTHING) - || (!controls(executor, obj) && !See_All(executor))) - obj = executor; - #endif p = args[1]; process_expression(buff, bp, &p, obj, executor, enactor, PE_DEFAULT, --- 66,71 ---- *** /home/david/pennmush/pennmush/hdrs/dbdefs.h Wed Dec 6 15:00:29 2000 --- hdrs/dbdefs.h Sat Dec 16 13:36:00 2000 *************** *** 198,203 **** --- 198,204 ---- #define Unfind(x) (Flags(x) & UNFIND) #define Verbose(x) (Flags(x) & VERBOSE) #define Visual(x) (Flags(x) & VISUAL) + #define SideFX(x) (Flags(x) & SIDEFX) /* Non-mortal checks */ #define God(x) ((x) == GOD) *** /home/david/pennmush/pennmush/hdrs/flags.h Wed Dec 6 15:00:29 2000 --- hdrs/flags.h Sat Dec 16 13:36:13 2000 *************** *** 103,108 **** --- 103,110 ---- * spared once. */ /* -- empty slot 0x80000000 -- */ + #define SIDEFX 0x80000000 + /*-------------------------------------------------------------------------- * Player flags */ *** /home/david/pennmush/pennmush/options.h.dist Tue Dec 12 19:25:46 2000 --- options.h.dist Sat Dec 16 13:36:25 2000 *************** *** 142,155 **** /*------------------------- MUSH Features ----------------------*/ - /* This option is to control whether functions may have side effects - * affecting the db. With it on, the functions create(), open(), - * dig(), link(), and set() exist, corresponding to the @commands of - * the same name. Also, the 2 parameter versions of zone(), parent(), - * and lock() are enabled by this define. - */ - /* #define FUNCTION_SIDE_EFFECTS /* */ - /* 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. --- 142,147 ----