Crash fixes
This commit is contained in:
@@ -146,7 +146,7 @@ public class AndroidLauncher extends AndroidApplication{
|
|||||||
InputStream inStream;
|
InputStream inStream;
|
||||||
if(myFile != null) inStream = new FileInputStream(myFile);
|
if(myFile != null) inStream = new FileInputStream(myFile);
|
||||||
else inStream = getContentResolver().openInputStream(uri);
|
else inStream = getContentResolver().openInputStream(uri);
|
||||||
Core.app.post(() -> {
|
Core.app.post(() -> Core.app.post(() -> {
|
||||||
if(save){ //open save
|
if(save){ //open save
|
||||||
System.out.println("Opening save.");
|
System.out.println("Opening save.");
|
||||||
FileHandle file = Core.files.local("temp-save." + saveExtension);
|
FileHandle file = Core.files.local("temp-save." + saveExtension);
|
||||||
@@ -172,7 +172,7 @@ public class AndroidLauncher extends AndroidApplication{
|
|||||||
ui.editor.beginEditMap(file);
|
ui.editor.beginEditMap(file);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
}catch(IOException e){
|
}catch(IOException e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import io.anuke.arc.collection.IntArray;
|
|||||||
import io.anuke.arc.collection.IntQueue;
|
import io.anuke.arc.collection.IntQueue;
|
||||||
import io.anuke.arc.math.geom.Geometry;
|
import io.anuke.arc.math.geom.Geometry;
|
||||||
import io.anuke.arc.math.geom.Point2;
|
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.TileChangeEvent;
|
||||||
import io.anuke.mindustry.game.EventType.WorldLoadEvent;
|
import io.anuke.mindustry.game.EventType.WorldLoadEvent;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
@@ -95,7 +96,7 @@ public class Pathfinder{
|
|||||||
*/
|
*/
|
||||||
private void update(Tile tile, Team team){
|
private void update(Tile tile, Team team){
|
||||||
//make sure team exists
|
//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()];
|
PathData path = paths[team.ordinal()];
|
||||||
|
|
||||||
if(path.weights[tile.x][tile.y] <= 0.1f){
|
if(path.weights[tile.x][tile.y] <= 0.1f){
|
||||||
|
|||||||
@@ -280,7 +280,9 @@ public class Puddle extends SolidEntity implements SaveTrait, Poolable, DrawTrai
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removed(){
|
public void removed(){
|
||||||
map.remove(tile.pos());
|
if(tile != null){
|
||||||
|
map.remove(tile.pos());
|
||||||
|
}
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,9 +47,10 @@ public interface BuilderTrait extends Entity, TeamTrait{
|
|||||||
buildQueue().clear();
|
buildQueue().clear();
|
||||||
|
|
||||||
for(BuildRequest request : removal){
|
for(BuildRequest request : removal){
|
||||||
if(!((request.breaking && world.tile(request.x, request.y).block() == Blocks.air) ||
|
Tile tile = world.tile(request.x, request.y);
|
||||||
(!request.breaking && (world.tile(request.x, request.y).rotation() == request.rotation || !request.block.rotate)
|
|
||||||
&& world.tile(request.x, request.y).block() == request.block))){
|
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);
|
buildQueue().addLast(request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ public class MinimapRenderer implements Disposable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int colorFor(Tile tile){
|
private int colorFor(Tile tile){
|
||||||
|
if(tile == null) return 0;
|
||||||
tile = tile.link();
|
tile = tile.link();
|
||||||
return MapIO.colorFor(tile.floor(), tile.block(), tile.overlay(), tile.getTeam());
|
return MapIO.colorFor(tile.floor(), tile.block(), tile.overlay(), tile.getTeam());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,11 +66,8 @@ public class UnitType extends UnlockableContent{
|
|||||||
weapon.load();
|
weapon.load();
|
||||||
iconRegion = Core.atlas.find("unit-icon-" + name, Core.atlas.find(name));
|
iconRegion = Core.atlas.find("unit-icon-" + name, Core.atlas.find(name));
|
||||||
region = Core.atlas.find(name);
|
region = Core.atlas.find(name);
|
||||||
|
legRegion = Core.atlas.find(name + "-leg");
|
||||||
if(!isFlying){
|
baseRegion = Core.atlas.find(name + "-base");
|
||||||
legRegion = Core.atlas.find(name + "-leg");
|
|
||||||
baseRegion = Core.atlas.find(name + "-base");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public class HudFragment extends Fragment{
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
for(Element elem : children){
|
for(Element elem : children){
|
||||||
int fi = index++;
|
int fi = index++;
|
||||||
Core.scene.add(elem);
|
parent.add(elem);
|
||||||
elem.visible(() -> {
|
elem.visible(() -> {
|
||||||
if(fi < 4){
|
if(fi < 4){
|
||||||
elem.setSize(size);
|
elem.setSize(size);
|
||||||
@@ -392,7 +392,7 @@ public class HudFragment extends Fragment{
|
|||||||
t.add("$saveload");
|
t.add("$saveload");
|
||||||
});
|
});
|
||||||
|
|
||||||
blockfrag.build(Core.scene.root);
|
blockfrag.build(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Remote(targets = Loc.both, forward = true, called = Loc.both)
|
@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.style.TextureRegionDrawable;
|
||||||
import io.anuke.arc.scene.ui.*;
|
import io.anuke.arc.scene.ui.*;
|
||||||
import io.anuke.arc.scene.ui.layout.Table;
|
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.entities.type.TileEntity;
|
||||||
import io.anuke.mindustry.game.EventType.UnlockEvent;
|
import io.anuke.mindustry.game.EventType.UnlockEvent;
|
||||||
import io.anuke.mindustry.game.EventType.WorldLoadEvent;
|
import io.anuke.mindustry.game.EventType.WorldLoadEvent;
|
||||||
@@ -117,7 +116,7 @@ public class PlacementFragment extends Fragment{
|
|||||||
public void build(Group parent){
|
public void build(Group parent){
|
||||||
parent.fill(full -> {
|
parent.fill(full -> {
|
||||||
toggler = full;
|
toggler = full;
|
||||||
full.bottom().right().visible(() -> !state.is(State.menu) && ui.hudfrag.shown());
|
full.bottom().right().visible(() -> ui.hudfrag.shown());
|
||||||
|
|
||||||
full.table(frame -> {
|
full.table(frame -> {
|
||||||
InputHandler input = control.input();
|
InputHandler input = control.input();
|
||||||
|
|||||||
Reference in New Issue
Block a user