Possible zip crash fix
This commit is contained in:
@@ -163,7 +163,13 @@ public class UI extends SceneModule{
|
|||||||
configtable = new Table();
|
configtable = new Table();
|
||||||
scene.add(configtable);
|
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 = new Dialog("Warning", "dialog");
|
||||||
settingserror.content().add("[crimson]Failed to access local storage.\nSettings will not be saved.");
|
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);
|
setWrap(true);
|
||||||
}}).width(600f).pad(10f);
|
}}).width(600f).pad(10f);
|
||||||
gameerror.buttons().addButton("OK", gameerror::hide).size(200f, 50);
|
gameerror.buttons().addButton("OK", gameerror::hide).size(200f, 50);
|
||||||
//gameerror.setFillParent(true);
|
|
||||||
|
|
||||||
discord = new Dialog("Discord", "dialog");
|
discord = new Dialog("Discord", "dialog");
|
||||||
discord.content().pad(12f);
|
discord.content().pad(12f);
|
||||||
@@ -203,17 +208,6 @@ public class UI extends SceneModule{
|
|||||||
|
|
||||||
prefs.screenshakePref();
|
prefs.screenshakePref();
|
||||||
prefs.volumePrefs();
|
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("fps", "Show FPS", false);
|
||||||
prefs.checkPref("noshadows", "Disable shadows", false);
|
prefs.checkPref("noshadows", "Disable shadows", false);
|
||||||
@@ -369,9 +363,15 @@ public class UI extends SceneModule{
|
|||||||
new Dialog("[crimson]An error has occured", "dialog"){{
|
new Dialog("[crimson]An error has occured", "dialog"){{
|
||||||
content().pad(15);
|
content().pad(15);
|
||||||
content().add(text);
|
content().add(text);
|
||||||
getButtonTable().addButton("OK", ()->{
|
getButtonTable().addButton("OK", this::hide).size(90, 50).pad(4);
|
||||||
hide();
|
}}.show();
|
||||||
}).size(90, 50).pad(4);
|
}
|
||||||
|
|
||||||
|
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();
|
}}.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,10 +42,6 @@ public class SaveDialog extends LoadDialog{
|
|||||||
Timers.runTask(5f, () -> {
|
Timers.runTask(5f, () -> {
|
||||||
hide();
|
hide();
|
||||||
Vars.ui.hideLoading();
|
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{
|
try{
|
||||||
SaveIO.saveToSlot(slot);
|
SaveIO.saveToSlot(slot);
|
||||||
}catch(Throwable e){
|
}catch(Throwable e){
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ public class Tile{
|
|||||||
Block block = block();
|
Block block = block();
|
||||||
Block floor = floor();
|
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) + "]" : "");
|
(link != 0 ? " link=[" + (Bits.getLeftByte(link) - 8) + ", " + (Bits.getRightByte(link) - 8) + "]" : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package io.anuke.mindustry.world.blocks.types.distribution;
|
|||||||
import io.anuke.mindustry.resource.Item;
|
import io.anuke.mindustry.resource.Item;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
import io.anuke.ucore.UCore;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
|
|
||||||
public class Junction extends Block{
|
public class Junction extends Block{
|
||||||
@@ -23,6 +24,8 @@ public class Junction extends Block{
|
|||||||
int dir = source.relativeTo(tile.x, tile.y);
|
int dir = source.relativeTo(tile.x, tile.y);
|
||||||
Tile to = tile.getNearby()[dir];
|
Tile to = tile.getNearby()[dir];
|
||||||
|
|
||||||
|
UCore.log("handling to " + to + " from " + source + ", tile = " + tile);
|
||||||
|
|
||||||
Timers.run(15, ()->{
|
Timers.run(15, ()->{
|
||||||
if(to == null || to.entity == null) return;
|
if(to == null || to.entity == null) return;
|
||||||
to.block().handleItem(item, to, tile);
|
to.block().handleItem(item, to, tile);
|
||||||
@@ -35,6 +38,7 @@ public class Junction extends Block{
|
|||||||
int dir = source.relativeTo(dest.x, dest.y);
|
int dir = source.relativeTo(dest.x, dest.y);
|
||||||
if(dir == -1) return false;
|
if(dir == -1) return false;
|
||||||
Tile to = dest.getNearby()[dir];
|
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);
|
return to != null && to.block().acceptItem(item, to, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user