PennMUSH Community

Ticket #7644: namelist-arg.patch.txt

File namelist-arg.patch.txt, 3.8 kB (added by Talvo, 4 months ago)

Patch for namelist(<list>[,<obj>/<attr>])

Line 
1 *** src/function.c.orig Fri Oct  5 23:36:32 2007
2 --- src/function.c  Mon Jul 21 20:25:56 2008
3 ***************
4 *** 546,552 ****
5     {"MWHO", fun_lwho, 0, 0, FN_REG},
6     {"MWHOID", fun_lwho, 0, 0, FN_REG},
7     {"NAME", fun_name, 0, 2, FN_REG},
8 !   {"NAMELIST", fun_namelist, 1, 1, FN_REG},
9     {"NAMEGRAB", fun_namegrab, 2, 3, FN_REG},
10     {"NAMEGRABALL", fun_namegraball, 2, 3, FN_REG},
11     {"NAND", fun_nand, 1, INT_MAX, FN_REG},
12 --- 546,552 ----
13     {"MWHO", fun_lwho, 0, 0, FN_REG},
14     {"MWHOID", fun_lwho, 0, 0, FN_REG},
15     {"NAME", fun_name, 0, 2, FN_REG},
16 !   {"NAMELIST", fun_namelist, 1, 2, FN_REG},
17     {"NAMEGRAB", fun_namegrab, 2, 3, FN_REG},
18     {"NAMEGRABALL", fun_namegraball, 2, 3, FN_REG},
19     {"NAND", fun_nand, 1, INT_MAX, FN_REG},
20 *** src/fundb.c.orig    Mon Jul  9 04:50:12 2007
21 --- src/fundb.c Mon Jul 21 20:25:56 2008
22 ***************
23 *** 1774,1779 ****
24 --- 1774,1791 ----
25     char *current;
26     dbref target;
27     const char *start;
28 +   int report = 0;
29 +   ufun_attrib ufun;
30 +   char *wenv[2];
31 +
32 +   if (nargs > 1 && args[1] && *args[1]) {
33 +     if (fetch_ufun_attrib(args[1], executor, &ufun, 1)) {
34 +       report = 1;
35 +     } else {
36 +       safe_str(ufun.errmess, buff, bp);
37 +       return;
38 +     }
39 +   }
40  
41     start = args[0];
42     while (start && *start) {
43 ***************
44 *** 1788,1795 ****
45 --- 1800,1819 ----
46         target = visible_short_page(executor, current);
47       if (target == NOTHING) {
48         safe_str("#-1", buff, bp);
49 +       if (report) {
50 +         wenv[0] = current;
51 +         wenv[1] = "#-1";
52 +         if (call_ufun(&ufun, wenv, 2, NULL, executor, enactor, pe_info))
53 +           report = 0;
54 +       }
55       } else if (target == AMBIGUOUS) {
56         safe_str("#-2", buff, bp);
57 +       if (report) {
58 +         wenv[0] = current;
59 +         wenv[1] = "#-2";
60 +         if (call_ufun(&ufun, wenv, 2, NULL, executor, enactor, pe_info))
61 +           report = 0;
62 +       }
63       } else {
64         safe_dbref(target, buff, bp);
65       }
66 *** game/txt/hlp/pennfunc.hlp.orig  Fri Oct  5 23:36:32 2007
67 --- game/txt/hlp/pennfunc.hlp   Mon Jul 21 20:44:31 2008
68 ***************
69 *** 2754,2767 ****
70  
71     Related functions: FULLNAME(), ACCNAME(), INAME()
72   & NAMELIST()
73 !   namelist(<player-list>)
74  
75 !   Namelist takes a list of players of the form used by the page
76     command and returns a corresponding list of dbrefs.
77 !
78 !   >"[namelist(#1 Javelin "ringo spar" bogus)]
79     You say, "#1 #7 #56 #-1"
80  
81   & NAMEGRAB()
82   & NAMEGRABALL()
83     namegrab(<dbref list>, <name>)
84 --- 2754,2775 ----
85  
86     Related functions: FULLNAME(), ACCNAME(), INAME()
87   & NAMELIST()
88 !   namelist(<player-list>[,[<object>/]<attribute>])
89  
90 !   namelist() takes a list of players of the form used by the page
91     command and returns a corresponding list of dbrefs.
92 !   
93 !   If an <object>/<attribute> is given, the attribute will be called for
94 !   each invalid name, with the name as %0 and the returned dbref (#-1
95 !   for an unmatched name, #-2 for an ambiguous one) as %1.
96 !
97 !   >&foo me=pemit(%#,switch(%1,#-1,Bad,#-2,Ambiguous) name '%0')
98 !   >"[namelist(#1 Javelin "ringo spar" bogus,me/foo)]
99 !   Bad name 'bogus'
100     You say, "#1 #7 #56 #-1"
101  
102 +   See also: anonymous attributes
103 +
104   & NAMEGRAB()
105   & NAMEGRABALL()
106     namegrab(<dbref list>, <name>)
107 *** game/txt/hlp/penntop.hlp.orig   Mon Jul  9 04:50:12 2007
108 --- game/txt/hlp/penntop.hlp    Mon Jul 21 20:35:48 2008
109 ***************
110 *** 228,234 ****
111     The following functions support anonymous attributes:
112    
113     filter()    filterbool()   fold()      foreach()   map()      mapsql()
114 !   mix()       munge()        sortby()    sortkey()   step()
115   & ATTRIB-OWNERSHIP
116     ATTRIBUTE OWNERSHIP
117    
118 --- 228,234 ----
119     The following functions support anonymous attributes:
120    
121     filter()    filterbool()   fold()      foreach()   map()      mapsql()
122 !   mix()       munge()        namelist()  sortby()    sortkey()   step()
123   & ATTRIB-OWNERSHIP
124     ATTRIBUTE OWNERSHIP
125