mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-07 01:18:26 +07:00
Heuristic fixed
This commit is contained in:
parent
d6d9a52ef9
commit
a17dcbca5a
@ -570,7 +570,7 @@ public class HierarchyPathFinder{
|
||||
|
||||
//edges for the cluster the node is 'in'
|
||||
if(innerCons != null){
|
||||
checkEdges(pathCost, current, cx, cy, innerCons);
|
||||
checkEdges(pathCost, current, endNodeIndex, cx, cy, innerCons);
|
||||
}
|
||||
|
||||
//edges that this node 'faces' from the other side
|
||||
@ -581,7 +581,7 @@ public class HierarchyPathFinder{
|
||||
int relativeDir = (dir + 2) % 4;
|
||||
LongSeq outerCons = nextCluster.portalConnections[relativeDir] == null ? null : nextCluster.portalConnections[relativeDir][portal];
|
||||
if(outerCons != null){
|
||||
checkEdges(pathCost, current, nextCx, nextCy, outerCons);
|
||||
checkEdges(pathCost, current, endNodeIndex, nextCx, nextCy, outerCons);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -606,7 +606,7 @@ public class HierarchyPathFinder{
|
||||
Fx.debugLine.at(a.x, a.y, 0f, Color.blue.cpy().a(0.1f), new Vec2[]{a.cpy(), b.cpy()});
|
||||
}
|
||||
|
||||
void checkEdges(int pathCost, int current, int cx, int cy, LongSeq connections){
|
||||
void checkEdges(int pathCost, int current, int goal, int cx, int cy, LongSeq connections){
|
||||
for(int i = 0; i < connections.size; i++){
|
||||
long con = connections.items[i];
|
||||
float cost = IntraEdge.cost(con);
|
||||
@ -618,7 +618,7 @@ public class HierarchyPathFinder{
|
||||
if(newCost < costs.get(next, Float.POSITIVE_INFINITY)){
|
||||
costs.put(next, newCost);
|
||||
|
||||
frontier.add(next, newCost + clusterNodeHeuristic(pathCost, current, next));
|
||||
frontier.add(next, newCost + clusterNodeHeuristic(pathCost, next, goal));
|
||||
cameFrom.put(next, current);
|
||||
|
||||
//TODO debug
|
||||
|
Loading…
Reference in New Issue
Block a user