Possible ArrayIndexOutOfBounds fix
This commit is contained in:
@@ -413,6 +413,7 @@ public class ControlPathfinder implements Runnable{
|
|||||||
|
|
||||||
Cluster[] dim2 = dim1[pathCost];
|
Cluster[] dim2 = dim1[pathCost];
|
||||||
|
|
||||||
|
//TODO: how can index out of bounds happen? || clusterIndex >= dim2.length
|
||||||
if(dim2 == null) return null;
|
if(dim2 == null) return null;
|
||||||
|
|
||||||
return dim2[clusterIndex];
|
return dim2[clusterIndex];
|
||||||
@@ -827,7 +828,7 @@ public class ControlPathfinder implements Runnable{
|
|||||||
if(nextCx >= 0 && nextCy >= 0 && nextCx < cwidth && nextCy < cheight){
|
if(nextCx >= 0 && nextCy >= 0 && nextCx < cwidth && nextCy < cheight){
|
||||||
Cluster nextCluster = getCreateCluster(team, pathCost, nextCx, nextCy);
|
Cluster nextCluster = getCreateCluster(team, pathCost, nextCx, nextCy);
|
||||||
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 || nextCluster.portalConnections[relativeDir].length <= portal ? null : nextCluster.portalConnections[relativeDir][portal];
|
||||||
if(outerCons != null){
|
if(outerCons != null){
|
||||||
checkEdges(request, team, pathCost, current, endNodeIndex, nextCx, nextCy, outerCons);
|
checkEdges(request, team, pathCost, current, endNodeIndex, nextCx, nextCy, outerCons);
|
||||||
}
|
}
|
||||||
@@ -1075,6 +1076,10 @@ public class ControlPathfinder implements Runnable{
|
|||||||
return getPathPosition(unit, destination, destination, out, noResultFound);
|
return getPathPosition(unit, destination, destination, out, noResultFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getPathPosition(Unit unit, Vec2 destination, Vec2 out, @Nullable boolean[] noResultFound){
|
||||||
|
return getPathPosition(unit, destination, destination, out, noResultFound);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getPathPosition(Unit unit, Vec2 destination, Vec2 mainDestination, Vec2 out, @Nullable boolean[] noResultFound){
|
public boolean getPathPosition(Unit unit, Vec2 destination, Vec2 mainDestination, Vec2 out, @Nullable boolean[] noResultFound){
|
||||||
int costId = unit.type.pathCostId;
|
int costId = unit.type.pathCostId;
|
||||||
PathCost cost = idToCost(costId);
|
PathCost cost = idToCost(costId);
|
||||||
|
|||||||
Reference in New Issue
Block a user