MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | /* |
| 2 | * MGtool-1.0 |
| 3 | * File: toollib.h |
| 4 | * Maintainer: Kirk@MorgenGrauen |
| 5 | */ |
| 6 | |
| 7 | /*------------------------------------------*/ |
| 8 | /* the original Xtool is copyrighted by Hyp */ |
| 9 | /*------------------------------------------*/ |
| 10 | |
| 11 | #ifndef __TOOLLIB_H__ |
| 12 | #define __TOOLLIB_H__ 1 |
| 13 | |
| 14 | #ifndef MASTER |
| 15 | #define MASTER __MASTER_OBJECT__ |
| 16 | #endif |
| 17 | |
| 18 | #define is_obj(x) ((x)&&objectp(x)) |
| 19 | |
| 20 | #define is_living(x) (is_obj(x)&&living(x)) |
| 21 | #define is_not_living(x) (is_obj(x)&&!is_living(x)) |
| 22 | #define is_netdead(x) (is_obj(x)&&is_player(x)&&!interactive(x)) |
| 23 | #define is_alive(x) (is_obj(x)&&is_player(x)&&interactive(x)) |
| 24 | #define is_snooped(x) (is_obj(x)&&objectp(query_snoop(x))) |
| 25 | #define is_not_snooped(x) (is_obj(x)&&!is_snooped(x)) |
| 26 | #define is_invis(x) (is_obj(x)&&((x)->QueryProp(P_INVIS)||!(x)->QueryProp(P_SHORT)))) |
| 27 | #define is_not_invis(x) (is_obj(x)&&!is_invis(x)) |
| 28 | |
| 29 | #define pure_file_name(x) (is_obj(x)?old_explode(object_name(x),"#")[0]:0) |
| 30 | #define source_file_name(x) (is_obj(x)?pure_file_name((x))+".c":0) |
| 31 | #define string_replace(x,y,z) implode(explode((x),(y)),(z)) |
| 32 | |
| 33 | int string_compare(string a, string b); |
| 34 | string cap_string(string str); |
| 35 | string short_path(string file); |
| 36 | string long_path(string file); |
| 37 | //string *old_explode(string str, string del); |
| 38 | //string *explode(string str, string del); |
| 39 | string *strip_explode(string str, string del); |
| 40 | string strip_string(string str); |
| 41 | string *long_get_dir(string pat, int all); |
| 42 | string lit_string(string str); |
| 43 | string mixed_to_string(mixed mix, int level); |
| 44 | int is_player(object obj); |
| 45 | int is_not_player(object obj); |
| 46 | int round(float val); |
| 47 | |
| 48 | #endif /* __TOOLLIB_H__ */ |