mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-11 11:17:11 +07:00
Fixed #2491
This commit is contained in:
parent
12f1ee9537
commit
631b0a7761
@ -327,6 +327,7 @@ public class Blocks implements ContentList{
|
||||
|
||||
duneRocks = new StaticWall("dunerocks"){{
|
||||
variants = 2;
|
||||
ignarock.asFloor().wall = this;
|
||||
}};
|
||||
|
||||
sandRocks = new StaticWall("sandrocks"){{
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user