blob: 7608c73043bde2cedb2464311699f963d53b930d [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001/* These sefuns are to provide a replacement for the efun query_shadowing()
2 * and the old semantics of the efun shadow().
3 * Feel free to add it to your mudlibs, if you have much code relying on that.
4 */
5
6#if ! __EFUN_DEFINED__(query_shadowing)
7
8#include <object_info.h>
9
10object query_shadowing(object ob)
11{
12 return efun::object_info(ob, OI_SHADOW_PREV);
13}
14
15private object _shadow(object ob, int flag)
16{
17 if(flag)
18 {
19 object shadower = efun::previous_object(1);
20 efun::set_this_object(shadower);
21
22 if (efun::shadow(ob))
23 return efun::object_info(shadower, OI_SHADOW_PREV);
24 else
25 return 0;
26 }
27 else
28 return efun::object_info(ob, OI_SHADOW_NEXT);
29}
30#else
31private object _shadow(object ob, int flag)
32{
33 set_this_object(previous_object(1));
34 return efun::shadow(ob, flag);
35}
36#endif
37
38
39public object shadow(object ob, int flag)
40{
41 object res = funcall(#'_shadow,ob, flag);
42 if (flag)
43 "/secure/shadowmaster"->RegisterShadow(previous_object());
44 return res;
45}
46
47private void _unshadow() {
48 set_this_object(previous_object(1));
49 efun::unshadow();
50}
51
52public void unshadow() {
53 funcall(#'_unshadow);
54 "/secure/shadowmaster"->UnregisterShadow(previous_object());
55}