Possible zip crash fix

This commit is contained in:
Anuken
2017-12-20 21:25:30 -05:00
parent 9f8eff27e1
commit ddb7c32491
4 changed files with 22 additions and 22 deletions

View File

@@ -162,8 +162,14 @@ public class UI extends SceneModule{
configtable = new Table();
scene.add(configtable);
editorDialog = new MapEditorDialog(editor);
try {
editorDialog = new MapEditorDialog(editor);
}catch (Exception e){
Timers.run(1f, () -> {
showErrorClose("[orange]Error occurred loading editor![]Are you running from a zip file?\n");
});
}
settingserror = new Dialog("Warning", "dialog");
settingserror.content().add("[crimson]Failed to access local storage.\nSettings will not be saved.");
@@ -179,7 +185,6 @@ public class UI extends SceneModule{
setWrap(true);
}}).width(600f).pad(10f);
gameerror.buttons().addButton("OK", gameerror::hide).size(200f, 50);
//gameerror.setFillParent(true);
discord = new Dialog("Discord", "dialog");
discord.content().pad(12f);
@@ -203,17 +208,6 @@ public class UI extends SceneModule{
prefs.screenshakePref();
prefs.volumePrefs();
//this is incredinbly buggy
/*
prefs.sliderPref("sscale", "UI Scale", 100, 25, 200, i ->{
Unit.dp.multiplier = i / 100f;
fontscale = Unit.dp.inPixels(1f)/2f;
skin.font().getData().setScale(fontscale);
invalidateAll();
return i + "%";
});*/
prefs.checkPref("fps", "Show FPS", false);
prefs.checkPref("noshadows", "Disable shadows", false);
@@ -369,9 +363,15 @@ public class UI extends SceneModule{
new Dialog("[crimson]An error has occured", "dialog"){{
content().pad(15);
content().add(text);
getButtonTable().addButton("OK", ()->{
hide();
}).size(90, 50).pad(4);
getButtonTable().addButton("OK", this::hide).size(90, 50).pad(4);
}}.show();
}
public void showErrorClose(String text){
new Dialog("[crimson]A critical error has occured", "dialog"){{
content().pad(15);
content().add(text);
getButtonTable().addButton("Exit", Gdx.app::exit).size(90, 50).pad(4);
}}.show();
}

View File

@@ -42,10 +42,6 @@ public class SaveDialog extends LoadDialog{
Timers.runTask(5f, () -> {
hide();
Vars.ui.hideLoading();
if(Gdx.files.getLocalStoragePath().equals("C:\\Windows\\System32")){
Vars.ui.showError("[orange]Invalid local storage directory![]\nAre you running the game from inside a zip file?");
return;
}
try{
SaveIO.saveToSlot(slot);
}catch(Throwable e){

View File

@@ -232,7 +232,7 @@ public class Tile{
Block block = block();
Block floor = floor();
return floor.name() + ":" + block.name() +
return floor.name() + ":" + block.name() + "[" + x + "," + y + "] " +
(link != 0 ? " link=[" + (Bits.getLeftByte(link) - 8) + ", " + (Bits.getRightByte(link) - 8) + "]" : "");
}
}

View File

@@ -3,6 +3,7 @@ package io.anuke.mindustry.world.blocks.types.distribution;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.UCore;
import io.anuke.ucore.core.Timers;
public class Junction extends Block{
@@ -22,6 +23,8 @@ public class Junction extends Block{
public void handleItem(Item item, Tile tile, Tile source){
int dir = source.relativeTo(tile.x, tile.y);
Tile to = tile.getNearby()[dir];
UCore.log("handling to " + to + " from " + source + ", tile = " + tile);
Timers.run(15, ()->{
if(to == null || to.entity == null) return;
@@ -35,6 +38,7 @@ public class Junction extends Block{
int dir = source.relativeTo(dest.x, dest.y);
if(dir == -1) return false;
Tile to = dest.getNearby()[dir];
UCore.log("outputting to " + to + " " + to.block().acceptItem(item, to, dest) + " from " + source);
return to != null && to.block().acceptItem(item, to, dest);
}