X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fpathlib%2Fmain.qc;h=cd586b3cdf93b911a6b85bd52847e587834a5646;hb=845401fd312c66c059aaee1772ac5d79555ab4fc;hp=d89e923bad1d8e8a4117e5ea6fb5447532ad06cb;hpb=40ccca024a37816debf1cf4b327eb894a23ee69d;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/pathlib/main.qc b/qcsrc/server/pathlib/main.qc index d89e923ba..cd586b3cd 100644 --- a/qcsrc/server/pathlib/main.qc +++ b/qcsrc/server/pathlib/main.qc @@ -12,11 +12,11 @@ void pathlib_deletepath(entity start) } //#define PATHLIB_NODEEXPIRE 0.05 -#define PATHLIB_NODEEXPIRE 20 +const float PATHLIB_NODEEXPIRE = 20; void dumpnode(entity n) { - n.is_path_node = FALSE; + n.is_path_node = false; n.think = SUB_Remove; n.nextthink = time; } @@ -28,7 +28,9 @@ entity pathlib_mknode(vector where,entity parent) node = pathlib_nodeatpoint(where); if(node) { + #ifdef TURRET_DEBUG mark_error(where, 60); + #endif return node; } @@ -36,7 +38,7 @@ entity pathlib_mknode(vector where,entity parent) node.think = SUB_Remove; node.nextthink = time + PATHLIB_NODEEXPIRE; - node.is_path_node = TRUE; + node.is_path_node = true; node.owner = openlist; node.path_prev = parent; @@ -56,7 +58,7 @@ entity pathlib_mknode(vector where,entity parent) float pathlib_makenode_adaptive(entity parent,vector start, vector to, vector goal,float cost) { entity node; - float h,g,f,doedge; + float h,g,f,doedge = 0; vector where; ++pathlib_searched_cnt; @@ -108,7 +110,7 @@ float pathlib_makenode_adaptive(entity parent,vector start, vector to, vector go node.path_prev = parent; } - if not (best_open_node) + if (!best_open_node) best_open_node = node; else if(best_open_node.pathlib_node_f > node.pathlib_node_f) best_open_node = node; @@ -119,7 +121,7 @@ float pathlib_makenode_adaptive(entity parent,vector start, vector to, vector go where = pathlib_movenode(parent.origin, to, 0); - if not(pathlib_movenode_goodnode) + if (!pathlib_movenode_goodnode) { //pathlib_showsquare(where, 0 ,30); //pathlib_showsquare(parent.origin, 1 ,30); @@ -139,7 +141,7 @@ float pathlib_makenode_adaptive(entity parent,vector start, vector to, vector go if(doedge) - if not (tile_check(where)) + if (!tile_check(where)) { dprint("tile_check fail\n"); pathlib_showsquare(where, 0 ,30); @@ -155,7 +157,7 @@ float pathlib_makenode_adaptive(entity parent,vector start, vector to, vector go node = findradius(where,pathlib_gridsize * 0.5); while(node) { - if(node.is_path_node == TRUE) + if(node.is_path_node == true) { ++pathlib_merge_cnt; if(node.owner == openlist) @@ -173,7 +175,7 @@ float pathlib_makenode_adaptive(entity parent,vector start, vector to, vector go //} } - if not (best_open_node) + if (!best_open_node) best_open_node = node; else if(best_open_node.pathlib_node_f > node.pathlib_node_f) best_open_node = node; @@ -190,7 +192,7 @@ float pathlib_makenode_adaptive(entity parent,vector start, vector to, vector go node.pathlib_node_g = g; node.pathlib_node_f = f; - if not (best_open_node) + if (!best_open_node) best_open_node = node; else if(best_open_node.pathlib_node_f > node.pathlib_node_f) best_open_node = node; @@ -253,7 +255,7 @@ void pathlib_close_node(entity node,vector goal) if(pathlib_movenode_goodnode) { goal_node = node; - pathlib_foundgoal = TRUE; + pathlib_foundgoal = true; } } } @@ -266,7 +268,7 @@ void pathlib_cleanup() entity node; - node = findfloat(world,is_path_node, TRUE); + node = findfloat(world,is_path_node, true); while(node) { /* @@ -278,7 +280,7 @@ void pathlib_cleanup() */ dumpnode(node); - node = findfloat(node,is_path_node, TRUE); + node = findfloat(node,is_path_node, true); } if(openlist) @@ -327,6 +329,11 @@ float buildpath_nodefilter_moveskip(vector n,vector c,vector p) return 0; } +float buildpath_nodefilter_none(vector n,vector c,vector p) +{ + return 0; +} + entity path_build(entity next, vector where, entity prev, entity start) { entity path; @@ -398,10 +405,10 @@ entity pathlib_astar(vector from,vector to) pathlib_movenode = pathlib_swimnode; } - if not(openlist) + if (!openlist) openlist = spawn(); - if not(closedlist) + if (!closedlist) closedlist = spawn(); pathlib_closed_cnt = 0; @@ -436,12 +443,12 @@ entity pathlib_astar(vector from,vector to) //movenode_maxdrop = '0 0 512'; movenode_boxup = '0 0 72'; - from_x = fsnap(from_x, pathlib_gridsize); - from_y = fsnap(from_y, pathlib_gridsize); + from_x = fsnap(from.x, pathlib_gridsize); + from_y = fsnap(from.y, pathlib_gridsize); //from_z += 32; - to_x = fsnap(to_x, pathlib_gridsize); - to_y = fsnap(to_y, pathlib_gridsize); + to_x = fsnap(to.x, pathlib_gridsize); + to_y = fsnap(to.y, pathlib_gridsize); //to_z += 32; dprint("AStar init\n");