7 sort.sort_next = world;
12 entity Sort_New(float(entity,entity) cmp)
17 sort.sort_next = world;
22 void Sort_Remove(entity sort)
27 next = sort.sort_next;
34 void Sort_Add(entity sort, entity ent)
38 next = sort.sort_next;
41 if(!sort.sort_cmp(next, ent))
44 next = next.sort_next;
47 ent.sort_prev = parent;
48 parent.sort_next = ent;
53 void Sort_Reset(entity sort)
58 float Sort_HasNext(entity sort)
60 return (sort.chain.sort_next != world);
63 entity Sort_Next(entity sort)
66 next = sort.chain.sort_next;
69 sort.chain.sort_next = next;
70 next.sort_prev = sort.chain;
71 next.sort_next = world;
77 void Sort_Finish(entity sort)
86 sort = next.sort_next;
87 next.sort_next = sort.sort_next;
92 entity Sort_Get(entity sort, float i)
94 for (; sort.sort_next && i > 0; --i)
95 sort = sort.sort_next;
101 void Sort_Erase(entity ent)
103 ent.sort_prev.sort_next = ent.sort_next;
105 ent.sort_next.sort_prev = ent.sort_prev;
109 void Sort_RemoveOld(entity sort)
112 for(tmp = sort.sort_next; tmp; tmp = tmp.sort_next)
117 Sort_Erase(tmp.sort_next);