to @command or @function.
noparse Function arguments are not evaluated. Only applies
to @functions.
+ localize %q-registers are saved/restored when evaluating, as if
+ the @function were wrapped in localize().
Commands can also use the 'noplayer' restriction, which stops
player objects from using the command, as well as any generic <flag>
#define FN_LOGNAME 0x1000
/* Log function name and args */
#define FN_LOGARGS 0x2000
-/* Run Function Ulocal Style */
-#define FN_ULOCAL 0x4000
+/* Localize function registers */
+#define FN_LOCALIZE 0x4000
#define FN_NORP 0x8000
#define FN_ONEARG 0x10000
flag = FN_LOGNAME;
} else if (!strcasecmp(restriction, "noparse")) {
flag = FN_NOPARSE;
- } else if(!strcasecmp(restriction, "ulocal")) {
- flag = FN_ULOCAL;
+ } else if (!strcasecmp(restriction, "localize")) {
+ flag = FN_LOCALIZE;
+ } else if (!strcasecmp(restriction, "ulocal")) {
+ flag = FN_LOCALIZE;
}
if (clear)
result &= ~flag;
* god can only be used by god
* noplayer can't be used by players, just objects/rooms/exits
* nosidefx can't be used to do side-effect thingies
+ * localize localize q-registers
* \endverbatim
* \param name name of function to restrict.
* \param restriction name of restriction to apply to function.
first = 0;
}
- if(fp->flags & FN_ULOCAL) {
- safe_str("Ulocal", tbuf, &tp);
- if(first)
- first = 0;
+ if (fp->flags & FN_LOCALIZE) {
+ if (first == 0)
+ safe_strl(", ", 2, tbuf, &tp);
+ safe_str("Localize", tbuf, &tp);
+ first = 0;
}
if (fp->flags & FN_LITERAL) {
int e_len;
int retval = 0;
const char *e_msg;
- dbref local_ooref;
if (!buff || !bp || !str || !*str)
return 0;
safe_str(userfn_tab[fp->where.offset].name, buff, bp);
safe_chr(')', buff, bp);
} else {
- /* Open temporary ooref change exception */
- /* local ooref changing should be safe here.
- * Cause we're going to the global func scope, any
- * previous calling ooref shouldn't effect security here
- */
+ char *preserve[NUMQ];
+ dbref local_ooref;
+ if (fp->flags & FN_LOCALIZE)
+ save_global_regs("@function.save", preserve);
+ /* Temporarily change ooref */
local_ooref = ooref;
ooref = attrib->creator;
- if(fp->flags & FN_ULOCAL) {
- char *preserve[NUMQ];
- save_global_regs("globalufun.save", preserve);
- do_userfn(buff, bp, thing, attrib, nfargs, fargs,
- executor, caller, enactor, pe_info);
- restore_global_regs("globalufun.save", preserve);
- } else {
- do_userfn(buff, bp, thing, attrib, nfargs, fargs, executor, caller, enactor, pe_info);
- }
- /* Go back to normal ooref status */
+ do_userfn(buff, bp, thing, attrib, nfargs, fargs,
+ executor, caller, enactor, pe_info);
ooref = local_ooref;
+ if (fp->flags & FN_LOCALIZE)
+ restore_global_regs("@function.save", preserve);
}
}
pe_info->fun_depth--;