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 | |
Zesstra | f54f03a | 2021-12-29 19:55:08 +0100 | [diff] [blame^] | 16 | // 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 |
Zesstra | 375df1e | 2021-04-21 11:09:06 +0200 | [diff] [blame] | 22 | // Flags for Set() to modify/manipulate F_MODE of a property in bit-wise |
| 23 | // manner |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 24 | #define F_MODE_AS 4 |
| 25 | #define F_MODE_AD 5 |
| 26 | |
Zesstra | 375df1e | 2021-04-21 11:09:06 +0200 | [diff] [blame] | 27 | // mode flags for Properties |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 28 | #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 |
Zesstra | f54f03a | 2021-12-29 19:55:08 +0100 | [diff] [blame^] | 32 | #define SETMAPPED 0x4000 // Setmethod only maps, not sets |
Zesstra | 375df1e | 2021-04-21 11:09:06 +0200 | [diff] [blame] | 33 | // 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 41 | |
| 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 51 | // direct property access |
Zesstra | 5c0c409 | 2021-09-08 23:27:54 +0200 | [diff] [blame] | 52 | public mixed Set(string name, mixed Value, |
| 53 | int Type = F_VALUE, int drop_priv = extern_call()); |
| 54 | public mixed Query(string name, int Type = F_VALUE); |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 55 | |
| 56 | // filtered property access |
Zesstra | ffcd0fe | 2021-09-08 23:33:17 +0200 | [diff] [blame] | 57 | 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] | 58 | public mixed QueryProp(string name); |
Zesstra | faebc15 | 2021-07-06 22:21:47 +0200 | [diff] [blame] | 59 | public mixed AddToProp(string pname, |
| 60 | <int|float|string|mixed*|mapping|bytes> add_value); |
| 61 | public mixed SubFromProp(string pname, |
| 62 | <int|float|string|mixed*|mapping|bytes> sub_value); |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 63 | |
| 64 | // global property handling |
| 65 | public void SetProperties(mapping props); |
| 66 | public mapping QueryProperties(); |
| 67 | |
| 68 | // misc/interna |
| 69 | public mixed *__query_properties(); |
| 70 | public void _set_save_data(mixed data); |
| 71 | public mixed _get_save_data(); |
| 72 | |
| 73 | #endif // __THING_PROPERTIES_H_PROTO__ |
| 74 | |
| 75 | #endif // NEED_PROTOTYPES |