diff --git a/core/src/io/anuke/mindustry/input/InputHandler.java b/core/src/io/anuke/mindustry/input/InputHandler.java index 5cdbd60574..2ab0fde1b4 100644 --- a/core/src/io/anuke/mindustry/input/InputHandler.java +++ b/core/src/io/anuke/mindustry/input/InputHandler.java @@ -826,26 +826,22 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ Array skip = new Array<>(); for(int i = 1; i < points.size; i++){ - // check with how many powernodes the *next* tile will overlap int overlaps = 0; + Point2 point = points.get(i); + + //check with how many powernodes the *next* tile will overlap for(int j = 0; j < i; j++){ - // skip powernodes we have already crossed off as air - if(skip.contains(points.get(j))) continue; - - Tile next = world.ltile(points.get(i).x, points.get(i).y); - Tile loop = world.ltile(points.get(j).x, points.get(j).y); - - if(((PowerNode)block).overlaps(next, loop)){ + if(!skip.contains(points.get(j)) && ((PowerNode)block).overlaps(world.ltile(point.x, point.y), world.ltile(points.get(j).x, points.get(j).y))){ overlaps++; } } - // if its more than one it can bridge the gap + //if it's more than one, it can bridge the gap if(overlaps > 1){ skip.add(points.get(i-1)); } } - // remove the skipped points outside the each + //remove skipped points points.removeAll(skip); } diff --git a/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java b/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java index c0f45be6ff..2103f4d58e 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java @@ -8,6 +8,7 @@ import io.anuke.arc.graphics.g2d.*; import io.anuke.arc.math.*; import io.anuke.arc.math.geom.*; import io.anuke.arc.util.*; +import io.anuke.arc.util.ArcAnnotate.*; import io.anuke.mindustry.entities.type.*; import io.anuke.mindustry.graphics.*; import io.anuke.mindustry.ui.*; @@ -302,7 +303,8 @@ public class PowerNode extends PowerBlock{ return overlaps(src.drawx(), src.drawy(), other, range); } - public boolean overlaps(Tile src, Tile other){ + public boolean overlaps(@Nullable Tile src, @Nullable Tile other){ + if(src == null || other == null) return true; return overlaps(src.drawx(), src.drawy(), other, laserRange * tilesize); }