Skip to content

Commit

Permalink
#23 Keep length of path == 1 if both path ends are the same CP.
Browse files Browse the repository at this point in the history
  • Loading branch information
bytekeeper committed Mar 4, 2018
1 parent c71393a commit c4678ec
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions BWAPI4J/src/main/java/bwem/Graph.java
Original file line number Diff line number Diff line change
Expand Up @@ -776,10 +776,12 @@ private void setDistance(final ChokePoint cpA, final ChokePoint cpB, final int v
private void setPath(final ChokePoint cpA, final ChokePoint cpB, final CPPath pathAB) {
pathsBetweenChokePoints.get(cpA.getIndex().intValue()).set(cpB.getIndex().intValue(), pathAB);

pathsBetweenChokePoints.get(cpB.getIndex().intValue()).get(cpA.getIndex().intValue()).clear();
for (int i = pathAB.size() - 1; i >= 0; --i) {
final ChokePoint cp = pathAB.get(i);
pathsBetweenChokePoints.get(cpB.getIndex().intValue()).get(cpA.getIndex().intValue()).add(cp);
if (cpA != cpB) {
pathsBetweenChokePoints.get(cpB.getIndex().intValue()).get(cpA.getIndex().intValue()).clear();
for (int i = pathAB.size() - 1; i >= 0; --i) {
final ChokePoint cp = pathAB.get(i);
pathsBetweenChokePoints.get(cpB.getIndex().intValue()).get(cpA.getIndex().intValue()).add(cp);
}
}
}

Expand Down

0 comments on commit c4678ec

Please sign in to comment.