mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-03-15 11:20:39 -07:00
Fixed #4010
This commit is contained in:
parent
3db04da20a
commit
bc2c7be45d
1 changed files with 2 additions and 1 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue