Fixed #4010
This commit is contained in:
@@ -55,11 +55,12 @@ public class Placement{
|
||||
}
|
||||
|
||||
public static Seq<Point2> upgradeLine(int startX, int startY, int endX, int endY){
|
||||
closed.clear();
|
||||
Pools.freeAll(points);
|
||||
points.clear();
|
||||
var build = world.build(startX, startY);
|
||||
points.add(Pools.obtain(Point2.class, Point2::new).set(startX, startY));
|
||||
while(build instanceof ChainedBuilding chain && (build.tile.x != endX || build.tile.y != endY)){
|
||||
while(build instanceof ChainedBuilding chain && (build.tile.x != endX || build.tile.y != endY) && closed.add(build.id)){
|
||||
if(chain.next() == null) return pathfindLine(true, startX, startY, endX, endY);
|
||||
build = chain.next();
|
||||
points.add(Pools.obtain(Point2.class, Point2::new).set(build.tile.x, build.tile.y));
|
||||
|
||||
Reference in New Issue
Block a user