Fixed pathfinding
This commit is contained in:
@@ -63,7 +63,7 @@ public class Pathfinder implements Runnable{
|
|||||||
|
|
||||||
/** Packs a tile into its internal representation. */
|
/** Packs a tile into its internal representation. */
|
||||||
private int packTile(Tile tile){
|
private int packTile(Tile tile){
|
||||||
return PathTile.get(tile.cost, tile.getTeamID(), (byte)0, (!tile.solid() || tile.breakable()) && tile.floor().drownTime <= 0f);
|
return PathTile.get(tile.cost, tile.getTeamID(), (byte)0, !tile.solid() && tile.floor().drownTime <= 0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Starts or restarts the pathfinding thread. */
|
/** Starts or restarts the pathfinding thread. */
|
||||||
@@ -81,13 +81,18 @@ public class Pathfinder implements Runnable{
|
|||||||
queue.clear();
|
queue.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Update a tile in the internal pathfinding grid. Causes a completely pathfinding reclaculation. */
|
public int debugValue(Team team, int x, int y){
|
||||||
|
if(pathMap[team.ordinal()][PathTarget.enemyCores.ordinal()] == null) return 0;
|
||||||
|
return pathMap[team.ordinal()][PathTarget.enemyCores.ordinal()].weights[x][y];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Update a tile in the internal pathfinding grid. Causes a complete pathfinding reclaculation. */
|
||||||
public void updateTile(Tile tile){
|
public void updateTile(Tile tile){
|
||||||
if(net.client()) return;
|
if(net.client()) return;
|
||||||
|
|
||||||
int packed = packTile(tile);
|
|
||||||
int x = tile.x, y = tile.y;
|
int x = tile.x, y = tile.y;
|
||||||
tiles[x][y] = packed;
|
|
||||||
|
tile.getLinkedTiles(t -> tiles[t.x][t.y] = packTile(t));
|
||||||
|
|
||||||
//can't iterate through array so use the map, which should not lead to problems
|
//can't iterate through array so use the map, which should not lead to problems
|
||||||
for(PathData[] arr : pathMap){
|
for(PathData[] arr : pathMap){
|
||||||
|
|||||||
Reference in New Issue
Block a user