Implemented fog saving

This commit is contained in:
Anuken
2018-07-27 17:26:12 -04:00
parent 0d4cf9f6c4
commit 0875c29da5
10 changed files with 149 additions and 43 deletions

View File

@@ -75,8 +75,7 @@ public class Saves{
Timers.run(2f, () -> {
try{
SaveIO.saveToSlot(current.index);
current.meta = SaveIO.getData(current.index);
current.save();
}catch(Exception e){
e.printStackTrace();
}
@@ -108,10 +107,7 @@ public class Saves{
slot.setName(name);
saves.add(slot);
saveMap.put(slot.index, slot);
SaveIO.saveToSlot(slot.index);
slot.meta = SaveIO.getData(slot.index);
current = slot;
slot.save();
saveSlots();
return slot;
}
@@ -162,9 +158,18 @@ public class Saves{
}
public void save(){
SaveIO.saveToSlot(index);
meta = SaveIO.getData(index);
current = this;
threads.runGraphics(() -> {
//Renderer fog needs to be written on graphics thread, but save() can run on logic thread
//thus, runGraphics is required here
renderer.fog().writeFog();
//save on the logic thread
threads.run(() -> {
SaveIO.saveToSlot(index);
meta = SaveIO.getData(index);
current = this;
});
});
}
public boolean isHidden(){