]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Clean out more self from the pathlib code
authorMario <mario@smbclan.net>
Sun, 22 May 2016 00:38:08 +0000 (10:38 +1000)
committerMario <mario@smbclan.net>
Sun, 22 May 2016 00:38:08 +0000 (10:38 +1000)
qcsrc/server/pathlib/main.qc
qcsrc/server/pathlib/movenode.qc
qcsrc/server/pathlib/path_waypoint.qc
qcsrc/server/pathlib/pathlib.qh

index 20b4d994ae367f03ea387c1ef0df815a5de4a19d..de63f22ce8e0c4d98a095420f52aed71368ec980 100644 (file)
@@ -133,7 +133,7 @@ float pathlib_makenode_adaptive(entity parent,vector start, vector to, vector go
         return 1;
     }
 
-    where = pathlib_movenode(parent.origin, to, 0);
+    where = pathlib_movenode(parent, parent.origin, to, 0);
 
     if (!pathlib_movenode_goodnode)
     {
@@ -180,7 +180,7 @@ float pathlib_makenode_adaptive(entity parent,vector start, vector to, vector go
             {
                 if(node.pathlib_node_g > g)
                 {
-                    //pathlib_movenode(where,node.origin,0);
+                    //pathlib_movenode(node, where,node.origin,0);
                     //if(pathlib_movenode_goodnode)
                     //{
                         //mark_error(node.origin + '0 0 128',30);
@@ -263,11 +263,11 @@ void pathlib_close_node(entity node,vector goal)
 
     node.owner = closedlist;
 
-    if(vlen(node.origin - goal) <= pathlib_gridsize)
+    if(vdist(node.origin - goal, <=, pathlib_gridsize))
     {
         vector goalmove;
 
-        goalmove = pathlib_walknode(node.origin,goal,1);
+        goalmove = pathlib_walknode(node, node.origin, goal, 1);
         if(pathlib_movenode_goodnode)
         {
             goal_node         = node;
@@ -336,9 +336,9 @@ float buildpath_nodefilter_directional(vector n,vector c,vector p)
     return 0;
 }
 
-float buildpath_nodefilter_moveskip(vector n,vector c,vector p)
+float buildpath_nodefilter_moveskip(entity this, vector n,vector c,vector p)
 {
-    pathlib_walknode(p,n,1);
+    pathlib_walknode(this, p, n, 1);
     if(pathlib_movenode_goodnode)
         return 1;
 
index d1a4e68dff095c1e00019ecb4fbb740c355b936b..decc36d9f8b14fb9ba7337803daef3a3c315fabc 100644 (file)
@@ -5,8 +5,8 @@
 
 .vector        pos1, pos2;
 
-vector pathlib_wateroutnode(vector start,vector end, float doedge)
-{SELFPARAM();
+vector pathlib_wateroutnode(entity this, vector start, vector end, float doedge)
+{
     vector surface;
 
     pathlib_movenode_goodnode = 0;
@@ -14,7 +14,7 @@ vector pathlib_wateroutnode(vector start,vector end, float doedge)
     end.x = fsnap(end.x, pathlib_gridsize);
     end.y = fsnap(end.y, pathlib_gridsize);
 
-    traceline(end + ('0 0 0.25' * pathlib_gridsize),end - ('0 0 1' * pathlib_gridsize),MOVE_WORLDONLY,self);
+    traceline(end + ('0 0 0.25' * pathlib_gridsize),end - ('0 0 1' * pathlib_gridsize),MOVE_WORLDONLY,this);
     end = trace_endpos;
 
     if (!(pointcontents(end - '0 0 1') == CONTENT_SOLID))
@@ -29,7 +29,7 @@ vector pathlib_wateroutnode(vector start,vector end, float doedge)
     if(pointcontents(surface + '0 0 1') != CONTENT_EMPTY)
         return end;
 
-    tracebox(start + '0 0 64', movenode_boxmin,movenode_boxmax, end + '0 0 64', MOVE_WORLDONLY, self);
+    tracebox(start + '0 0 64', movenode_boxmin,movenode_boxmax, end + '0 0 64', MOVE_WORLDONLY, this);
     if(trace_fraction == 1)
         pathlib_movenode_goodnode = 1;
 
@@ -39,8 +39,8 @@ vector pathlib_wateroutnode(vector start,vector end, float doedge)
     return end;
 }
 
-vector pathlib_swimnode(vector start,vector end, float doedge)
-{SELFPARAM();
+vector pathlib_swimnode(entity this, vector start, vector end, float doedge)
+{
     pathlib_movenode_goodnode = 0;
 
     if(pointcontents(start) != CONTENT_WATER)
@@ -50,23 +50,23 @@ vector pathlib_swimnode(vector start,vector end, float doedge)
     end.y = fsnap(end.y, pathlib_gridsize);
 
     if(pointcontents(end) == CONTENT_EMPTY)
-        return pathlib_wateroutnode( start, end, doedge);
+        return pathlib_wateroutnode(this, start, end, doedge);
 
-    tracebox(start, movenode_boxmin,movenode_boxmax, end, MOVE_WORLDONLY, self);
+    tracebox(start, movenode_boxmin,movenode_boxmax, end, MOVE_WORLDONLY, this);
     if(trace_fraction == 1)
         pathlib_movenode_goodnode = 1;
 
     return end;
 }
 
-vector pathlib_flynode(vector start,vector end, float doedge)
-{SELFPARAM();
+vector pathlib_flynode(entity this, vector start, vector end, float doedge)
+{
     pathlib_movenode_goodnode = 0;
 
     end.x = fsnap(end.x, pathlib_gridsize);
     end.y = fsnap(end.y, pathlib_gridsize);
 
-    tracebox(start, movenode_boxmin,movenode_boxmax, end, MOVE_WORLDONLY, self);
+    tracebox(start, movenode_boxmin,movenode_boxmax, end, MOVE_WORLDONLY, this);
     if(trace_fraction == 1)
         pathlib_movenode_goodnode = 1;
 
@@ -75,15 +75,15 @@ vector pathlib_flynode(vector start,vector end, float doedge)
 
 void a_think()
 {SELFPARAM();
-    te_lightning1(self,self.origin, self.pos1);
-    if(self.cnt < time)
-        remove(self);
+    te_lightning1(this,this.origin, this.pos1);
+    if(this.cnt < time)
+        remove(this);
     else
-        self.nextthink = time + 0.2;
+        this.nextthink = time + 0.2;
 }
 
-vector pathlib_walknode(vector start,vector end,float doedge)
-{SELFPARAM();
+vector pathlib_walknode(entity this, vector start, vector end, float doedge)
+{
     vector direction,point,last_point,s,e;
     float steps, distance, i;
 
@@ -97,7 +97,7 @@ vector pathlib_walknode(vector start,vector end,float doedge)
     start.y = fsnap(start.y,pathlib_gridsize);
 
     // Find the floor
-    traceline(start + movenode_stepup, start - movenode_maxdrop, MOVE_WORLDONLY, self);
+    traceline(start + movenode_stepup, start - movenode_maxdrop, MOVE_WORLDONLY, this);
     if(trace_fraction == 1.0)
     {
         entity a;
@@ -127,7 +127,7 @@ vector pathlib_walknode(vector start,vector end,float doedge)
     for(i = 1; i < steps; ++i)
     {
         point = last_point + (direction * movenode_stepsize);
-        traceline(point + movenode_stepup,point - movenode_maxdrop,MOVE_WORLDONLY,self);
+        traceline(point + movenode_stepup,point - movenode_maxdrop,MOVE_WORLDONLY,this);
         if(trace_fraction == 1.0)
             return trace_endpos;
 
@@ -141,13 +141,13 @@ vector pathlib_walknode(vector start,vector end,float doedge)
     //dprint("end_x:  ",ftos(end_x),  "  end_y:  ",ftos(end_y),"\n");
     //dprint("point_x:",ftos(point_x),"  point_y:",ftos(point_y),"\n\n");
 
-    traceline(point + movenode_stepup, point - movenode_maxdrop,MOVE_WORLDONLY,self);
+    traceline(point + movenode_stepup, point - movenode_maxdrop,MOVE_WORLDONLY,this);
     if(trace_fraction == 1.0)
         return trace_endpos;
 
     last_point = trace_endpos;
 
-    tracebox(start + movenode_boxup, movenode_boxmin,movenode_boxmax, last_point + movenode_boxup, MOVE_WORLDONLY, self);
+    tracebox(start + movenode_boxup, movenode_boxmin,movenode_boxmax, last_point + movenode_boxup, MOVE_WORLDONLY, this);
     if(trace_fraction != 1.0)
         return trace_endpos;
 
index 849514c37c8d975a4a7d71378a5ee59a0ce87fc4..655482f346183ffd274366a272d7b5c734e8c9ab 100644 (file)
@@ -239,7 +239,7 @@ void plas_think()
     pathlib_waypointpath_step();
     if(pathlib_foundgoal)
         return;
-    self.nextthink = time + 0.1;
+    this.nextthink = time + 0.1;
 }
 
 void pathlib_waypointpath_autostep()
index c2af5363b070eb782c562a87f171a5ea9a100e9a..a5f36da4a349d0059bfdc7846e98409847951b52 100644 (file)
@@ -76,11 +76,11 @@ vector movenode_boxmax;
 vector movenode_boxmin;
 float  pathlib_movenode_goodnode;
 
-vector     pathlib_wateroutnode(vector start, vector end, float doedge);
-vector     pathlib_swimnode(vector start, vector end, float doedge);
-vector     pathlib_flynode(vector start, vector end, float doedge);
-vector     pathlib_walknode(vector start, vector end, float doedge);
-var vector pathlib_movenode(vector start, vector end, float doedge);
+vector     pathlib_wateroutnode(entity this, vector start, vector end, float doedge);
+vector     pathlib_swimnode(entity this, vector start, vector end, float doedge);
+vector     pathlib_flynode(entity this, vector start, vector end, float doedge);
+vector     pathlib_walknode(entity this, vector start, vector end, float doedge);
+var vector pathlib_movenode(entity this, vector start, vector end, float doedge);
 
 float      pathlib_expandnode_star(entity node, vector start, vector goal);
 float      pathlib_expandnode_box(entity node, vector start, vector goal);