Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
arraylist.qh
Go to the documentation of this file.
1
#pragma once
2
3
USING
(
ArrayList
,
entity
);
4
.int
al_buf
;
5
.int
al_len
;
6
7
#define AL_NEW(this, n, default, T) MACRO_BEGIN \
8
ArrayList _al = this = new_pure(ArrayList); \
9
_al.al_buf = buf_create(); \
10
for (int i = 0, _n = _al.al_len = n; i < _n; ++i) \
11
{ \
12
const _AL_type__##T() it = default; \
13
AL_set##T(this, i, it); \
14
} \
15
MACRO_END
16
17
#define AL_DELETE(this) MACRO_BEGIN \
18
buf_del(this.al_buf); \
19
delete(this); \
20
this = NULL; \
21
MACRO_END
22
23
#define _AL_type__s() string
24
#define AL_gets(this, idx) bufstr_get(this.al_buf, idx)
25
#define AL_sets(this, idx, val) bufstr_set(this.al_buf, idx, val)
26
27
#ifdef CSQC
28
string
al_ftos
(
float
f) = #26;
29
float
al_stof
(
string
s) = #81;
30
#elifdef SVQC
31
string
al_ftos
(
float
f) = #26;
32
float
al_stof
(
string
s) = #81;
33
#elifdef MENUQC
34
string
al_ftos
(
float
f) = #17;
35
float
al_stof
(
string
s) = #21;
36
#endif
37
38
#define _AL_type__f() float
39
#define AL_getf(this, idx) al_stof(AL_gets(this, idx))
40
#define AL_setf(this, idx, val) AL_sets(this, idx, al_ftos(val))
41
42
#ifdef CSQC
43
int
al_etof
(
entity
e) = #512;
44
entity
al_ftoe
(
int
i) = #459;
45
#elifdef SVQC
46
int
al_etof
(
entity
e) = #512;
47
entity
al_ftoe
(
int
i) = #459;
48
#elifdef MENUQC
49
int
al_etof
(
entity
e) = #79;
50
entity
al_ftoe
(
int
i) = #80;
51
#endif
52
53
#define _AL_type__e() entity
54
#define AL_gete(this, idx) al_ftoe(AL_getf(this, idx))
55
#define AL_sete(this, idx, val) AL_setf(this, idx, al_etof(val))
56
57
#define AL_EACH(this, T, cond, body) MACRO_BEGIN \
58
const noref ArrayList _al = this; \
59
for (int i = 0, n = _al.al_len; i < n; ++i) \
60
{ \
61
const noref _AL_type__##T() it = AL_get##T(_al, i); \
62
if (cond) \
63
LAMBDA(body) \
64
} \
65
MACRO_END
ArrayList
entity ArrayList
Definition
arraylist.qh:3
al_ftos
string al_ftos(float f)
al_etof
int al_etof(entity e)
al_len
int al_len
Definition
arraylist.qh:5
al_buf
int al_buf
Definition
arraylist.qh:4
al_stof
float al_stof(string s)
al_ftoe
entity al_ftoe(int i)
entity
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
USING
#define USING(name, T)
Definition
_all.inc:72
lib
arraylist.qh
Generated on
for Xonotic QuakeC by
1.16.1