mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-20 20:57:59 +07:00
Heuristic fixed
This commit is contained in:
@ -570,7 +570,7 @@ public class HierarchyPathFinder{
|
|||||||
|
|
||||||
//edges for the cluster the node is 'in'
|
//edges for the cluster the node is 'in'
|
||||||
if(innerCons != null){
|
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
|
//edges that this node 'faces' from the other side
|
||||||
@ -581,7 +581,7 @@ public class HierarchyPathFinder{
|
|||||||
int relativeDir = (dir + 2) % 4;
|
int relativeDir = (dir + 2) % 4;
|
||||||
LongSeq outerCons = nextCluster.portalConnections[relativeDir] == null ? null : nextCluster.portalConnections[relativeDir][portal];
|
LongSeq outerCons = nextCluster.portalConnections[relativeDir] == null ? null : nextCluster.portalConnections[relativeDir][portal];
|
||||||
if(outerCons != null){
|
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()});
|
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++){
|
for(int i = 0; i < connections.size; i++){
|
||||||
long con = connections.items[i];
|
long con = connections.items[i];
|
||||||
float cost = IntraEdge.cost(con);
|
float cost = IntraEdge.cost(con);
|
||||||
@ -618,7 +618,7 @@ public class HierarchyPathFinder{
|
|||||||
if(newCost < costs.get(next, Float.POSITIVE_INFINITY)){
|
if(newCost < costs.get(next, Float.POSITIVE_INFINITY)){
|
||||||
costs.put(next, newCost);
|
costs.put(next, newCost);
|
||||||
|
|
||||||
frontier.add(next, newCost + clusterNodeHeuristic(pathCost, current, next));
|
frontier.add(next, newCost + clusterNodeHeuristic(pathCost, next, goal));
|
||||||
cameFrom.put(next, current);
|
cameFrom.put(next, current);
|
||||||
|
|
||||||
//TODO debug
|
//TODO debug
|
||||||
|
Reference in New Issue
Block a user