diff options
| author | Starla Insigna <hatkirby@fourisland.com> | 2009-03-24 09:30:49 -0400 |
|---|---|---|
| committer | Starla Insigna <hatkirby@fourisland.com> | 2009-03-24 09:30:49 -0400 |
| commit | 82cfc90465c6e85bc0b73a55ea00e7a70438d67f (patch) | |
| tree | 49dbcde6c2dab4e98c6d6fb073be5549347d255b /src | |
| parent | de019d1faf3daa90898bb194d1aac64409ca8824 (diff) | |
| download | fourpuzzle-82cfc90465c6e85bc0b73a55ea00e7a70438d67f.tar.gz fourpuzzle-82cfc90465c6e85bc0b73a55ea00e7a70438d67f.tar.bz2 fourpuzzle-82cfc90465c6e85bc0b73a55ea00e7a70438d67f.zip | |
Engine: Allowed LoopUntilCollisionMoveEvent to be cancelled
Diffstat (limited to 'src')
3 files changed, 17 insertions, 8 deletions
| diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventHandler.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventHandler.java index 9cb67ba..0255952 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventHandler.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventHandler.java | |||
| @@ -6,7 +6,6 @@ | |||
| 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; | ||
| 10 | import com.fourisland.fourpuzzle.util.ResourceNotFoundException; | 9 | import com.fourisland.fourpuzzle.util.ResourceNotFoundException; |
| 11 | import java.util.concurrent.ExecutorService; | 10 | import java.util.concurrent.ExecutorService; |
| 12 | import java.util.concurrent.Executors; | 11 | import java.util.concurrent.Executors; |
| diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java index 2daefab..2970056 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java | |||
| @@ -163,7 +163,7 @@ public class SpecialEvent { | |||
| 163 | /** | 163 | /** |
| 164 | * Waits until all previously called MoveEvent()s have finished | 164 | * Waits until all previously called MoveEvent()s have finished |
| 165 | * | 165 | * |
| 166 | * @throws InterruptedException | 166 | * @throws InterruptedException |
| 167 | */ | 167 | */ |
| 168 | public void MoveEventWait() throws InterruptedException | 168 | public void MoveEventWait() throws InterruptedException |
| 169 | { | 169 | { |
| diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/LoopUntilCollisionMoveEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/LoopUntilCollisionMoveEvent.java index daceffd..f299145 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/LoopUntilCollisionMoveEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/LoopUntilCollisionMoveEvent.java | |||
| @@ -32,14 +32,24 @@ public class LoopUntilCollisionMoveEvent implements MoveEvent { | |||
| 32 | { | 32 | { |
| 33 | loc = new Point(); | 33 | loc = new Point(); |
| 34 | 34 | ||
| 35 | while ((loc == null) || (!loc.equals(ev.getLocation()))) | 35 | try { |
| 36 | { | 36 | while ((loc == null) || (!loc.equals(ev.getLocation()))) |
| 37 | loc.setLocation(ev.getLocation()); | ||
| 38 | |||
| 39 | for (MoveEvent move : moves) | ||
| 40 | { | 37 | { |
| 41 | move.doAction(ev); | 38 | loc.setLocation(ev.getLocation()); |
| 39 | |||
| 40 | for (MoveEvent move : moves) | ||
| 41 | { | ||
| 42 | move.doAction(ev); | ||
| 43 | |||
| 44 | if (Thread.currentThread().isInterrupted()) | ||
| 45 | { | ||
| 46 | throw new InterruptedException(); | ||
| 47 | } | ||
| 48 | } | ||
| 42 | } | 49 | } |
| 50 | } catch (InterruptedException ex) { | ||
| 51 | /* The special event has been cancelled; Propogate the interrupt to | ||
| 52 | * the MoveEventThread */ | ||
| 43 | } | 53 | } |
| 44 | } | 54 | } |
| 45 | 55 | ||
