diff --git a/core/src/mindustry/ai/BlockIndexer.java b/core/src/mindustry/ai/BlockIndexer.java index 430630f5d3..272fb6d543 100644 --- a/core/src/mindustry/ai/BlockIndexer.java +++ b/core/src/mindustry/ai/BlockIndexer.java @@ -48,6 +48,7 @@ public class BlockIndexer{ private Seq breturnArray = new Seq<>(Building.class); public BlockIndexer(){ + clearFlags(); Events.on(TilePreChangeEvent.class, event -> { removeIndex(event.tile); @@ -62,11 +63,7 @@ public class BlockIndexer{ flagMap = new TileArray[Team.all.length][BlockFlag.all.length]; activeTeams = new Seq<>(Team.class); - for(int i = 0; i < flagMap.length; i++){ - for(int j = 0; j < BlockFlag.all.length; j++){ - flagMap[i][j] = new TileArray(); - } - } + clearFlags(); allOres.clear(); ores = new IntSeq[content.items().size][][]; @@ -160,6 +157,14 @@ public class BlockIndexer{ return blocksPresent != null && blocksPresent[block.id]; } + private void clearFlags(){ + for(int i = 0; i < flagMap.length; i++){ + for(int j = 0; j < BlockFlag.all.length; j++){ + flagMap[i][j] = new TileArray(); + } + } + } + private TileArray[] getFlagged(Team team){ return flagMap[team.id]; }