-
-/*
-entity pathlib_wpp_goal;
-entity pathlib_wpp_start;
-entity pathlib_waypointpath(entity from, entity to)
-{
- entity path, start, end, open, n, ln;
- float ptime, ftime, ctime;
-
-
- ptime = gettime(GETTIME_REALTIME);
- pathlib_starttime = ptime;
-
- if not(openlist)
- openlist = spawn();
-
- if not(closedlist)
- closedlist = spawn();
-
- pathlib_closed_cnt = 0;
- pathlib_open_cnt = 0;
- pathlib_searched_cnt = 0;
-
- pathlib_foundgoal = FALSE;
-
-
- dprint("pathlib_waypointpath init\n");
-
- // Initialize waypoint grid
- n = findchainentity(owner, waypoint_master);
- while (n)
- {
- n.list = world;
- n.pathlib_node_g = 0;
- n.pathlib_node_f = 0;
- n.pathlib_node_h = 0;
- setmodel(n, "models/runematch/rune.mdl");
- n.effects = EF_LOWPRECISION;
- n.colormod = '1 1 1';
- n.scale = 1;
- }
-
- pathlib_wpp_goal = to;
- pathlib_wpp_start = from;
-
- from.list = closedlist;
- pathlib_wpp_expand(from);
- if(pathlib_open_cnt <= 0)
- {
- dprint("pathlib_waypointpath: Start waypoint not linked! aborting.\n");
- return world;
- }
-
- while(pathlib_open_cnt)
- {
- if((gettime(GETTIME_REALTIME) - pathlib_starttime) > pathlib_maxtime)
- {
- dprint("pathlib_waypointpath: Path took to long to compute!\n");
- return world;
- }
-
- n = findentity(world, list, openlist);
- if not(n)
- {
- dprint("pathlib_waypointpath: No more open nodes, path fail.\n");
- return world;
- }
-
- pathlib_wpp_close(n);
- pathlib_wpp_expand(n);
-
- if(pathlib_foundgoal)
- {
- dprint("Target found. Rebuilding and filtering path...\n");
- // to-do rebuild (follow path_prev from n untill it hits from) and return path.
- n = to;
- do
- {
- n.scale = 3;
- n = n.path_prev;
- }while(n != from);
-
- return world;
- }
- }
-
- return world;
-}
-*/