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