summary refs log tree commit diff stats
path: root/src/com/fourisland
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2009-03-24 09:30:49 -0400
committerStarla Insigna <hatkirby@fourisland.com>2009-03-24 09:30:49 -0400
commit82cfc90465c6e85bc0b73a55ea00e7a70438d67f (patch)
tree49dbcde6c2dab4e98c6d6fb073be5549347d255b /src/com/fourisland
parentde019d1faf3daa90898bb194d1aac64409ca8824 (diff)
downloadfourpuzzle-82cfc90465c6e85bc0b73a55ea00e7a70438d67f.tar.gz
fourpuzzle-82cfc90465c6e85bc0b73a55ea00e7a70438d67f.tar.bz2
fourpuzzle-82cfc90465c6e85bc0b73a55ea00e7a70438d67f.zip
Engine: Allowed LoopUntilCollisionMoveEvent to be cancelled
Diffstat (limited to 'src/com/fourisland')
-rwxr-xr-xsrc/com/fourisland/fourpuzzle/gamestate/mapview/event/EventHandler.java1
-rwxr-xr-xsrc/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java2
-rwxr-xr-xsrc/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/LoopUntilCollisionMoveEvent.java22
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 @@
6package com.fourisland.fourpuzzle.gamestate.mapview.event; 6package com.fourisland.fourpuzzle.gamestate.mapview.event;
7 7
8import com.fourisland.fourpuzzle.PuzzleApplication; 8import com.fourisland.fourpuzzle.PuzzleApplication;
9import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.AutomaticViewpoint;
10import com.fourisland.fourpuzzle.util.ResourceNotFoundException; 9import com.fourisland.fourpuzzle.util.ResourceNotFoundException;
11import java.util.concurrent.ExecutorService; 10import java.util.concurrent.ExecutorService;
12import java.util.concurrent.Executors; 11import 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