From 0a695432a06c862136fb2038053d1c6ca7f12524 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Tue, 4 Nov 2014 21:31:47 +0100 Subject: [PATCH] Bugfix: GamePausedScreen did not correctly replace the GameScreen when going to MainMenu. --- src/de/teamteamteam/spacescooter/control/Keyboard.java | 8 +++++++- .../spacescooter/screen/GamePausedScreen.java | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/de/teamteamteam/spacescooter/control/Keyboard.java b/src/de/teamteamteam/spacescooter/control/Keyboard.java index 145d15c..cb0d5b4 100644 --- a/src/de/teamteamteam/spacescooter/control/Keyboard.java +++ b/src/de/teamteamteam/spacescooter/control/Keyboard.java @@ -70,7 +70,13 @@ public class Keyboard implements KeyListener { Keyboard.listener.remove(listener); } - + /** + * Make sure we only iterate over copies due to possible concurrent modification. + * This method returns a copy of the listener list. + */ + public ArrayList getListener() { + return new ArrayList(Keyboard.listener); + } /** * KeyListener method. * Registers the pressed key and passes the event on to registered listeners. diff --git a/src/de/teamteamteam/spacescooter/screen/GamePausedScreen.java b/src/de/teamteamteam/spacescooter/screen/GamePausedScreen.java index de1a889..1cf3100 100644 --- a/src/de/teamteamteam/spacescooter/screen/GamePausedScreen.java +++ b/src/de/teamteamteam/spacescooter/screen/GamePausedScreen.java @@ -91,7 +91,8 @@ public class GamePausedScreen extends Screen { this.parent.setOverlay(null); break; case 1: - this.parent.setOverlay(new MainMenuScreen(this.parent)); + //Replace our parents (the game) parent (the SuperScreen) overlay. + this.parent.parent.setOverlay(new MainMenuScreen(this.parent.parent)); break; } }