blob: be7a6cdd9497deabfc83ce82c5c7ea3c7c01903c [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
Zesstra375df1e2021-04-21 11:09:06 +020010// 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
Zesstra375df1e2021-04-21 11:09:06 +020015
Zesstraf54f03a2021-12-29 19:55:08 +010016// The following are used as type flags for Set(), but they do not index
17// <prop>, therfore they have a negative sign.
18//
19// F_SET_MAPPER sets F_SET_METHOD, but additionally sets the mode SETMAPPED
20// automatically
21#define F_SET_MAPPER -F_SET_METHOD
Zesstra375df1e2021-04-21 11:09:06 +020022// Flags for Set() to modify/manipulate F_MODE of a property in bit-wise
23// manner
MG Mud User88f12472016-06-24 23:31:02 +020024#define F_MODE_AS 4
25#define F_MODE_AD 5
26
Zesstra375df1e2021-04-21 11:09:06 +020027// mode flags for Properties
MG Mud User88f12472016-06-24 23:31:02 +020028#define SAVE 64
29#define PROTECTED 128 // only this_object() can change the values
30#define SECURED 256 // like PROTECTED, but never resetable
31#define NOSETMETHOD 512 // Keine Set-Methode => Nicht mofifizierbar
Zesstraf54f03a2021-12-29 19:55:08 +010032#define SETMAPPED 0x4000 // Setmethod only maps, not sets
Zesstra375df1e2021-04-21 11:09:06 +020033// Problem with the following: shadows, default methods etc. may change the
34// result at runtime and they do not save that much time (or even at all?)
35// because of the apply cache of the driver. Not used since 1995. But
36// be careful about re-using the values because of ancient (!) savefiles
37#define SETMNOTFOUND 1024 // Keine Set-Methode gefunden. Not used.
38#define QUERYMNOTFOUND 2048 // Keine Query-Methode gefunden. Not used.
39#define QUERYCACHED 4096 // Not used anymore
40#define SETCACHED 8192 // Not used anymore
MG Mud User88f12472016-06-24 23:31:02 +020041
42#endif // __THING_PROPERTIES_H__
43
44#ifdef NEED_PROTOTYPES
45
46#ifndef __THING_PROPERTIES_H_PROTO__
47#define __THING_PROPERTIES_H_PROTO__
48
49// prototypes
50
MG Mud User88f12472016-06-24 23:31:02 +020051// direct property access
Zesstra5c0c4092021-09-08 23:27:54 +020052public mixed Set(string name, mixed Value,
53 int Type = F_VALUE, int drop_priv = extern_call());
54public mixed Query(string name, int Type = F_VALUE);
MG Mud User88f12472016-06-24 23:31:02 +020055
56// filtered property access
Zesstraffcd0fe2021-09-08 23:33:17 +020057public mixed SetProp(string name, mixed Value, int drop_priv = extern_call());
MG Mud User88f12472016-06-24 23:31:02 +020058public mixed QueryProp(string name);
Zesstrafaebc152021-07-06 22:21:47 +020059public mixed AddToProp(string pname,
60 <int|float|string|mixed*|mapping|bytes> add_value);
61public mixed SubFromProp(string pname,
62 <int|float|string|mixed*|mapping|bytes> sub_value);
MG Mud User88f12472016-06-24 23:31:02 +020063
64// global property handling
65public void SetProperties(mapping props);
66public mapping QueryProperties();
67
68// misc/interna
69public mixed *__query_properties();
70public void _set_save_data(mixed data);
71public mixed _get_save_data();
72
73#endif // __THING_PROPERTIES_H_PROTO__
74
75#endif // NEED_PROTOTYPES