Author: talvo@talvo.com <talvo@talvo.com@
ba372814-4f39-11de-9ad6-
1127a62b9fcd>
Date: Sun Nov 29 20:40:15 2009 +0000
Issue 41, namelist() now takes an optional obj/attr for error
reporting
Fixes #145
{"NAME", fun_name, 0, 2, FN_REG},
{"NAMEGRAB", fun_namegrab, 2, 3, FN_REG},
{"NAMEGRABALL", fun_namegraball, 2, 3, FN_REG},
- {"NAMELIST", fun_namelist, 1, 1, FN_REG},
+ {"NAMELIST", fun_namelist, 1, 2, FN_REG},
{"NAND", fun_nand, 1, INT_MAX, FN_REG},
{"NATTR", fun_nattr, 1, 1, FN_REG},
{"NCHILDREN", fun_lsearch, 1, 1, FN_REG},
char *current;
dbref target;
const char *start;
+ int report = 0;
+ ufun_attrib ufun;
+ char *wenv[2];
+
+ if (nargs > 1 && args[1] && *args[1]) {
+ if (fetch_ufun_attrib(args[1], executor, &ufun, 1)) {
+ report = 1;
+ } else {
+ safe_str(ufun.errmess, buff, bp);
+ return;
+ }
+ }
start = args[0];
while (start && *start) {
target = lookup_player(current);
if (!GoodObject(target))
target = visible_short_page(executor, current);
- if (target == NOTHING) {
- safe_str("#-1", buff, bp);
- } else if (target == AMBIGUOUS) {
- safe_str("#-2", buff, bp);
- } else {
- safe_dbref(target, buff, bp);
+ safe_dbref(target, buff, bp);
+ if (target == NOTHING || target == AMBIGUOUS) {
+ if (report) {
+ wenv[0] = current;
+ wenv[1] = unparse_dbref(target);
+ if (call_ufun(&ufun, wenv, 2, NULL, executor, enactor, pe_info))
+ report = 0;
+ }
}
}
}