@@ -22,16 +22,12 @@ import com.lambda.graphics.gl.Matrices.buildWorldProjection
2222import com.lambda.graphics.gl.Matrices.withVertexTransform
2323import com.lambda.graphics.renderer.gui.FontRenderer
2424import com.lambda.graphics.renderer.gui.FontRenderer.drawString
25- import com.lambda.module.modules.movement.Pathfinder
2625import com.lambda.pathing.PathingSettings
2726import com.lambda.util.math.Vec2d
28- import com.lambda.util.math.div
2927import com.lambda.util.math.minus
3028import com.lambda.util.math.plus
3129import com.lambda.util.math.times
3230import com.lambda.util.world.FastVector
33- import com.lambda.util.world.add
34- import com.lambda.util.world.fastVectorOf
3531import com.lambda.util.world.string
3632import com.lambda.util.world.toCenterVec3d
3733import kotlin.math.min
@@ -151,30 +147,18 @@ class DStarLite(
151147 */
152148 fun invalidate (u : FastVector ) {
153149 graph.neighbors(u).forEach { v ->
154- graph.invalidated.add(v)
155- updateEdge(u, v, INF )
156- updateEdge(v, u, INF )
157- }
158- graph.invalidated.forEach { v ->
159- val currentConnections = graph.successors(v)
160- val actualConnections = graph.initialize(v)
161- val changedConnections = currentConnections.filter { (succ, cost) -> cost != actualConnections[succ] }
162- val newConnections = actualConnections.filter { (succ, _) -> succ !in currentConnections }
163- val removedConnections = currentConnections.filter { (succ, _) -> succ !in actualConnections }
164- changedConnections.forEach { (succ, cost) ->
165- updateEdge(v, succ, cost)
166- updateEdge(succ, v, cost)
167- }
168- newConnections.forEach { (succ, cost) ->
169- updateEdge(v, succ, cost)
170- updateEdge(succ, v, cost)
150+ val current = graph.successors(v)
151+ val updated = graph.nodeInitializer(v)
152+ val removed = current.filter { (w, _) -> w !in updated }
153+ removed.forEach { (w, _) ->
154+ updateEdge(v, w, INF )
155+ updateEdge(w, v, INF )
171156 }
172- removedConnections .forEach { (succ, _ ) ->
173- updateEdge(v, succ, INF )
174- updateEdge(succ , v, INF )
157+ updated .forEach { (w, c ) ->
158+ updateEdge(v, w, c )
159+ updateEdge(w , v, c )
175160 }
176161 }
177- graph.invalidated.clear()
178162 }
179163
180164 /* *
@@ -194,10 +178,6 @@ class DStarLite(
194178 if (u != goal) setRHS(u, minSuccessorCost(u))
195179 }
196180 updateVertex(u)
197- // if (c == INF) {
198- // graph.removeEdge(u, v)
199- // graph.removeEdge(v, u)
200- // }
201181 }
202182
203183 /* *
0 commit comments