diff --git a/code/defines/procs/AStar.dm b/code/defines/procs/AStar.dm index 663f6449ada..1d6fa5619e2 100644 --- a/code/defines/procs/AStar.dm +++ b/code/defines/procs/AStar.dm @@ -29,15 +29,15 @@ Actual Adjacent procs : ////////////////////// //A* nodes variables -/PathNode +/datum/pathnode var/turf/source //turf associated with the PathNode - var/PathNode/prevNode //link to the parent PathNode + var/datum/pathnode/prevNode //link to the parent PathNode var/f //A* Node weight (f = g + h) var/g //A* movement cost variable var/h //A* heuristic variable var/nt //count the number of Nodes traversed -/PathNode/New(s,p,pg,ph,pnt) +/datum/pathnode/New(s,p,pg,ph,pnt) source = s prevNode = p g = pg @@ -46,7 +46,7 @@ Actual Adjacent procs : source.PNode = src nt = pnt -/PathNode/proc/calc_f() +/datum/pathnode/proc/calc_f() f = g + h ////////////////////// @@ -54,11 +54,11 @@ Actual Adjacent procs : ////////////////////// //the weighting function, used in the A* algorithm -/proc/PathWeightCompare(PathNode/a, PathNode/b) +/proc/PathWeightCompare(datum/pathnode/a, datum/pathnode/b) return a.f - b.f //reversed so that the Heap is a MinHeap rather than a MaxHeap -/proc/HeapPathWeightCompare(PathNode/a, PathNode/b) +/proc/HeapPathWeightCompare(datum/pathnode/a, datum/pathnode/b) return b.f - a.f //wrapper that returns an empty list if A* failed to find a path @@ -85,10 +85,10 @@ Actual Adjacent procs : var/datum/heap/open = new /datum/heap(/proc/HeapPathWeightCompare) //the open list var/list/closed = new() //the closed list var/list/path = null //the returned path, if any - var/PathNode/cur //current processed turf + var/datum/pathnode/cur //current processed turf //initialization - open.Insert(new /PathNode(start,null,0,call(start,dist)(end),0)) + open.Insert(new /datum/pathnode(start,null,0,call(start,dist)(end),0)) //then run the main loop while(!open.IsEmpty() && !path) @@ -125,7 +125,7 @@ Actual Adjacent procs : var/newg = cur.g + call(cur.source,dist)(T) if(!T.PNode) //is not already in open list, so add it - open.Insert(new /PathNode(T,cur,newg,call(T,dist)(end),cur.nt+1)) + open.Insert(new /datum/pathnode(T,cur,newg,call(T,dist)(end),cur.nt+1)) else //is already in open list, check if it's a better way from the current turf if(newg < T.PNode.g) T.PNode.prevNode = cur @@ -137,7 +137,7 @@ Actual Adjacent procs : } //cleaning after us - for(var/PathNode/PN in open.L) + for(var/datum/pathnode/PN in open.L) PN.source.PNode = null for(var/turf/T in closed) T.PNode = null diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 8f8e7fdca9a..7fc000aa06f 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -25,7 +25,7 @@ var/blocks_air = 0 - var/PathNode/PNode = null //associated PathNode in the A* algorithm + var/datum/pathnode/PNode = null //associated PathNode in the A* algorithm flags = 0