]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/sortlist.qc
Declare more ints as ints
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / sortlist.qc
index 9bf6cc84b2ef81502e9eb67b6a301fd14bac66fd..7093ee07dacb206e860cb7848b13e8fffecdc71f 100644 (file)
@@ -1,11 +1,10 @@
-//.float(entity,entity) sort_cmp;
-.entity sort_next, sort_prev;
+#include "sortlist.qh"
 
 entity Sort_Spawn()
 {
        entity sort;
        sort = spawn();
-       sort.sort_next = NULL;
+       sort.sort_next = world;
        sort.chain = sort;
        return sort;
 }
@@ -15,7 +14,7 @@ entity Sort_New(float(entity,entity) cmp)
        entity sort;
        sort = spawn();
        sort.sort_cmp = cmp;
-       sort.sort_next = NULL;
+       sort.sort_next = world;
        sort.chain = sort;
        return sort;
 }
@@ -58,7 +57,7 @@ void Sort_Reset(entity sort)
 
 float Sort_HasNext(entity sort)
 {
-       return (sort.chain.sort_next != NULL);
+       return (sort.chain.sort_next != world);
 }
 
 entity Sort_Next(entity sort)
@@ -69,7 +68,7 @@ entity Sort_Next(entity sort)
                next = spawn();
                sort.chain.sort_next = next;
                next.sort_prev = sort.chain;
-               next.sort_next = NULL;
+               next.sort_next = world;
        }
        sort.chain = next;
        return next;
@@ -92,25 +91,12 @@ void Sort_Finish(entity sort)
 
 entity Sort_Get(entity sort, float i)
 {
-       for(; sort.sort_next && i > 0; --i)
+       for(0; sort.sort_next && i > 0; --i)
                sort = sort.sort_next;
        return sort;
 }
 */
 
-/**
- * Swap two neighbours in a sortlist.
- * @param a FIRST entity
- * @param b entity after a
- */
-#define SORT_SWAP(a,b)                                                                 \
-       b.sort_prev = a.sort_prev;                                                      \
-       a.sort_next = b.sort_next;                                                      \
-       if(b.sort_next) b.sort_next.sort_prev = a;                      \
-       if(a.sort_prev) a.sort_prev.sort_next = b;                      \
-       a.sort_prev = b;                                                                        \
-       b.sort_next = a
-
 /*
 void Sort_Erase(entity ent)
 {