From c86f32c246703895e65698d00e1cb5d46cc9a20a Mon Sep 17 00:00:00 2001
From: Mario <mario@smbclan.net>
Date: Sun, 22 May 2016 09:50:43 +1000
Subject: [PATCH] Clean out self from some of the pathlib code

---
 qcsrc/server/pathlib/expandnode.qc |  2 +-
 qcsrc/server/pathlib/main.qc       |  2 +-
 qcsrc/server/pathlib/pathlib.qh    |  8 ++---
 qcsrc/server/pathlib/utility.qc    | 50 +++++++++++++++---------------
 qcsrc/server/pathlib/utility.qh    |  2 +-
 5 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/qcsrc/server/pathlib/expandnode.qc b/qcsrc/server/pathlib/expandnode.qc
index 972c09c978..700ba41c0e 100644
--- a/qcsrc/server/pathlib/expandnode.qc
+++ b/qcsrc/server/pathlib/expandnode.qc
@@ -102,7 +102,7 @@ float pathlib_expandnode_star(entity node, vector start, vector goal)
     r = PLIB_RIGHT   * pathlib_gridsize;
 
     if (node.pathlib_node_edgeflags == pathlib_node_edgeflag_unknown)
-        node.pathlib_node_edgeflags = tile_check_plus2(node.origin);
+        node.pathlib_node_edgeflags = tile_check_plus2(node, node.origin);
 
     if(node.pathlib_node_edgeflags == pathlib_node_edgeflag_none)
     {
diff --git a/qcsrc/server/pathlib/main.qc b/qcsrc/server/pathlib/main.qc
index d0c70b2b88..20b4d994ae 100644
--- a/qcsrc/server/pathlib/main.qc
+++ b/qcsrc/server/pathlib/main.qc
@@ -155,7 +155,7 @@ float pathlib_makenode_adaptive(entity parent,vector start, vector to, vector go
 
 
     if(doedge)
-        if (!tile_check(where))
+        if (!tile_check(parent, where))
         {
             LOG_TRACE("tile_check fail\n");
 #if DEBUGPATHING
diff --git a/qcsrc/server/pathlib/pathlib.qh b/qcsrc/server/pathlib/pathlib.qh
index 7364440240..c2af5363b0 100644
--- a/qcsrc/server/pathlib/pathlib.qh
+++ b/qcsrc/server/pathlib/pathlib.qh
@@ -63,10 +63,10 @@ entity best_open_node;
 vector tile_check_up;
 vector tile_check_down;
 float  tile_check_size;
-float     tile_check_cross(vector where);
-float     tile_check_plus(vector where);
-float     tile_check_star(vector where);
-var float tile_check(vector where);
+float     tile_check_cross(entity this, vector where);
+float     tile_check_plus(entity this, vector where);
+float     tile_check_star(entity this, vector where);
+var float tile_check(entity this, vector where);
 
 float  movenode_stepsize;
 vector movenode_stepup;
diff --git a/qcsrc/server/pathlib/utility.qc b/qcsrc/server/pathlib/utility.qc
index 9028f85e4f..979b227b20 100644
--- a/qcsrc/server/pathlib/utility.qc
+++ b/qcsrc/server/pathlib/utility.qc
@@ -71,8 +71,8 @@ entity pathlib_nodeatpoint(vector where)
     return world;
 }
 
-float tile_check_cross(vector where)
-{SELFPARAM();
+float tile_check_cross(entity this, vector where)
+{
     vector p,f,r;
 
     f = PLIB_FORWARD * tile_check_size;
@@ -81,33 +81,33 @@ float tile_check_cross(vector where)
 
     // forward-right
     p = where + f + r;
-    traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, self);
+    traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
     if (!location_isok(trace_endpos, 1, 0))
         return 0;
 
     // Forward-left
     p = where + f - r;
-    traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, self);
+    traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
     if (!location_isok(trace_endpos, 1, 0))
         return 0;
 
     // Back-right
     p = where - f + r;
-    traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, self);
+    traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
     if (!location_isok(trace_endpos, 1 ,0))
         return 0;
 
     //Back-left
     p = where - f - r;
-    traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, self);
+    traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
     if (!location_isok(trace_endpos, 1, 0))
         return 0;
 
     return 1;
 }
 
-float tile_check_plus(vector where)
-{SELFPARAM();
+float tile_check_plus(entity this, vector where)
+{
     vector p,f,r;
 
     f = PLIB_FORWARD * tile_check_size;
@@ -115,34 +115,34 @@ float tile_check_plus(vector where)
 
     // forward
     p = where + f;
-    traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,self);
+    traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
     if (!location_isok(trace_endpos,1,0))
         return 0;
 
 
     //left
     p = where - r;
-    traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,self);
+    traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
     if (!location_isok(trace_endpos,1,0))
         return 0;
 
     // Right
     p = where + r;
-    traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,self);
+    traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
     if (!location_isok(trace_endpos,1,0))
         return 0;
 
     //Back
     p = where - f;
-    traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,self);
+    traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
     if (!location_isok(trace_endpos,1,0))
         return 0;
 
     return 1;
 }
 
-float tile_check_plus2(vector where)
-{SELFPARAM();
+float tile_check_plus2(entity this, vector where)
+{
     vector p,f,r;
     float i = 0, e = 0;
 
@@ -156,7 +156,7 @@ float tile_check_plus2(vector where)
 
     // forward
     p = where + f;
-    traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,self);
+    traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
     if (location_isok(trace_endpos,1,0))
     {
        ++i;
@@ -166,7 +166,7 @@ float tile_check_plus2(vector where)
 
     //left
     p = where - r;
-    traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,self);
+    traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
     if (location_isok(trace_endpos,1,0))
     {
        ++i;
@@ -176,7 +176,7 @@ float tile_check_plus2(vector where)
 
     // Right
     p = where + r;
-    traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,self);
+    traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
     if (location_isok(trace_endpos,1,0))
     {
        ++i;
@@ -185,7 +185,7 @@ float tile_check_plus2(vector where)
 
     //Back
     p = where - f;
-    traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,self);
+    traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
     if (location_isok(trace_endpos,1,0))
     {
        ++i;
@@ -194,7 +194,7 @@ float tile_check_plus2(vector where)
 
     // forward-right
     p = where + f + r;
-    traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, self);
+    traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
     if (location_isok(trace_endpos, 1, 0))
     {
        ++i;
@@ -203,7 +203,7 @@ float tile_check_plus2(vector where)
 
     // Forward-left
     p = where + f - r;
-    traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, self);
+    traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
     if (location_isok(trace_endpos, 1, 0))
     {
        ++i;
@@ -212,7 +212,7 @@ float tile_check_plus2(vector where)
 
     // Back-right
     p = where - f + r;
-    traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, self);
+    traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
     if (location_isok(trace_endpos, 1 ,0))
     {
        ++i;
@@ -221,7 +221,7 @@ float tile_check_plus2(vector where)
 
     //Back-left
     p = where - f - r;
-    traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, self);
+    traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
     if (location_isok(trace_endpos, 1, 0))
     {
        ++i;
@@ -235,10 +235,10 @@ float tile_check_plus2(vector where)
     return e;
 }
 
-float tile_check_star(vector where)
+float tile_check_star(entity this, vector where)
 {
-    if(tile_check_plus(where))
-        return tile_check_cross(where);
+    if(tile_check_plus(this, where))
+        return tile_check_cross(this, where);
 
     return 0;
 }
diff --git a/qcsrc/server/pathlib/utility.qh b/qcsrc/server/pathlib/utility.qh
index 3544e86ca2..da4ace73e5 100644
--- a/qcsrc/server/pathlib/utility.qh
+++ b/qcsrc/server/pathlib/utility.qh
@@ -2,4 +2,4 @@
 
 float fsnap(float val,float fsize);
 entity pathlib_nodeatpoint(vector where);
-float tile_check_plus2(vector where);
+float tile_check_plus2(entity this, vector where);
-- 
2.39.5