diff --git a/android/src/io/anuke/mindustry/AndroidLauncher.java b/android/src/io/anuke/mindustry/AndroidLauncher.java index 3f75f746fe..28426c356d 100644 --- a/android/src/io/anuke/mindustry/AndroidLauncher.java +++ b/android/src/io/anuke/mindustry/AndroidLauncher.java @@ -146,7 +146,7 @@ public class AndroidLauncher extends AndroidApplication{ InputStream inStream; if(myFile != null) inStream = new FileInputStream(myFile); else inStream = getContentResolver().openInputStream(uri); - Core.app.post(() -> { + Core.app.post(() -> Core.app.post(() -> { if(save){ //open save System.out.println("Opening save."); FileHandle file = Core.files.local("temp-save." + saveExtension); @@ -172,7 +172,7 @@ public class AndroidLauncher extends AndroidApplication{ ui.editor.beginEditMap(file); }); } - }); + })); } }catch(IOException e){ e.printStackTrace(); diff --git a/core/src/io/anuke/mindustry/ai/Pathfinder.java b/core/src/io/anuke/mindustry/ai/Pathfinder.java index 8700ec6761..ee37db7460 100644 --- a/core/src/io/anuke/mindustry/ai/Pathfinder.java +++ b/core/src/io/anuke/mindustry/ai/Pathfinder.java @@ -5,7 +5,8 @@ import io.anuke.arc.collection.IntArray; import io.anuke.arc.collection.IntQueue; import io.anuke.arc.math.geom.Geometry; import io.anuke.arc.math.geom.Point2; -import io.anuke.arc.util.*; +import io.anuke.arc.util.Structs; +import io.anuke.arc.util.Time; import io.anuke.mindustry.game.EventType.TileChangeEvent; import io.anuke.mindustry.game.EventType.WorldLoadEvent; import io.anuke.mindustry.game.Team; @@ -95,7 +96,7 @@ public class Pathfinder{ */ private void update(Tile tile, Team team){ //make sure team exists - if(paths != null && paths[team.ordinal()] != null && paths[team.ordinal()].weights != null){ + if(paths != null && paths[team.ordinal()] != null && paths[team.ordinal()].weights != null && Structs.inBounds(tile.x, tile.y, paths[team.ordinal()].weights)){ PathData path = paths[team.ordinal()]; if(path.weights[tile.x][tile.y] <= 0.1f){ diff --git a/core/src/io/anuke/mindustry/entities/effect/Puddle.java b/core/src/io/anuke/mindustry/entities/effect/Puddle.java index 4b633ac41d..7a41bff244 100644 --- a/core/src/io/anuke/mindustry/entities/effect/Puddle.java +++ b/core/src/io/anuke/mindustry/entities/effect/Puddle.java @@ -280,7 +280,9 @@ public class Puddle extends SolidEntity implements SaveTrait, Poolable, DrawTrai @Override public void removed(){ - map.remove(tile.pos()); + if(tile != null){ + map.remove(tile.pos()); + } reset(); } diff --git a/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java b/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java index fc32a530d4..595a094097 100644 --- a/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java +++ b/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java @@ -47,9 +47,10 @@ public interface BuilderTrait extends Entity, TeamTrait{ buildQueue().clear(); for(BuildRequest request : removal){ - if(!((request.breaking && world.tile(request.x, request.y).block() == Blocks.air) || - (!request.breaking && (world.tile(request.x, request.y).rotation() == request.rotation || !request.block.rotate) - && world.tile(request.x, request.y).block() == request.block))){ + Tile tile = world.tile(request.x, request.y); + + if(!(tile == null || (request.breaking && tile.block() == Blocks.air) || + (!request.breaking && (tile.rotation() == request.rotation || !request.block.rotate) && tile.block() == request.block))){ buildQueue().addLast(request); } } diff --git a/core/src/io/anuke/mindustry/graphics/MinimapRenderer.java b/core/src/io/anuke/mindustry/graphics/MinimapRenderer.java index 9777f4e833..2c95552f27 100644 --- a/core/src/io/anuke/mindustry/graphics/MinimapRenderer.java +++ b/core/src/io/anuke/mindustry/graphics/MinimapRenderer.java @@ -129,6 +129,7 @@ public class MinimapRenderer implements Disposable{ } private int colorFor(Tile tile){ + if(tile == null) return 0; tile = tile.link(); return MapIO.colorFor(tile.floor(), tile.block(), tile.overlay(), tile.getTeam()); } diff --git a/core/src/io/anuke/mindustry/type/UnitType.java b/core/src/io/anuke/mindustry/type/UnitType.java index 1500fb2738..1f2efb90ba 100644 --- a/core/src/io/anuke/mindustry/type/UnitType.java +++ b/core/src/io/anuke/mindustry/type/UnitType.java @@ -66,11 +66,8 @@ public class UnitType extends UnlockableContent{ weapon.load(); iconRegion = Core.atlas.find("unit-icon-" + name, Core.atlas.find(name)); region = Core.atlas.find(name); - - if(!isFlying){ - legRegion = Core.atlas.find(name + "-leg"); - baseRegion = Core.atlas.find(name + "-base"); - } + legRegion = Core.atlas.find(name + "-leg"); + baseRegion = Core.atlas.find(name + "-base"); } @Override diff --git a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java index 88f7efc40c..dd2f3e1da6 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java @@ -115,7 +115,7 @@ public class HudFragment extends Fragment{ int index = 0; for(Element elem : children){ int fi = index++; - Core.scene.add(elem); + parent.add(elem); elem.visible(() -> { if(fi < 4){ elem.setSize(size); @@ -392,7 +392,7 @@ public class HudFragment extends Fragment{ t.add("$saveload"); }); - blockfrag.build(Core.scene.root); + blockfrag.build(parent); } @Remote(targets = Loc.both, forward = true, called = Loc.both) diff --git a/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java b/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java index bfb760eab0..7d8764fe39 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java @@ -11,7 +11,6 @@ import io.anuke.arc.scene.event.Touchable; import io.anuke.arc.scene.style.TextureRegionDrawable; import io.anuke.arc.scene.ui.*; import io.anuke.arc.scene.ui.layout.Table; -import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.entities.type.TileEntity; import io.anuke.mindustry.game.EventType.UnlockEvent; import io.anuke.mindustry.game.EventType.WorldLoadEvent; @@ -117,7 +116,7 @@ public class PlacementFragment extends Fragment{ public void build(Group parent){ parent.fill(full -> { toggler = full; - full.bottom().right().visible(() -> !state.is(State.menu) && ui.hudfrag.shown()); + full.bottom().right().visible(() -> ui.hudfrag.shown()); full.table(frame -> { InputHandler input = control.input();