mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-11 00:07:46 +07:00
Added message for loading broken saves
This commit is contained in:
@ -123,6 +123,7 @@ text.server.port=Port:
|
|||||||
text.server.addressinuse=Address already in use!
|
text.server.addressinuse=Address already in use!
|
||||||
text.server.invalidport=Invalid port number!
|
text.server.invalidport=Invalid port number!
|
||||||
text.server.error=[crimson]Error hosting server: [orange]{0}
|
text.server.error=[crimson]Error hosting server: [orange]{0}
|
||||||
|
text.save.old=This save is for an older version of the game, and can no longer be used.\n\n[LIGHT_GRAY]Save backwards compatibility will be implemented in the full 4.0 release.
|
||||||
text.save.new=New Save
|
text.save.new=New Save
|
||||||
text.save.overwrite=Are you sure you want to overwrite\nthis save slot?
|
text.save.overwrite=Are you sure you want to overwrite\nthis save slot?
|
||||||
text.overwrite=Overwrite
|
text.overwrite=Overwrite
|
||||||
@ -292,7 +293,6 @@ text.blocks.inputfuel=Fuel
|
|||||||
text.blocks.fuelburntime=Fuel Burn Time
|
text.blocks.fuelburntime=Fuel Burn Time
|
||||||
text.blocks.inputcapacity=Input capacity
|
text.blocks.inputcapacity=Input capacity
|
||||||
text.blocks.outputcapacity=Output capacity
|
text.blocks.outputcapacity=Output capacity
|
||||||
text.blocks.required=Required:
|
|
||||||
|
|
||||||
text.unit.blocks=blocks
|
text.unit.blocks=blocks
|
||||||
text.unit.powersecond=power units/second
|
text.unit.powersecond=power units/second
|
||||||
|
@ -492,3 +492,4 @@ block.liquid-junction.name=Liquid Junction
|
|||||||
block.bridge-conduit.name=Bridge Conduit
|
block.bridge-conduit.name=Bridge Conduit
|
||||||
block.rotary-pump.name=Rotary Pump
|
block.rotary-pump.name=Rotary Pump
|
||||||
block.nuclear-reactor.name=Nuclear Reactor
|
block.nuclear-reactor.name=Nuclear Reactor
|
||||||
|
text.save.old=This save is for an older version of the game, and can no longer be used.\n\n[LIGHT_GRAY]Save backwards compatibility will be implemented in the full 4.0 release.
|
||||||
|
@ -492,3 +492,4 @@ block.liquid-junction.name=Liquid Junction
|
|||||||
block.bridge-conduit.name=Bridge Conduit
|
block.bridge-conduit.name=Bridge Conduit
|
||||||
block.rotary-pump.name=Rotary Pump
|
block.rotary-pump.name=Rotary Pump
|
||||||
block.nuclear-reactor.name=Nuclear Reactor
|
block.nuclear-reactor.name=Nuclear Reactor
|
||||||
|
text.save.old=This save is for an older version of the game, and can no longer be used.\n\n[LIGHT_GRAY]Save backwards compatibility will be implemented in the full 4.0 release.
|
||||||
|
@ -492,3 +492,4 @@ block.liquid-junction.name=Liquid Junction
|
|||||||
block.bridge-conduit.name=Bridge Conduit
|
block.bridge-conduit.name=Bridge Conduit
|
||||||
block.rotary-pump.name=Rotary Pump
|
block.rotary-pump.name=Rotary Pump
|
||||||
block.nuclear-reactor.name=Nuclear Reactor
|
block.nuclear-reactor.name=Nuclear Reactor
|
||||||
|
text.save.old=This save is for an older version of the game, and can no longer be used.\n\n[LIGHT_GRAY]Save backwards compatibility will be implemented in the full 4.0 release.
|
||||||
|
@ -492,3 +492,4 @@ block.liquid-junction.name=Liquid Junction
|
|||||||
block.bridge-conduit.name=Bridge Conduit
|
block.bridge-conduit.name=Bridge Conduit
|
||||||
block.rotary-pump.name=Rotary Pump
|
block.rotary-pump.name=Rotary Pump
|
||||||
block.nuclear-reactor.name=Nuclear Reactor
|
block.nuclear-reactor.name=Nuclear Reactor
|
||||||
|
text.save.old=This save is for an older version of the game, and can no longer be used.\n\n[LIGHT_GRAY]Save backwards compatibility will be implemented in the full 4.0 release.
|
||||||
|
@ -492,3 +492,4 @@ block.liquid-junction.name=Liquid Junction
|
|||||||
block.bridge-conduit.name=Bridge Conduit
|
block.bridge-conduit.name=Bridge Conduit
|
||||||
block.rotary-pump.name=Rotary Pump
|
block.rotary-pump.name=Rotary Pump
|
||||||
block.nuclear-reactor.name=Nuclear Reactor
|
block.nuclear-reactor.name=Nuclear Reactor
|
||||||
|
text.save.old=This save is for an older version of the game, and can no longer be used.\n\n[LIGHT_GRAY]Save backwards compatibility will be implemented in the full 4.0 release.
|
||||||
|
@ -492,3 +492,4 @@ block.distributor.name=Distributor
|
|||||||
block.distributor.description=A splitter that can split items into 8 directions.
|
block.distributor.description=A splitter that can split items into 8 directions.
|
||||||
block.overflow-gate.description=A combination splitter and router that only outputs to the left and right if the front path is blocked.
|
block.overflow-gate.description=A combination splitter and router that only outputs to the left and right if the front path is blocked.
|
||||||
block.nuclear-reactor.name=Nuclear Reactor
|
block.nuclear-reactor.name=Nuclear Reactor
|
||||||
|
text.save.old=This save is for an older version of the game, and can no longer be used.\n\n[LIGHT_GRAY]Save backwards compatibility will be implemented in the full 4.0 release.
|
||||||
|
@ -492,3 +492,4 @@ block.liquid-junction.name=Liquid Junction
|
|||||||
block.bridge-conduit.name=Bridge Conduit
|
block.bridge-conduit.name=Bridge Conduit
|
||||||
block.rotary-pump.name=Rotary Pump
|
block.rotary-pump.name=Rotary Pump
|
||||||
block.nuclear-reactor.name=Nuclear Reactor
|
block.nuclear-reactor.name=Nuclear Reactor
|
||||||
|
text.save.old=This save is for an older version of the game, and can no longer be used.\n\n[LIGHT_GRAY]Save backwards compatibility will be implemented in the full 4.0 release.
|
||||||
|
@ -492,3 +492,4 @@ block.liquid-junction.name=Liquid Junction
|
|||||||
block.bridge-conduit.name=Bridge Conduit
|
block.bridge-conduit.name=Bridge Conduit
|
||||||
block.rotary-pump.name=Rotary Pump
|
block.rotary-pump.name=Rotary Pump
|
||||||
block.nuclear-reactor.name=Nuclear Reactor
|
block.nuclear-reactor.name=Nuclear Reactor
|
||||||
|
text.save.old=This save is for an older version of the game, and can no longer be used.\n\n[LIGHT_GRAY]Save backwards compatibility will be implemented in the full 4.0 release.
|
||||||
|
@ -492,3 +492,4 @@ block.liquid-junction.name=Liquid Junction
|
|||||||
block.bridge-conduit.name=Bridge Conduit
|
block.bridge-conduit.name=Bridge Conduit
|
||||||
block.rotary-pump.name=Rotary Pump
|
block.rotary-pump.name=Rotary Pump
|
||||||
block.nuclear-reactor.name=Nuclear Reactor
|
block.nuclear-reactor.name=Nuclear Reactor
|
||||||
|
text.save.old=This save is for an older version of the game, and can no longer be used.\n\n[LIGHT_GRAY]Save backwards compatibility will be implemented in the full 4.0 release.
|
||||||
|
@ -492,3 +492,4 @@ block.liquid-junction.name=Liquid Junction
|
|||||||
block.bridge-conduit.name=Bridge Conduit
|
block.bridge-conduit.name=Bridge Conduit
|
||||||
block.rotary-pump.name=Rotary Pump
|
block.rotary-pump.name=Rotary Pump
|
||||||
block.nuclear-reactor.name=Nuclear Reactor
|
block.nuclear-reactor.name=Nuclear Reactor
|
||||||
|
text.save.old=This save is for an older version of the game, and can no longer be used.\n\n[LIGHT_GRAY]Save backwards compatibility will be implemented in the full 4.0 release.
|
||||||
|
@ -492,3 +492,4 @@ block.liquid-junction.name=Liquid Junction
|
|||||||
block.bridge-conduit.name=Bridge Conduit
|
block.bridge-conduit.name=Bridge Conduit
|
||||||
block.rotary-pump.name=Rotary Pump
|
block.rotary-pump.name=Rotary Pump
|
||||||
block.nuclear-reactor.name=Nuclear Reactor
|
block.nuclear-reactor.name=Nuclear Reactor
|
||||||
|
text.save.old=This save is for an older version of the game, and can no longer be used.\n\n[LIGHT_GRAY]Save backwards compatibility will be implemented in the full 4.0 release.
|
||||||
|
@ -23,7 +23,11 @@ import static io.anuke.mindustry.Vars.world;
|
|||||||
public abstract class FlyingUnit extends BaseUnit implements CarryTrait{
|
public abstract class FlyingUnit extends BaseUnit implements CarryTrait{
|
||||||
protected static Translator vec = new Translator();
|
protected static Translator vec = new Translator();
|
||||||
protected static float wobblyness = 0.6f;
|
protected static float wobblyness = 0.6f;
|
||||||
public final UnitState
|
|
||||||
|
protected Trail trail = new Trail(8);
|
||||||
|
protected CarriableTrait carrying;
|
||||||
|
|
||||||
|
protected final UnitState
|
||||||
|
|
||||||
resupply = new UnitState(){
|
resupply = new UnitState(){
|
||||||
public void entered(){
|
public void entered(){
|
||||||
@ -113,8 +117,6 @@ public abstract class FlyingUnit extends BaseUnit implements CarryTrait{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
protected Trail trail = new Trail(8);
|
|
||||||
protected CarriableTrait carrying;
|
|
||||||
|
|
||||||
//instantiation only
|
//instantiation only
|
||||||
public FlyingUnit(){
|
public FlyingUnit(){
|
||||||
|
@ -15,11 +15,12 @@ public abstract class SaveFileVersion{
|
|||||||
|
|
||||||
public SaveMeta getData(DataInputStream stream) throws IOException{
|
public SaveMeta getData(DataInputStream stream) throws IOException{
|
||||||
long time = stream.readLong(); //read last saved time
|
long time = stream.readLong(); //read last saved time
|
||||||
|
int build = stream.readInt();
|
||||||
byte mode = stream.readByte(); //read the gamemode
|
byte mode = stream.readByte(); //read the gamemode
|
||||||
String map = stream.readUTF(); //read the map
|
String map = stream.readUTF(); //read the map
|
||||||
int wave = stream.readInt(); //read the wave
|
int wave = stream.readInt(); //read the wave
|
||||||
byte difficulty = stream.readByte(); //read the difficulty
|
byte difficulty = stream.readByte(); //read the difficulty
|
||||||
return new SaveMeta(version, time, mode, map, wave, Difficulty.values()[difficulty]);
|
return new SaveMeta(version, time, build, mode, map, wave, Difficulty.values()[difficulty]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void read(DataInputStream stream) throws IOException;
|
public abstract void read(DataInputStream stream) throws IOException;
|
||||||
|
@ -3,6 +3,7 @@ package io.anuke.mindustry.io;
|
|||||||
import com.badlogic.gdx.files.FileHandle;
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import com.badlogic.gdx.utils.Base64Coder;
|
import com.badlogic.gdx.utils.Base64Coder;
|
||||||
|
import com.badlogic.gdx.utils.IntArray;
|
||||||
import com.badlogic.gdx.utils.IntMap;
|
import com.badlogic.gdx.utils.IntMap;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.io.versions.Save16;
|
import io.anuke.mindustry.io.versions.Save16;
|
||||||
@ -15,6 +16,7 @@ import java.util.zip.InflaterInputStream;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class SaveIO{
|
public class SaveIO{
|
||||||
|
public static final IntArray breakingVersions = IntArray.with(47);
|
||||||
public static final IntMap<SaveFileVersion> versions = new IntMap<>();
|
public static final IntMap<SaveFileVersion> versions = new IntMap<>();
|
||||||
public static final Array<SaveFileVersion> versionArray = Array.with(
|
public static final Array<SaveFileVersion> versionArray = Array.with(
|
||||||
new Save16()
|
new Save16()
|
||||||
|
@ -10,14 +10,16 @@ import static io.anuke.mindustry.Vars.world;
|
|||||||
|
|
||||||
public class SaveMeta{
|
public class SaveMeta{
|
||||||
public int version;
|
public int version;
|
||||||
|
public int build;
|
||||||
public String date;
|
public String date;
|
||||||
public GameMode mode;
|
public GameMode mode;
|
||||||
public Map map;
|
public Map map;
|
||||||
public int wave;
|
public int wave;
|
||||||
public Difficulty difficulty;
|
public Difficulty difficulty;
|
||||||
|
|
||||||
public SaveMeta(int version, long date, int mode, String map, int wave, Difficulty difficulty){
|
public SaveMeta(int version, long date, int build, int mode, String map, int wave, Difficulty difficulty){
|
||||||
this.version = version;
|
this.version = version;
|
||||||
|
this.build = build;
|
||||||
this.date = Platform.instance.format(new Date(date));
|
this.date = Platform.instance.format(new Date(date));
|
||||||
this.mode = GameMode.values()[mode];
|
this.mode = GameMode.values()[mode];
|
||||||
this.map = world.maps().getByName(map);
|
this.map = world.maps().getByName(map);
|
||||||
|
@ -144,6 +144,10 @@ public class Saves{
|
|||||||
Settings.save();
|
Settings.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getBuild(){
|
||||||
|
return meta.build;
|
||||||
|
}
|
||||||
|
|
||||||
public int getWave(){
|
public int getWave(){
|
||||||
return meta.wave;
|
return meta.wave;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import io.anuke.mindustry.game.GameMode;
|
|||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
import io.anuke.mindustry.io.Map;
|
import io.anuke.mindustry.io.Map;
|
||||||
import io.anuke.mindustry.io.SaveFileVersion;
|
import io.anuke.mindustry.io.SaveFileVersion;
|
||||||
|
import io.anuke.mindustry.io.Version;
|
||||||
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.mindustry.world.blocks.BlockPart;
|
import io.anuke.mindustry.world.blocks.BlockPart;
|
||||||
@ -153,6 +154,7 @@ public class Save16 extends SaveFileVersion{
|
|||||||
//--META--
|
//--META--
|
||||||
stream.writeInt(version); //version id
|
stream.writeInt(version); //version id
|
||||||
stream.writeLong(TimeUtils.millis()); //last saved
|
stream.writeLong(TimeUtils.millis()); //last saved
|
||||||
|
stream.writeInt(Version.build);
|
||||||
|
|
||||||
//--GENERAL STATE--
|
//--GENERAL STATE--
|
||||||
stream.writeByte(state.mode.ordinal()); //gamemode
|
stream.writeByte(state.mode.ordinal()); //gamemode
|
||||||
@ -175,7 +177,6 @@ public class Save16 extends SaveFileVersion{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--ENTITIES--
|
//--ENTITIES--
|
||||||
//TODO synchronized block here
|
|
||||||
|
|
||||||
int groups = 0;
|
int groups = 0;
|
||||||
|
|
||||||
|
@ -185,8 +185,14 @@ public class LoadDialog extends FloatingDialog{
|
|||||||
public void modifyButton(TextButton button, SaveSlot slot){
|
public void modifyButton(TextButton button, SaveSlot slot){
|
||||||
button.clicked(() -> {
|
button.clicked(() -> {
|
||||||
if(!button.childrenPressed()){
|
if(!button.childrenPressed()){
|
||||||
|
int build = slot.getBuild();
|
||||||
|
if(SaveIO.breakingVersions.contains(build)){
|
||||||
|
ui.showInfo("$text.save.old");
|
||||||
|
slot.delete();
|
||||||
|
}else{
|
||||||
runLoadSave(slot);
|
runLoadSave(slot);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user