diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2009-03-24 09:13:16 -0400 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2009-03-24 09:13:16 -0400 |
commit | de019d1faf3daa90898bb194d1aac64409ca8824 (patch) | |
tree | 09ca87bd0c7c6cd2e8e3df1353fc8d6504c3703d /src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java | |
parent | af19fd5898d839e1976f34960b21f8dfc2dd77eb (diff) | |
download | fourpuzzle-de019d1faf3daa90898bb194d1aac64409ca8824.tar.gz fourpuzzle-de019d1faf3daa90898bb194d1aac64409ca8824.tar.bz2 fourpuzzle-de019d1faf3daa90898bb194d1aac64409ca8824.zip |
Engine: Fixed MessageWindow non-closure
Added code to MapViewGameState's deinitalize() that cancells the callbacks of all currently running events. Also added code to SpecialEvent's displayMessage() that allows an InterruptedException to kill the message. With the problem with the Title Screen, it turned out that this bug had nothing to do with it, the Title Screen's interval was just too fast. Fixes #18
Diffstat (limited to 'src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java')
-rwxr-xr-x | src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java index 30db7a2..2daefab 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java | |||
@@ -63,21 +63,27 @@ public class SpecialEvent { | |||
63 | public void DisplayMessage(String message) throws InterruptedException | 63 | public void DisplayMessage(String message) throws InterruptedException |
64 | { | 64 | { |
65 | MessageWindow mw; | 65 | MessageWindow mw; |
66 | 66 | ||
67 | if (faceSet.equals("")) | 67 | if (faceSet.equals("")) |
68 | { | 68 | { |
69 | mw = new MessageWindow(message); | 69 | mw = new MessageWindow(message); |
70 | } else { | 70 | } else { |
71 | mw = new MessageWindow(message, faceSet, face); | 71 | mw = new MessageWindow(message, faceSet, face); |
72 | } | 72 | } |
73 | 73 | ||
74 | Display.registerRenderable(mw); | 74 | Display.registerRenderable(mw); |
75 | KeyboardInput.registerInputable(mw); | 75 | KeyboardInput.registerInputable(mw); |
76 | |||
77 | mw.waitForCompletion(); | ||
78 | 76 | ||
79 | Display.unregisterRenderable(mw); | 77 | try { |
80 | KeyboardInput.unregisterInputable(mw); | 78 | mw.waitForCompletion(); |
79 | } catch (InterruptedException ex) { | ||
80 | /* The special event has been cancelled, kill the message and then | ||
81 | * propogate the exception to the EventHandler */ | ||
82 | throw ex; | ||
83 | } finally { | ||
84 | Display.unregisterRenderable(mw); | ||
85 | KeyboardInput.unregisterInputable(mw); | ||
86 | } | ||
81 | } | 87 | } |
82 | 88 | ||
83 | /** | 89 | /** |