From 32cd459600a54a23712c92963d65a22dd3484686 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 13 Aug 2021 22:21:59 -0400 Subject: [PATCH] v0.9.4: fixed rankings getting submitted when ankh revive is happening --- .../com/shatteredpixel/shatteredpixeldungeon/Dungeon.java | 2 +- .../shatteredpixeldungeon/actors/hero/Hero.java | 5 +++++ .../shatteredpixeldungeon/windows/WndResurrect.java | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java index 9466098ab..3c90dd916 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java @@ -676,7 +676,7 @@ public class Dungeon { } public static void fail( Class cause ) { - if (hero.belongings.getItem( Ankh.class ) == null) { + if (WndResurrect.instance == null) { Rankings.INSTANCE.submit( false, cause ); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 7f3159a32..02957c4ff 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -1644,6 +1644,11 @@ public class Hero extends Char { } } else { + //this is hacky, basically we want to declare that a wndResurrect exists before + //it actually gets created. This is important so that the game knows to not + //delete the run or submit it to rankings, because a WndResurrect is about to exist + //this is needed because the actual creation of the window is delayed here + WndResurrect.instance = new Object(); Game.runOnRenderThread(new Callback() { @Override public void call() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndResurrect.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndResurrect.java index c0e72c3e5..3f6e5abd1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndResurrect.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndResurrect.java @@ -48,7 +48,7 @@ public class WndResurrect extends Window { private static final int BTN_SIZE = 36; - public static WndResurrect instance; + public static Object instance; private WndBlacksmith.ItemButton btnItem1; private WndBlacksmith.ItemButton btnItem2;