MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | // 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 | |
Zesstra | 375df1e | 2021-04-21 11:09:06 +0200 | [diff] [blame] | 10 | // Flags indexing <prop> and they are used as well for Set() calls |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 11 | #define F_VALUE 0 |
| 12 | #define F_MODE 1 |
| 13 | #define F_SET_METHOD 2 |
| 14 | #define F_QUERY_METHOD 3 |
Zesstra | 375df1e | 2021-04-21 11:09:06 +0200 | [diff] [blame] | 15 | |
| 16 | // Flags for Set() to modify/manipulate F_MODE of a property in bit-wise |
| 17 | // manner |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 18 | #define F_MODE_AS 4 |
| 19 | #define F_MODE_AD 5 |
| 20 | |
Zesstra | 375df1e | 2021-04-21 11:09:06 +0200 | [diff] [blame] | 21 | // mode flags for Properties |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 22 | #define SAVE 64 |
| 23 | #define PROTECTED 128 // only this_object() can change the values |
| 24 | #define SECURED 256 // like PROTECTED, but never resetable |
| 25 | #define NOSETMETHOD 512 // Keine Set-Methode => Nicht mofifizierbar |
Zesstra | 375df1e | 2021-04-21 11:09:06 +0200 | [diff] [blame] | 26 | // Problem with the following: shadows, default methods etc. may change the |
| 27 | // result at runtime and they do not save that much time (or even at all?) |
| 28 | // because of the apply cache of the driver. Not used since 1995. But |
| 29 | // be careful about re-using the values because of ancient (!) savefiles |
| 30 | #define SETMNOTFOUND 1024 // Keine Set-Methode gefunden. Not used. |
| 31 | #define QUERYMNOTFOUND 2048 // Keine Query-Methode gefunden. Not used. |
| 32 | #define QUERYCACHED 4096 // Not used anymore |
| 33 | #define SETCACHED 8192 // Not used anymore |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 34 | |
| 35 | #endif // __THING_PROPERTIES_H__ |
| 36 | |
| 37 | #ifdef NEED_PROTOTYPES |
| 38 | |
| 39 | #ifndef __THING_PROPERTIES_H_PROTO__ |
| 40 | #define __THING_PROPERTIES_H_PROTO__ |
| 41 | |
| 42 | // prototypes |
| 43 | |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 44 | // direct property access |
Zesstra | 5c0c409 | 2021-09-08 23:27:54 +0200 | [diff] [blame] | 45 | public mixed Set(string name, mixed Value, |
| 46 | int Type = F_VALUE, int drop_priv = extern_call()); |
| 47 | public mixed Query(string name, int Type = F_VALUE); |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 48 | |
| 49 | // filtered property access |
Zesstra | ffcd0fe | 2021-09-08 23:33:17 +0200 | [diff] [blame] | 50 | public mixed SetProp(string name, mixed Value, int drop_priv = extern_call()); |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 51 | public mixed QueryProp(string name); |
Zesstra | faebc15 | 2021-07-06 22:21:47 +0200 | [diff] [blame^] | 52 | public mixed AddToProp(string pname, |
| 53 | <int|float|string|mixed*|mapping|bytes> add_value); |
| 54 | public mixed SubFromProp(string pname, |
| 55 | <int|float|string|mixed*|mapping|bytes> sub_value); |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 56 | |
| 57 | // global property handling |
| 58 | public void SetProperties(mapping props); |
| 59 | public mapping QueryProperties(); |
| 60 | |
| 61 | // misc/interna |
| 62 | public mixed *__query_properties(); |
| 63 | public void _set_save_data(mixed data); |
| 64 | public mixed _get_save_data(); |
| 65 | |
| 66 | #endif // __THING_PROPERTIES_H_PROTO__ |
| 67 | |
| 68 | #endif // NEED_PROTOTYPES |