Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
sortlist.qc
Go to the documentation of this file.
1
#include "
sortlist.qh
"
2
3
ERASEABLE
4
entity
Sort_Spawn
()
5
{
6
entity
sort =
new_pure
(sortlist);
7
sort.sort_next =
NULL
;
8
sort.chain = sort;
9
return
sort;
10
}
11
/*
12
entity Sort_New(float(entity,entity) cmp)
13
{
14
entity sort = spawn();
15
sort.sort_cmp = cmp;
16
sort.sort_next = NULL;
17
sort.chain = sort;
18
return sort;
19
}
20
21
void Sort_Remove(entity sort)
22
{
23
entity next;
24
while(sort.sort_next)
25
{
26
next = sort.sort_next;
27
remove(sort);
28
sort = next;
29
}
30
remove(sort);
31
}
32
33
void Sort_Add(entity sort, entity ent)
34
{
35
entity next, parent;
36
parent = sort;
37
next = sort.sort_next;
38
while(next)
39
{
40
if(!sort.sort_cmp(next, ent))
41
break;
42
parent = next;
43
next = next.sort_next;
44
}
45
ent.sort_next = next;
46
ent.sort_prev = parent;
47
parent.sort_next = ent;
48
if(next)
49
next.sort_prev = ent;
50
}
51
52
void Sort_Reset(entity sort)
53
{
54
sort.chain = sort;
55
}
56
57
float Sort_HasNext(entity sort)
58
{
59
return (sort.chain.sort_next != NULL);
60
}
61
62
entity Sort_Next(entity sort)
63
{
64
entity next = sort.chain.sort_next;
65
if(!next) {
66
next = spawn();
67
sort.chain.sort_next = next;
68
next.sort_prev = sort.chain;
69
next.sort_next = NULL;
70
}
71
sort.chain = next;
72
return next;
73
}
74
75
void Sort_Finish(entity sort)
76
{
77
entity next = sort.chain;
78
if(!next)
79
return;
80
81
while(next.sort_next)
82
{
83
sort = next.sort_next;
84
next.sort_next = sort.sort_next;
85
remove(sort);
86
}
87
}
88
89
entity Sort_Get(entity sort, float i)
90
{
91
for (; sort.sort_next && i > 0; --i)
92
sort = sort.sort_next;
93
return sort;
94
}
95
*/
96
97
/*
98
void Sort_Erase(entity ent)
99
{
100
ent.sort_prev.sort_next = ent.sort_next;
101
if(ent.sort_next)
102
ent.sort_next.sort_prev = ent.sort_prev;
103
remove(ent);
104
}
105
106
void Sort_RemoveOld(entity sort)
107
{
108
entity tmp;
109
for(tmp = sort.sort_next; tmp; tmp = tmp.sort_next)
110
{
111
if(tmp.frame < time)
112
{
113
tmp = tmp.sort_prev;
114
Sort_Erase(tmp.sort_next);
115
}
116
}
117
}
118
*/
entity
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
ERASEABLE
#define ERASEABLE
Definition
_all.inc:37
new_pure
#define new_pure(class)
purely logical entities (not linked to the area grid)
Definition
oo.qh:67
NULL
#define NULL
Definition
post.qh:14
Sort_Spawn
ERASEABLE entity Sort_Spawn()
Definition
sortlist.qc:4
sortlist.qh
lib
sortlist.qc
Generated on
for Xonotic QuakeC by
1.14.0