From 6756c0920482d345bb20f1af29d1898281c9700d Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 30 Mar 2018 17:43:36 -0400 Subject: [PATCH] v0.6.4: bugfixes - fixed incorrect window layout when starting new game from gamescene - fixed rare action indicator crashes --- .../ui/ActionIndicator.java | 20 ++++++++++--------- .../windows/WndGame.java | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/ActionIndicator.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/ActionIndicator.java index 7b81cb4e9..ca43d7580 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/ActionIndicator.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/ActionIndicator.java @@ -48,7 +48,7 @@ public class ActionIndicator extends Tag { } @Override - protected void layout() { + protected synchronized void layout() { super.layout(); if (icon != null){ @@ -63,7 +63,7 @@ public class ActionIndicator extends Tag { private boolean needsLayout = false; @Override - public void update() { + public synchronized void update() { super.update(); if (!Dungeon.hero.ready){ @@ -104,13 +104,15 @@ public class ActionIndicator extends Tag { public static void updateIcon(){ if (instance != null){ - if (instance.icon != null){ - instance.icon.killAndErase(); - instance.icon = null; - } - if (action != null){ - instance.icon = action.getIcon(); - instance.needsLayout = true; + synchronized (instance) { + if (instance.icon != null) { + instance.icon.killAndErase(); + instance.icon = null; + } + if (action != null) { + instance.icon = action.getIcon(); + instance.needsLayout = true; + } } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndGame.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndGame.java index da584f543..49457e6c1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndGame.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndGame.java @@ -76,7 +76,7 @@ public class WndGame extends Window { protected void onClick() { GamesInProgress.selectedClass = Dungeon.hero.heroClass; InterlevelScene.noStory = true; - ShatteredPixelDungeon.scene().add(new WndStartGame(GamesInProgress.firstEmpty())); + GameScene.show(new WndStartGame(GamesInProgress.firstEmpty())); } } ); btnStart.textColor(Window.TITLE_COLOR);