blob: 69e82641c3d132aeae9f238cbdbff91f46c18f90 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001/*
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
33int string_compare(string a, string b);
34string cap_string(string str);
35string short_path(string file);
36string long_path(string file);
37//string *old_explode(string str, string del);
38//string *explode(string str, string del);
39string *strip_explode(string str, string del);
40string strip_string(string str);
41string *long_get_dir(string pat, int all);
42string lit_string(string str);
43string mixed_to_string(mixed mix, int level);
44int is_player(object obj);
45int is_not_player(object obj);
46int round(float val);
47
48#endif /* __TOOLLIB_H__ */