]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/lib/sortlist.qh
Bot waypoints: save symmetry settings into waypoint files on waypoint save and load...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / sortlist.qh
1 #pragma once
2
3 entityclass(Sort);
4 // .float(entity,entity) sort_cmp;
5 class(Sort).entity chain, sort_next, sort_prev;
6
7 entity Sort_Spawn();
8
9 /**
10  * Swap two neighbours in a sortlist.
11  * @param a FIRST entity
12  * @param b entity after a
13  */
14 #define SORT_SWAP(a, b)                                  \
15         b.sort_prev = a.sort_prev;                          \
16         a.sort_next = b.sort_next;                          \
17         if (b.sort_next) b.sort_next.sort_prev = a;          \
18         if (a.sort_prev) a.sort_prev.sort_next = b;          \
19         a.sort_prev = b;                                    \
20         b.sort_next = a