]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/_all.qh
Weapons: store switchweapon as direct weapon reference
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / _all.qh
1 #ifndef SERVER_ALL_H
2 #define SERVER_ALL_H
3
4 int maxclients;
5
6 const string STR_PLAYER = "player";
7 const string STR_SPECTATOR = "spectator";
8 const string STR_OBSERVER = "observer";
9
10 #define IS_PLAYER(v) ((v).classname == STR_PLAYER)
11 #define IS_SPEC(v) ((v).classname == STR_SPECTATOR)
12 #define IS_OBSERVER(v) ((v).classname == STR_OBSERVER)
13
14 #define IS_CLIENT(v) (v.flags & FL_CLIENT)
15 #define IS_BOT_CLIENT(v) (clienttype(v) == CLIENTTYPE_BOT)
16 #define IS_REAL_CLIENT(v) (clienttype(v) == CLIENTTYPE_REAL)
17 #define IS_NOT_A_CLIENT(v) (clienttype(v) == CLIENTTYPE_NOTACLIENT)
18
19 #define IS_MONSTER(v) (v.flags & FL_MONSTER)
20 #define IS_VEHICLE(v) (v.vehicle_flags & VHF_ISVEHICLE)
21 #define IS_TURRET(v) (v.turret_flags & TUR_FLAG_ISTURRET)
22
23 #define FOR_EACH_CLIENTSLOT(v) for (v = world; (v = nextent(v)) && (num_for_edict(v) <= maxclients); )
24 #define FOR_EACH_CLIENT(v) FOR_EACH_CLIENTSLOT(v) if (IS_CLIENT(v))
25 #define FOR_EACH_REALCLIENT(v) FOR_EACH_CLIENT(v) if (IS_REAL_CLIENT(v))
26
27 #define FOR_EACH_PLAYER(v) FOR_EACH_CLIENT(v) if (IS_PLAYER(v))
28 #define FOR_EACH_SPEC(v) FOR_EACH_CLIENT(v) if (IS_SPEC(v))
29 #define FOR_EACH_OBSERVER(v) FOR_EACH_CLIENT(v) if (IS_OBSERVER(v))
30 #define FOR_EACH_REALPLAYER(v) FOR_EACH_REALCLIENT(v) if (IS_PLAYER(v))
31
32 #define FOREACH_CLIENT(cond, body) \
33         MACRO_BEGIN { \
34                 int i = 0; \
35                 for (entity it = NULL; (it = nextent(it)) && (num_for_edict(it) <= maxclients); ++i) \
36                 { \
37                         if (!IS_CLIENT(it)) continue; \
38                         if (cond) { LAMBDA(body) } \
39                 } \
40         } MACRO_END
41
42 #define FOR_EACH_MONSTER(v) for (v = world; (v = findflags(v, flags, FL_MONSTER)) != world; )
43
44 #include "../common/effects/all.qh"
45 #include "../common/models/all.qh"
46 #include "../common/sounds/all.qh"
47
48 #include "autocvars.qh"
49 #include "constants.qh"
50 #include "defs.qh"
51 #include "miscfunctions.qh"
52
53 #endif