This commit is contained in:
Anuken
2024-11-25 14:24:49 -05:00
parent 8d9eca570b
commit a17dea0acf
2 changed files with 18 additions and 15 deletions
+4 -2
View File
@@ -343,7 +343,10 @@ public class ControlPathfinder implements Runnable{
} }
public void updateTile(Tile tile){ public void updateTile(Tile tile){
tile.getLinkedTiles(t -> { tile.getLinkedTiles(this::updateSingleTile);
}
public void updateSingleTile(Tile t){
int x = t.x, y = t.y, mx = x % clusterSize, my = y % clusterSize, cx = x / clusterSize, cy = y / clusterSize, cluster = cx + cy * cwidth; int x = t.x, y = t.y, mx = x % clusterSize, my = y % clusterSize, cx = x / clusterSize, cy = y / clusterSize, cluster = cx + cy * cwidth;
//is at the edge of a cluster; this means the portals may have changed. //is at the edge of a cluster; this means the portals may have changed.
@@ -360,7 +363,6 @@ public class ControlPathfinder implements Runnable{
//there is no need to recompute portals for block updates that are not on the edge. //there is no need to recompute portals for block updates that are not on the edge.
queue.post(() -> clustersToInnerUpdate.add(cluster)); queue.post(() -> clustersToInnerUpdate.add(cluster));
} }
});
} }
void queueClusterUpdate(int cx, int cy){ void queueClusterUpdate(int cx, int cy){
+1
View File
@@ -293,6 +293,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
if(build != null){ if(build != null){
build.onProximityUpdate(); build.onProximityUpdate();
} }
pathfinder.updateTile(this);
} }
public boolean isEditorTile(){ public boolean isEditorTile(){