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/EventCall.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/EventCall.java')
-rwxr-xr-x | src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java index 7214528..c94fc80 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java | |||
@@ -22,20 +22,28 @@ public abstract class EventCall extends SpecialEvent { | |||
22 | }; | 22 | }; |
23 | } | 23 | } |
24 | 24 | ||
25 | public abstract void run(); | 25 | public abstract void run() throws InterruptedException; |
26 | 26 | ||
27 | private Future isRunning = null; | 27 | private Future eventThread = null; |
28 | public void activate(EventCallTime calltime) | 28 | public void activate(EventCallTime calltime) |
29 | { | 29 | { |
30 | if ((isRunning == null) || (isRunning.isDone())) | 30 | if ((eventThread == null) || (eventThread.isDone())) |
31 | { | 31 | { |
32 | if (calltime == EventCallTime.ParallelProcess) | 32 | if (calltime == EventCallTime.ParallelProcess) |
33 | { | 33 | { |
34 | isRunning = EventHandler.runParallel(this); | 34 | eventThread = EventHandler.runParallel(this); |
35 | } else { | 35 | } else { |
36 | isRunning = EventHandler.runEvent(this); | 36 | eventThread = EventHandler.runEvent(this); |
37 | } | 37 | } |
38 | } | 38 | } |
39 | } | 39 | } |
40 | 40 | ||
41 | public void cancel() | ||
42 | { | ||
43 | if ((eventThread != null) && (!eventThread.isDone())) | ||
44 | { | ||
45 | eventThread.cancel(true); | ||
46 | } | ||
47 | } | ||
48 | |||
41 | } | 49 | } |