diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java index ad8da616c..20b0bdcf0 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java @@ -136,9 +136,11 @@ public class PixelScene extends Scene { //FIXME this system currently only works for a subset of windows private static ArrayList> savedWindows = new ArrayList<>(); + private static Class savedClass = null; public void saveWindows(){ savedWindows.clear(); + savedClass = getClass(); for (Gizmo g : members){ if (g instanceof Window){ savedWindows.add((Class) g.getClass()); @@ -147,7 +149,7 @@ public class PixelScene extends Scene { } public void restoreWindows(){ - if (!savedWindows.isEmpty()){ + if (getClass().equals(savedClass)){ for (Class w : savedWindows){ try{ add(w.newInstance()); @@ -155,8 +157,8 @@ public class PixelScene extends Scene { //window has no public zero-arg constructor, just eat the exception } } - savedWindows.clear(); } + savedWindows.clear(); } @Override