Fixed compilation
This commit is contained in:
@@ -27,9 +27,9 @@ public class Pathfinder implements Runnable{
|
||||
/** unordered array of path data for iteration only. DO NOT iterate ot access this in the main thread.*/
|
||||
private Array<PathData> list = new Array<>();
|
||||
/** Maps teams + flags to a valid path to get to that flag for that team. */
|
||||
private PathData[][] pathMap = new PathData[Team.all.length][PathTarget.all.length];
|
||||
private PathData[][] pathMap = new PathData[Team.all().length][PathTarget.all.length];
|
||||
/** Grid map of created path data that should not be queued again. */
|
||||
private GridBits created = new GridBits(Team.all.length, PathTarget.all.length);
|
||||
private GridBits created = new GridBits(Team.all().length, PathTarget.all.length);
|
||||
/** handles task scheduling on the update thread. */
|
||||
private TaskQueue queue = new TaskQueue();
|
||||
/** current pathfinding thread */
|
||||
@@ -42,8 +42,8 @@ public class Pathfinder implements Runnable{
|
||||
|
||||
//reset and update internal tile array
|
||||
tiles = new int[world.width()][world.height()];
|
||||
pathMap = new PathData[Team.all.length][PathTarget.all.length];
|
||||
created = new GridBits(Team.all.length, PathTarget.all.length);
|
||||
pathMap = new PathData[Team.all().length][PathTarget.all.length];
|
||||
created = new GridBits(Team.all().length, PathTarget.all.length);
|
||||
list = new Array<>();
|
||||
|
||||
for(int x = 0; x < world.width(); x++){
|
||||
@@ -84,8 +84,8 @@ public class Pathfinder implements Runnable{
|
||||
}
|
||||
|
||||
public int debugValue(Team team, int x, int y){
|
||||
if(pathMap[(int)team.id][PathTarget.enemyCores.ordinal()] == null) return 0;
|
||||
return pathMap[(int)team.id][PathTarget.enemyCores.ordinal()].weights[x][y];
|
||||
if(pathMap[team.id][PathTarget.enemyCores.ordinal()] == null) return 0;
|
||||
return pathMap[team.id][PathTarget.enemyCores.ordinal()].weights[x][y];
|
||||
}
|
||||
|
||||
/** Update a tile in the internal pathfinding grid. Causes a complete pathfinding reclaculation. */
|
||||
@@ -149,12 +149,12 @@ public class Pathfinder implements Runnable{
|
||||
public Tile getTargetTile(Tile tile, Team team, PathTarget target){
|
||||
if(tile == null) return null;
|
||||
|
||||
PathData data = pathMap[(int)team.id][target.ordinal()];
|
||||
PathData data = pathMap[team.id][target.ordinal()];
|
||||
|
||||
if(data == null){
|
||||
//if this combination is not found, create it on request
|
||||
if(!created.get((int)team.id, target.ordinal())){
|
||||
created.set((int)team.id, target.ordinal());
|
||||
if(!created.get(team.id, target.ordinal())){
|
||||
created.set(team.id, target.ordinal());
|
||||
//grab targets since this is run on main thread
|
||||
IntArray targets = target.getTargets(team, new IntArray());
|
||||
queue.post(() -> createPath(team, target, targets));
|
||||
@@ -188,7 +188,7 @@ public class Pathfinder implements Runnable{
|
||||
/** @return whether a tile can be passed through by this team. Pathfinding thread only.*/
|
||||
private boolean passable(int x, int y, Team team){
|
||||
int tile = tiles[x][y];
|
||||
return PathTile.passable(tile) || (PathTile.team(tile) != (int)team.id && PathTile.team(tile) != (int)Team.derelict.id);
|
||||
return PathTile.passable(tile) || (PathTile.team(tile) != team.id && PathTile.team(tile) != (int)Team.derelict.id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,7 +238,7 @@ public class Pathfinder implements Runnable{
|
||||
PathData path = new PathData(team, target, world.width(), world.height());
|
||||
|
||||
list.add(path);
|
||||
pathMap[(int)team.id][target.ordinal()] = path;
|
||||
pathMap[team.id][target.ordinal()] = path;
|
||||
|
||||
//grab targets from passed array
|
||||
synchronized(path.targets){
|
||||
|
||||
Reference in New Issue
Block a user