blob: 77ec0d002ac367ff8288b0e917c0fa06c1a5b30d [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001// MorgenGrauen MUDlib
2//
3// thing/properties.h -- contains property definitions and prototypes
4//
5// $Id: properties.h,v 3.5 2003/08/07 15:09:33 Rikus Exp $
6
7#ifndef __THING_PROPERTIES_H__
8#define __THING_PROPERTIES_H__
9
Zesstra3f3e7842022-01-16 22:33:03 +010010// Type Flags indexing <prop> and they are used as well for Set() calls
MG Mud User88f12472016-06-24 23:31:02 +020011#define F_VALUE 0
12#define F_MODE 1
13#define F_SET_METHOD 2
14#define F_QUERY_METHOD 3
Zesstra3f3e7842022-01-16 22:33:03 +010015#define F_PROP_ENTRIES 4 // how many entries in <prop> mapping?
Zesstra375df1e2021-04-21 11:09:06 +020016
Zesstraf54f03a2021-12-29 19:55:08 +010017// The following are used as type flags for Set(), but they do not index
18// <prop>, therfore they have a negative sign.
19//
20// F_SET_MAPPER sets F_SET_METHOD, but additionally sets the mode SETMAPPED
21// automatically
22#define F_SET_MAPPER -F_SET_METHOD
Zesstra375df1e2021-04-21 11:09:06 +020023// Flags for Set() to modify/manipulate F_MODE of a property in bit-wise
Zesstra3f3e7842022-01-16 22:33:03 +010024// manner (but are themselves not bitwise of course!).
25#define F_MODE_AS -400
26#define F_MODE_AD -500
MG Mud User88f12472016-06-24 23:31:02 +020027
Zesstra3f3e7842022-01-16 22:33:03 +010028// and from here the mode flags for Properties
MG Mud User88f12472016-06-24 23:31:02 +020029#define SAVE 64
30#define PROTECTED 128 // only this_object() can change the values
31#define SECURED 256 // like PROTECTED, but never resetable
32#define NOSETMETHOD 512 // Keine Set-Methode => Nicht mofifizierbar
Zesstraf54f03a2021-12-29 19:55:08 +010033#define SETMAPPED 0x4000 // Setmethod only maps, not sets
Zesstra375df1e2021-04-21 11:09:06 +020034// Problem with the following: shadows, default methods etc. may change the
35// result at runtime and they do not save that much time (or even at all?)
36// because of the apply cache of the driver. Not used since 1995. But
37// be careful about re-using the values because of ancient (!) savefiles
38#define SETMNOTFOUND 1024 // Keine Set-Methode gefunden. Not used.
39#define QUERYMNOTFOUND 2048 // Keine Query-Methode gefunden. Not used.
40#define QUERYCACHED 4096 // Not used anymore
41#define SETCACHED 8192 // Not used anymore
MG Mud User88f12472016-06-24 23:31:02 +020042
43#endif // __THING_PROPERTIES_H__
44
45#ifdef NEED_PROTOTYPES
46
47#ifndef __THING_PROPERTIES_H_PROTO__
48#define __THING_PROPERTIES_H_PROTO__
49
50// prototypes
51
MG Mud User88f12472016-06-24 23:31:02 +020052// direct property access
Zesstra5c0c4092021-09-08 23:27:54 +020053public mixed Set(string name, mixed Value,
54 int Type = F_VALUE, int drop_priv = extern_call());
55public mixed Query(string name, int Type = F_VALUE);
MG Mud User88f12472016-06-24 23:31:02 +020056
57// filtered property access
Zesstraffcd0fe2021-09-08 23:33:17 +020058public mixed SetProp(string name, mixed Value, int drop_priv = extern_call());
MG Mud User88f12472016-06-24 23:31:02 +020059public mixed QueryProp(string name);
Zesstrafaebc152021-07-06 22:21:47 +020060public mixed AddToProp(string pname,
61 <int|float|string|mixed*|mapping|bytes> add_value);
62public mixed SubFromProp(string pname,
63 <int|float|string|mixed*|mapping|bytes> sub_value);
MG Mud User88f12472016-06-24 23:31:02 +020064
65// global property handling
66public void SetProperties(mapping props);
67public mapping QueryProperties();
68
69// misc/interna
70public mixed *__query_properties();
71public void _set_save_data(mixed data);
72public mixed _get_save_data();
73
74#endif // __THING_PROPERTIES_H_PROTO__
75
76#endif // NEED_PROTOTYPES