Fixed startup crash / Fixed editor rule issue
This commit is contained in:
@@ -20,7 +20,7 @@ import io.anuke.arc.util.*;
|
|||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.core.Platform;
|
import io.anuke.mindustry.core.Platform;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.*;
|
||||||
import io.anuke.mindustry.io.MapIO;
|
import io.anuke.mindustry.io.MapIO;
|
||||||
import io.anuke.mindustry.maps.Map;
|
import io.anuke.mindustry.maps.Map;
|
||||||
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
||||||
@@ -225,7 +225,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
hide();
|
hide();
|
||||||
//only reset the player; logic.reset() will clear entities, which we do not want
|
//only reset the player; logic.reset() will clear entities, which we do not want
|
||||||
player.reset();
|
player.reset();
|
||||||
// state.rules = Gamemode.editor.get();
|
state.rules = Gamemode.editor.apply(new Rules());
|
||||||
world.setMap(new Map(StringMap.of(
|
world.setMap(new Map(StringMap.of(
|
||||||
"name", "Editor Playtesting",
|
"name", "Editor Playtesting",
|
||||||
"width", editor.width(),
|
"width", editor.width(),
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ import io.anuke.arc.Core;
|
|||||||
import io.anuke.arc.Events;
|
import io.anuke.arc.Events;
|
||||||
import io.anuke.arc.collection.*;
|
import io.anuke.arc.collection.*;
|
||||||
import io.anuke.arc.files.FileHandle;
|
import io.anuke.arc.files.FileHandle;
|
||||||
import io.anuke.arc.util.Strings;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.Time;
|
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.game.EventType.StateChangeEvent;
|
import io.anuke.mindustry.game.EventType.StateChangeEvent;
|
||||||
import io.anuke.mindustry.io.SaveIO;
|
import io.anuke.mindustry.io.SaveIO;
|
||||||
|
|||||||
@@ -59,8 +59,9 @@ public class SaveIO{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSaveValid(int slot){
|
public static boolean isSaveValid(int slot){
|
||||||
try{ //file may not even exist at all, so catch that too
|
try{
|
||||||
return isSaveValid(getSlotStream(slot)) || isSaveValid(getBackupSlotStream(slot));
|
getMeta(slot);
|
||||||
|
return true;
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -85,7 +86,11 @@ public class SaveIO{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static SaveMeta getMeta(int slot){
|
public static SaveMeta getMeta(int slot){
|
||||||
return getMeta(getSlotStream(slot));
|
try{
|
||||||
|
return getMeta(getSlotStream(slot));
|
||||||
|
}catch(Exception e){
|
||||||
|
return getMeta(getBackupSlotStream(slot));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SaveMeta getMeta(DataInputStream stream){
|
public static SaveMeta getMeta(DataInputStream stream){
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ public class Maps implements Disposable{
|
|||||||
|
|
||||||
//free up any potential memory that was used up during conversion
|
//free up any potential memory that was used up during conversion
|
||||||
if(convertedAny){
|
if(convertedAny){
|
||||||
world.createTiles(0, 0);
|
world.createTiles(1, 1);
|
||||||
//reload maps to load the converted ones
|
//reload maps to load the converted ones
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user