From 66c1fd9f53799f46941ac18e5875c9ec3bea230f Mon Sep 17 00:00:00 2001 From: Radek Date: Thu, 28 Jul 2022 15:04:11 +0200 Subject: [PATCH 1/2] wait for transition --- src/saving/InProgressLoad.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/saving/InProgressLoad.cs b/src/saving/InProgressLoad.cs index c2bf3902d20..39cd78e2d94 100644 --- a/src/saving/InProgressLoad.cs +++ b/src/saving/InProgressLoad.cs @@ -88,10 +88,14 @@ private void Step() break; case State.ReadingData: { + // Wait for transition to finish. + // Workaround for #1406 + if (TransitionManager.Instance.HasQueuedTransitions) + break; + // Start suppressing loaded node deletion TemporaryLoadedNodeDeleter.Instance.AddDeletionHold(Constants.DELETION_HOLD_LOAD); - // TODO: do this in a background thread if possible try { // Invalid is given as the target state here, because it's unknown yet. From 4b27adfa5fda2f62cbd200fca5bd80b2b54f9d5e Mon Sep 17 00:00:00 2001 From: Radek Date: Thu, 28 Jul 2022 16:50:36 +0200 Subject: [PATCH 2/2] register callback instead of manual checking --- src/saving/InProgressLoad.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/saving/InProgressLoad.cs b/src/saving/InProgressLoad.cs index 39cd78e2d94..6754d34101e 100644 --- a/src/saving/InProgressLoad.cs +++ b/src/saving/InProgressLoad.cs @@ -79,23 +79,21 @@ private void Step() MainGameState.Invalid, TranslationServer.Translate("READING_SAVE_DATA")); - TransitionManager.Instance.AddSequence(ScreenFade.FadeType.FadeIn, 0.5f, null, false, false); + TransitionManager.Instance.AddSequence(ScreenFade.FadeType.FadeIn, 0.5f, Step, false, false); // Let all suppressed deletions happen TemporaryLoadedNodeDeleter.Instance.ReleaseAllHolds(); JSONDebug.FlushJSONTracesOut(); - break; + // Continue after transition finishes + return; case State.ReadingData: { - // Wait for transition to finish. - // Workaround for #1406 - if (TransitionManager.Instance.HasQueuedTransitions) - break; - // Start suppressing loaded node deletion TemporaryLoadedNodeDeleter.Instance.AddDeletionHold(Constants.DELETION_HOLD_LOAD); + // TODO: do this in a background thread once possible + // https://github.com/Revolutionary-Games/Thrive/issues/1406 try { // Invalid is given as the target state here, because it's unknown yet.