diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index a33590bc35..480b1a2213 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -141,7 +141,7 @@ text.savefail=Failed to save game! text.save.delete.confirm=Are you sure you want to delete this save? text.save.delete=Delete text.save.export=Export Save -text.save.import.invalid=[orange]This save is invalid!\n\nNote that[scarlet]importing saves with custom maps[orange]\nfrom other devices does not work! +text.save.import.invalid=[orange]This save is invalid! text.save.import.fail=[crimson]Failed to import save: [orange]{0} text.save.export.fail=[crimson]Failed to export save: [orange]{0} text.save.import=Import Save diff --git a/core/src/Mindustry.gwt.xml b/core/src/Mindustry.gwt.xml index 7698085253..9f3caa7c8c 100644 --- a/core/src/Mindustry.gwt.xml +++ b/core/src/Mindustry.gwt.xml @@ -4,20 +4,17 @@ - - - - + diff --git a/core/src/io/anuke/mindustry/io/SaveIO.java b/core/src/io/anuke/mindustry/io/SaveIO.java index 4b3add8272..3f5397ce45 100644 --- a/core/src/io/anuke/mindustry/io/SaveIO.java +++ b/core/src/io/anuke/mindustry/io/SaveIO.java @@ -74,7 +74,7 @@ public class SaveIO{ } public static boolean isSaveValid(FileHandle file){ - return isSaveValid(new DataInputStream(file.read())); + return isSaveValid(new DataInputStream(new InflaterInputStream(file.read()))); } public static boolean isSaveValid(DataInputStream stream){ @@ -85,6 +85,7 @@ public class SaveIO{ ver.getData(stream); return true; }catch (Exception e){ + e.printStackTrace(); return false; } } diff --git a/core/src/io/anuke/mindustry/ui/dialogs/FileChooser.java b/core/src/io/anuke/mindustry/ui/dialogs/FileChooser.java index b13324ca66..2e48a60898 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/FileChooser.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/FileChooser.java @@ -145,7 +145,7 @@ public class FileChooser extends FloatingDialog { content.add(icontable).expandX().fillX(); content.row(); - content.center().add(pane).width(UIUtils.portrait() ? Gdx.graphics.getWidth() : Gdx.graphics.getWidth()/Unit.dp.scl(2)).colspan(3).grow(); + content.center().add(pane).width(UIUtils.portrait() ? Gdx.graphics.getWidth()/Unit.dp.scl(1) : Gdx.graphics.getWidth()/Unit.dp.scl(2)).colspan(3).grow(); content.row(); if(!open){ diff --git a/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java b/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java index bd0cf5c971..c1a05d53ff 100644 --- a/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java @@ -107,6 +107,7 @@ public class BuildBlock extends Block { @Override public void drawLayer(Tile tile) { + BuildEntity entity = tile.entity(); Shaders.blockbuild.color = Palette.accent; @@ -174,17 +175,17 @@ public class BuildBlock extends Block { * If there is no recipe for this block, as is the case with rocks, 'previous' is used.*/ public Recipe recipe; - public double progress = 0; - public double lastProgress; - public double buildCost; + public float progress = 0; + public float lastProgress; + public float buildCost; /**The block that used to be here. * If a non-recipe block is being deconstructed, this is the block that is being deconstructed.*/ public Block previous; - private double[] accumulator; + private float[] accumulator; - public void construct(Unit builder, TileEntity core, double amount){ - double maxProgress = checkRequired(core.items, amount); + public void construct(Unit builder, TileEntity core, float amount){ + float maxProgress = checkRequired(core.items, amount); for (int i = 0; i < recipe.requirements.length; i++) { accumulator[i] += recipe.requirements[i].amount*maxProgress; //add min amount progressed to the accumulator @@ -201,7 +202,7 @@ public class BuildBlock extends Block { } } - public void deconstruct(Unit builder, TileEntity core, double amount){ + public void deconstruct(Unit builder, TileEntity core, float amount){ Recipe recipe = Recipe.getByResult(previous); if(recipe != null) { @@ -227,8 +228,8 @@ public class BuildBlock extends Block { } } - private double checkRequired(InventoryModule inventory, double amount){ - double maxProgress = amount; + private float checkRequired(InventoryModule inventory, float amount){ + float maxProgress = amount; for(int i = 0; i < recipe.requirements.length; i ++){ int required = (int)(accumulator[i]); //calculate items that are required now @@ -237,7 +238,7 @@ public class BuildBlock extends Block { //calculate how many items it can actually use int maxUse = Math.min(required, inventory.getItem(recipe.requirements[i].item)); //get this as a fraction - double fraction = maxUse / (double)required; + float fraction = maxUse / (float)required; //move max progress down if this fraction is less than 1 maxProgress = Math.min(maxProgress, maxProgress*fraction); @@ -259,7 +260,7 @@ public class BuildBlock extends Block { public void setConstruct(Block previous, Recipe recipe){ this.recipe = recipe; this.previous = previous; - this.accumulator = new double[recipe.requirements.length]; + this.accumulator = new float[recipe.requirements.length]; this.buildCost = recipe.cost; } @@ -268,7 +269,7 @@ public class BuildBlock extends Block { this.progress = 1f; if(Recipe.getByResult(previous) != null){ this.recipe = Recipe.getByResult(previous); - this.accumulator = new double[Recipe.getByResult(previous).requirements.length]; + this.accumulator = new float[Recipe.getByResult(previous).requirements.length]; this.buildCost = Recipe.getByResult(previous).cost; }else{ this.buildCost = 20f; //default no-recipe build cost is 20 @@ -285,8 +286,8 @@ public class BuildBlock extends Block { stream.writeByte(-1); }else{ stream.writeByte(accumulator.length); - for(double d : accumulator){ - stream.writeFloat((float)d); + for(float d : accumulator){ + stream.writeFloat(d); } } } @@ -299,7 +300,7 @@ public class BuildBlock extends Block { byte acsize = stream.readByte(); if(acsize != -1){ - accumulator = new double[acsize]; + accumulator = new float[acsize]; for (int i = 0; i < acsize; i++) { accumulator[i] = stream.readFloat(); } diff --git a/core/src/io/anuke/mindustry/world/mapgen/WorldGenerator.java b/core/src/io/anuke/mindustry/world/mapgen/WorldGenerator.java index 27b3044e7b..ef546070fb 100644 --- a/core/src/io/anuke/mindustry/world/mapgen/WorldGenerator.java +++ b/core/src/io/anuke/mindustry/world/mapgen/WorldGenerator.java @@ -240,7 +240,7 @@ public class WorldGenerator { prepareTiles(tiles, seed, true); } - static class OreEntry{ + public static class OreEntry{ final float frequency; final Item item; final Simplex noise; diff --git a/desktop/src/io/anuke/mindustry/desktop/CrashHandler.java b/desktop/src/io/anuke/mindustry/desktop/CrashHandler.java index 220400590b..e388752a41 100644 --- a/desktop/src/io/anuke/mindustry/desktop/CrashHandler.java +++ b/desktop/src/io/anuke/mindustry/desktop/CrashHandler.java @@ -1,5 +1,6 @@ package io.anuke.mindustry.desktop; +import io.anuke.mindustry.io.Version; import io.anuke.mindustry.net.Net; import io.anuke.ucore.core.Settings; import io.anuke.ucore.util.Strings; @@ -16,8 +17,12 @@ public class CrashHandler { //TODO send full error report to server via HTTP e.printStackTrace(); + boolean netActive = false, netServer = false; + //attempt to close connections, if applicable try{ + netActive = Net.active(); + netServer = Net.server(); Net.dispose(); }catch (Throwable p){ p.printStackTrace(); @@ -26,15 +31,17 @@ public class CrashHandler { //don't create crash logs for me (anuke), as it's expected if(System.getProperty("user.name").equals("anuke")) return; - String header = ""; + String header = "--CRASH REPORT--\n"; try{ header += "--GAME INFO-- \n"; - header += "Multithreading: " + Settings.getBool("multithread")+ "\n"; - header += "Net Active: " + Net.active()+ "\n"; - header += "Net Server: " + Net.server()+ "\n"; + header += "Build: " + Version.build + "\n"; + header += "Net Active: " + netActive + "\n"; + header += "Net Server: " + netServer + "\n"; header += "OS: " + System.getProperty("os.name")+ "\n----\n"; + header += "Multithreading: " + Settings.getBool("multithread")+ "\n"; }catch (Throwable e4){ + header += "[Error getting additional game info.]\n"; e4.printStackTrace(); }