diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2009-02-23 09:20:19 -0500 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2009-02-23 09:20:19 -0500 |
commit | 284c53489b89a6e39027aeab27c258c8926f77f0 (patch) | |
tree | 51d0cd69236b0a43ce2b36149f62f18281dd86c6 /src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventHandler.java | |
parent | 8b8e44782659c65b9899f81a1ad5e09477c37354 (diff) | |
download | fourpuzzle-284c53489b89a6e39027aeab27c258c8926f77f0.tar.gz fourpuzzle-284c53489b89a6e39027aeab27c258c8926f77f0.tar.bz2 fourpuzzle-284c53489b89a6e39027aeab27c258c8926f77f0.zip |
Engine: Added Event Thread cancellation
Diffstat (limited to 'src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventHandler.java')
-rwxr-xr-x | src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventHandler.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventHandler.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventHandler.java index a8a626f..e24b79c 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventHandler.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventHandler.java | |||
@@ -6,6 +6,7 @@ | |||
6 | package com.fourisland.fourpuzzle.gamestate.mapview.event; | 6 | package com.fourisland.fourpuzzle.gamestate.mapview.event; |
7 | 7 | ||
8 | import com.fourisland.fourpuzzle.PuzzleApplication; | 8 | import com.fourisland.fourpuzzle.PuzzleApplication; |
9 | import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.AutomaticViewpoint; | ||
9 | import com.fourisland.fourpuzzle.util.ResourceNotFoundException; | 10 | import com.fourisland.fourpuzzle.util.ResourceNotFoundException; |
10 | import java.util.concurrent.ExecutorService; | 11 | import java.util.concurrent.ExecutorService; |
11 | import java.util.concurrent.Executors; | 12 | import java.util.concurrent.Executors; |
@@ -51,6 +52,14 @@ public class EventHandler { | |||
51 | try | 52 | try |
52 | { | 53 | { |
53 | callback.run(); | 54 | callback.run(); |
55 | } catch (InterruptedException ex) { | ||
56 | /* Swallow the interrupt, as the interruption probably | ||
57 | * indicates that the event should be cancelled | ||
58 | * | ||
59 | * Also reset the viewpoint in case the viewpoint was | ||
60 | * fixed during the thread */ | ||
61 | |||
62 | SpecialEvent.mapView.setViewpoint(new AutomaticViewpoint(SpecialEvent.mapView.getCurrentMap())); | ||
54 | } catch (ResourceNotFoundException ex) | 63 | } catch (ResourceNotFoundException ex) |
55 | { | 64 | { |
56 | PuzzleApplication.INSTANCE.reportError(ex); | 65 | PuzzleApplication.INSTANCE.reportError(ex); |