From aa00a1b8d1227d46efd224ded4f16bb529805c86 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 7 Aug 2018 20:16:50 -0400 Subject: [PATCH] Minor save-time fix --- core/src/io/anuke/mindustry/game/Saves.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/src/io/anuke/mindustry/game/Saves.java b/core/src/io/anuke/mindustry/game/Saves.java index e9257c5da5..e764b79a77 100644 --- a/core/src/io/anuke/mindustry/game/Saves.java +++ b/core/src/io/anuke/mindustry/game/Saves.java @@ -162,6 +162,8 @@ public class Saves{ } public void save(){ + long time = totalPlaytime; + threads.runGraphics(() -> { //Renderer fog needs to be written on graphics thread, but save() can run on logic thread //thus, runGraphics is required here @@ -169,9 +171,16 @@ public class Saves{ //save on the logic thread threads.run(() -> { + long prev = totalPlaytime; + totalPlaytime = time; + SaveIO.saveToSlot(index); meta = SaveIO.getData(index); - current = this; + if(!state.is(State.menu)){ + current = this; + } + + totalPlaytime = prev; }); }); }