From 631b0a7761913732bb79cde8d18ffb4e6725d45e Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 5 Sep 2020 10:14:46 -0400 Subject: [PATCH] Fixed #2491 --- core/src/mindustry/content/Blocks.java | 1 + core/src/mindustry/maps/generators/BasicGenerator.java | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 3f2fc9a70a..c5d9e7d469 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -327,6 +327,7 @@ public class Blocks implements ContentList{ duneRocks = new StaticWall("dunerocks"){{ variants = 2; + ignarock.asFloor().wall = this; }}; sandRocks = new StaticWall("sandrocks"){{ diff --git a/core/src/mindustry/maps/generators/BasicGenerator.java b/core/src/mindustry/maps/generators/BasicGenerator.java index 8c1076e692..542f84cf29 100644 --- a/core/src/mindustry/maps/generators/BasicGenerator.java +++ b/core/src/mindustry/maps/generators/BasicGenerator.java @@ -274,18 +274,20 @@ public abstract class BasicGenerator implements WorldGenerator{ } public void inverseFloodFill(Tile start){ + GridBits used = new GridBits(tiles.width, tiles.height); + IntSeq arr = new IntSeq(); arr.add(start.pos()); while(!arr.isEmpty()){ int i = arr.pop(); int x = Point2.x(i), y = Point2.y(i); - tiles.getn(x, y).data = 2; + used.set(x, y); for(Point2 point : Geometry.d4){ int newx = x + point.x, newy = y + point.y; if(tiles.in(newx, newy)){ Tile child = tiles.getn(newx, newy); - if(child.block() == Blocks.air && child.data != 2){ - child.data = 2; + if(child.block() == Blocks.air && !used.get(child.x, child.y)){ + used.set(child.x, child.y); arr.add(child.pos()); } } @@ -293,7 +295,7 @@ public abstract class BasicGenerator implements WorldGenerator{ } for(Tile tile : tiles){ - if(tile.data != 2 && tile.block() == Blocks.air){ + if(!used.get(tile.x, tile.y) && tile.block() == Blocks.air){ tile.setBlock(tile.floor().wall); } }