mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-06 07:30:35 +07:00
Crash fixes
This commit is contained in:
parent
79ab2d122d
commit
bb398a2f1e
@ -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();
|
||||
|
@ -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){
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user