Added Indonesian language, fixed bug with saves disappearing

This commit is contained in:
Anuken
2018-01-22 12:46:00 -05:00
parent 772a6abd3f
commit b1c85da528
7 changed files with 988 additions and 35 deletions

View File

@@ -12,7 +12,6 @@ public abstract class SaveFileVersion {
}
public SaveMeta getData(DataInputStream stream) throws IOException{
int version = stream.readInt(); //read version
long time = stream.readLong(); //read last saved time
byte mode = stream.readByte(); //read the gamemode
byte map = stream.readByte(); //read the map

View File

@@ -9,7 +9,6 @@ import io.anuke.mindustry.io.versions.Save12;
import io.anuke.mindustry.io.versions.Save13;
import io.anuke.mindustry.io.versions.Save14;
import io.anuke.mindustry.io.versions.Save15;
import io.anuke.ucore.UCore;
import io.anuke.ucore.core.Settings;
import java.io.*;
@@ -58,7 +57,7 @@ public class SaveIO{
}
}
public static DataInputStream readSlotMeta(int slot){
public static DataInputStream getSlotStream(int slot){
if(Vars.gwt){
String string = Settings.getString("save-"+slot+"-data");
byte[] bytes = Base64Coder.decode(string);
@@ -70,37 +69,12 @@ public class SaveIO{
public static boolean isSaveValid(int slot){
try {
return isSaveValid(readSlotMeta(slot));
return isSaveValid(getSlotStream(slot));
}catch (Exception e){
return false;
}
}
/**Returns whether or not conversion was succesful.*/
public static boolean checkConvert(int slot){
try{
DataInputStream stream = readSlotMeta(slot);
int version = stream.readInt();
stream.close();
if(version != getVersion().version){
UCore.log("Converting slot " + slot + ": " + version + " -> " + getVersion().version);
stream = readSlotMeta(slot);
SaveFileVersion target = versions.get(version);
target.read(stream);
stream.close();
saveToSlot(slot);
}
return true;
}catch (Exception e){
e.printStackTrace();
return false;
}
}
public static boolean isSaveValid(FileHandle file){
return isSaveValid(new DataInputStream(file.read()));
}
@@ -118,13 +92,14 @@ public class SaveIO{
}
public static SaveMeta getData(int slot){
return getData(readSlotMeta(slot));
return getData(getSlotStream(slot));
}
public static SaveMeta getData(DataInputStream stream){
try{
SaveMeta meta = getVersion().getData(stream);
int version = stream.readInt();
SaveMeta meta = versions.get(version).getData(stream);
stream.close();
return meta;
}catch (IOException e){

View File

@@ -13,7 +13,7 @@ import java.util.Locale;
public class LanguageDialog extends FloatingDialog{
private Locale[] locales = {Locale.ENGLISH, new Locale("fr", "FR"),
new Locale("es", "LA"), new Locale("pt", "BR"), new Locale("ko")};
new Locale("es", "LA"), new Locale("pt", "BR"), new Locale("ko"), new Locale("in", "ID")};
public LanguageDialog(){
super("$text.settings.language");