Ticket #7426: victim_nwho.diff

File victim_nwho.diff, 4.1 KB (added by Sketch, 17 months ago)
Line 
1diff --exclude-from .pennmush_excludes -rc pennmush-1.8.3p4/game/txt/hlp/pennfunc.hlp punnmush-1.8.3p4/game/txt/hlp/pennfunc.hlp
2*** pennmush-1.8.3p4/game/txt/hlp/pennfunc.hlp  2007-07-07 17:45:00.000000000 -0500
3--- punnmush-1.8.3p4/game/txt/hlp/pennfunc.hlp  2007-08-12 14:04:08.000000000 -0500
4***************
5*** 2817,2831 ****
6    object is @created (or @dug, or @opened, or @pcreated, etc.), it
7    will have this dbref.
8 
9- & NMWHO()
10-   nmwho()
11-
12-   This returns a count of all currently connected, non-hidden players.
13-   It's exactly the same as nwho() used by a mortal, and is suitable
14-   for use on privileged global objects who need an unprivileged count
15-   of who's online.
16-
17- See also: nwho(), mwho(), xmwho()
18  & NOR()
19    nor(<boolean>[, ... , <booleanN>])
20 
21--- 2817,2822 ----
22***************
23*** 2894,2906 ****
24    nvthings(<object>) is identical to words(lvthings(<object>))
25 
26  See also: ncon(), nexits(), xthings(), lthings(), lvthings()
27  & NWHO()
28    nwho()
29 
30!   This returns a count of all currently-connected players. When
31    mortals use this function, DARK wizards or royalty are NOT counted.
32 
33! See also: lwho(), nmwho(), xwho()
34  & OBJ()
35    obj(<object>)
36 
37--- 2885,2909 ----
38    nvthings(<object>) is identical to words(lvthings(<object>))
39 
40  See also: ncon(), nexits(), xthings(), lthings(), lvthings()
41+ & NMWHO()
42  & NWHO()
43    nwho()
44+   nwho(<viewer>)
45+   nmwho()
46 
47!   nwho() returns a count of all currently-connected players. When
48    mortals use this function, DARK wizards or royalty are NOT counted.
49 
50!   nmwho() returns a count of all currently connected, non-hidden players.
51!   It's exactly the same as nwho() used by a mortal, and is suitable
52!   for use on privileged global objects that always need an unprivileged
53!   count of who is online.
54!
55!   If nwho() is given an argument, and is used by an object that can see
56!   DARK and Hidden players, nwho() returns the count of online players
57!   based on what <viewer> can see.
58!
59! See also: lwho(), mwho(), xwho(), xmwho()
60  & OBJ()
61    obj(<object>)
62 
63diff --exclude-from .pennmush_excludes -rc pennmush-1.8.3p4/src/bsd.c punnmush-1.8.3p4/src/bsd.c
64*** pennmush-1.8.3p4/src/bsd.c  2007-07-08 00:06:23.000000000 -0500
65--- punnmush-1.8.3p4/src/bsd.c  2007-08-12 13:49:38.000000000 -0500
66***************
67*** 3614,3624 ****
68  FUNCTION(fun_nwho)
69  {
70    DESC *d;
71    int count = 0;
72!   int powered = (*(called_as + 1) != 'M');
73 
74    DESC_ITER_CONN(d) {
75!     if (!Hidden(d) || (powered && Priv_Who(executor))) {
76        count++;
77      }
78    }
79--- 3614,3641 ----
80  FUNCTION(fun_nwho)
81  {
82    DESC *d;
83+   dbref victim;
84    int count = 0;
85!   int powered = ((*(called_as + 1) != 'M') && Priv_Who(executor));
86!
87!   if (nargs && args[0] && *args[0]) {
88!     /* An argument was given. Find the victim and choose the lowest
89!      * perms possible */
90!     if (!powered) {
91!       safe_str(T(e_perm), buff, bp);
92!       return;
93!     }
94!     if ((victim = noisy_match_result(executor, args[0], NOTYPE,
95!                                      MAT_EVERYTHING)) == 0) {
96!       safe_str(T(e_notvis), buff, bp);
97!       return;
98!     }
99!     if (!Priv_Who(victim))
100!       powered = 0;
101!   }
102 
103    DESC_ITER_CONN(d) {
104!     if (!Hidden(d) || powered) {
105        count++;
106      }
107    }
108diff --exclude-from .pennmush_excludes -rc pennmush-1.8.3p4/src/function.c punnmush-1.8.3p4/src/function.c
109*** pennmush-1.8.3p4/src/function.c 2007-07-07 17:45:00.000000000 -0500
110--- punnmush-1.8.3p4/src/function.c 2007-08-12 09:49:43.000000000 -0500
111***************
112*** 563,569 ****
113    {"NVEXITS", fun_dbwalker, 1, 1, FN_REG},
114    {"NVPLAYERS", fun_dbwalker, 1, 1, FN_REG},
115    {"NVTHINGS", fun_dbwalker, 1, 1, FN_REG},
116!   {"NWHO", fun_nwho, 0, 0, FN_REG},
117    {"OBJ", fun_obj, 1, 1, FN_REG},
118    {"OBJEVAL", fun_objeval, 2, -2, FN_NOPARSE},
119    {"OBJID", fun_objid, 1, 1, FN_REG},
120--- 563,569 ----
121    {"NVEXITS", fun_dbwalker, 1, 1, FN_REG},
122    {"NVPLAYERS", fun_dbwalker, 1, 1, FN_REG},
123    {"NVTHINGS", fun_dbwalker, 1, 1, FN_REG},
124!   {"NWHO", fun_nwho, 0, 1, FN_REG},
125    {"OBJ", fun_obj, 1, 1, FN_REG},
126    {"OBJEVAL", fun_objeval, 2, -2, FN_NOPARSE},
127    {"OBJID", fun_objid, 1, 1, FN_REG},