Auto-generated serialization code
This commit is contained in:
@@ -68,7 +68,7 @@ public class ContentDatabase{
|
||||
}
|
||||
|
||||
public void load(){
|
||||
ObjectMap<ContentType, Array<String>> result = Settings.getJson("content-database", ObjectMap.class);
|
||||
ObjectMap<ContentType, Array<String>> result = Settings.getBinary("content-database", ObjectMap.class, () -> new ObjectMap<>());
|
||||
|
||||
for(Entry<ContentType, Array<String>> entry : result.entries()){
|
||||
ObjectSet<String> set = new ObjectSet<>();
|
||||
@@ -87,7 +87,7 @@ public class ContentDatabase{
|
||||
write.put(entry.key, entry.value.iterator().toArray());
|
||||
}
|
||||
|
||||
Settings.putJson("content-database", write);
|
||||
Settings.putBinary("content-database", write);
|
||||
Settings.save();
|
||||
dirty = false;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.anuke.mindustry.game;
|
||||
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.IntArray;
|
||||
import com.badlogic.gdx.utils.IntMap;
|
||||
import com.badlogic.gdx.utils.TimeUtils;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
@@ -44,9 +45,10 @@ public class Saves{
|
||||
|
||||
public void load(){
|
||||
saves.clear();
|
||||
int[] slots = Settings.getJson("save-slots", int[].class);
|
||||
IntArray slots = Settings.getBinary("save-slots", IntArray.class, IntArray::new);
|
||||
|
||||
for(int index : slots){
|
||||
for(int i = 0; i < slots.size; i ++){
|
||||
int index = slots.get(i);
|
||||
if(SaveIO.isSaveValid(index)){
|
||||
SaveSlot slot = new SaveSlot(index);
|
||||
saves.add(slot);
|
||||
@@ -138,11 +140,10 @@ public class Saves{
|
||||
}
|
||||
|
||||
private void saveSlots(){
|
||||
int[] result = new int[saves.size];
|
||||
for(int i = 0; i < result.length; i++){
|
||||
result[i] = saves.get(i).index;
|
||||
}
|
||||
Settings.putJson("save-slots", result);
|
||||
IntArray result = new IntArray(saves.size);
|
||||
for(int i = 0; i < saves.size; i++) result.add(saves.get(i).index);
|
||||
|
||||
Settings.putBinary("save-slots", result);
|
||||
Settings.save();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user