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; } }