summary refs log tree commit diff stats
path: root/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/com')
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java5
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java23
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/MoveEventThread.java16
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/StepMoveEvent.java4
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/WaitMoveEvent.java4
-rw-r--r--src/com/fourisland/fourpuzzle/transition/TransitionCallbackThread.java4
6 files changed, 18 insertions, 38 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java index c0c2c3b..f577cc2 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java
@@ -5,7 +5,6 @@
5 5
6package com.fourisland.fourpuzzle.gamestate.mapview.event; 6package com.fourisland.fourpuzzle.gamestate.mapview.event;
7 7
8import com.fourisland.fourpuzzle.gamestate.mapview.Map;
9import java.util.concurrent.Future; 8import java.util.concurrent.Future;
10 9
11/** 10/**
@@ -22,9 +21,9 @@ public abstract class EventCall extends SpecialEvent implements Runnable {
22 } 21 }
23 }; 22 };
24 } 23 }
25
26 public abstract void run();
27 24
25 public abstract void run();
26
28 private Future isRunning = null; 27 private Future isRunning = null;
29 public void activate(EventCallTime calltime) 28 public void activate(EventCallTime calltime)
30 { 29 {
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java index 43cf626..faa7a48 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java
@@ -14,8 +14,6 @@ import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.FixedViewpoint;
14import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.MovingViewpoint; 14import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.MovingViewpoint;
15import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.Viewpoint; 15import com.fourisland.fourpuzzle.gamestate.mapview.viewpoint.Viewpoint;
16import java.util.concurrent.CountDownLatch; 16import java.util.concurrent.CountDownLatch;
17import java.util.logging.Level;
18import java.util.logging.Logger;
19 17
20/** 18/**
21 * 19 *
@@ -128,8 +126,9 @@ public class SpecialEvent {
128 126
129 /** 127 /**
130 * Waits until all previously called MoveEvent()s have finished 128 * Waits until all previously called MoveEvent()s have finished
129 * @throws InterruptedException
131 */ 130 */
132 public void MoveEventWait() 131 public void MoveEventWait() throws InterruptedException
133 { 132 {
134 MoveEventThread.moveAll(); 133 MoveEventThread.moveAll();
135 } 134 }
@@ -166,14 +165,11 @@ public class SpecialEvent {
166 * Waits for a specified interval 165 * Waits for a specified interval
167 * 166 *
168 * @param wait The time to wait in milliseconds 167 * @param wait The time to wait in milliseconds
168 * @throws InterruptedException
169 */ 169 */
170 public void Wait(int wait) 170 public void Wait(int wait) throws InterruptedException
171 { 171 {
172 try { 172 Thread.sleep(wait);
173 Thread.sleep(wait);
174 } catch (InterruptedException ex) {
175 Logger.getLogger(SpecialEvent.class.getName()).log(Level.SEVERE, null, ex);
176 }
177 } 173 }
178 174
179 /** 175 /**
@@ -193,8 +189,9 @@ public class SpecialEvent {
193 * @param length How long (in milliseconds) it will take to pan 189 * @param length How long (in milliseconds) it will take to pan
194 * @param block If true, the game will wait for the pan to complete 190 * @param block If true, the game will wait for the pan to complete
195 * before executing any more commands 191 * before executing any more commands
192 * @throws InterruptedException
196 */ 193 */
197 public void PanViewpoint(final int x, final int y, int length, final boolean block) 194 public void PanViewpoint(final int x, final int y, int length, final boolean block) throws InterruptedException
198 { 195 {
199 Viewpoint viewpoint = mapView.getViewpoint(); 196 Viewpoint viewpoint = mapView.getViewpoint();
200 final CountDownLatch blocker; 197 final CountDownLatch blocker;
@@ -220,11 +217,7 @@ public class SpecialEvent {
220 217
221 if (block) 218 if (block)
222 { 219 {
223 try { 220 blocker.await();
224 blocker.await();
225 } catch (InterruptedException ex) {
226 Logger.getLogger(SpecialEvent.class.getName()).log(Level.SEVERE, null, ex);
227 }
228 } 221 }
229 } 222 }
230 223
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/MoveEventThread.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/MoveEventThread.java index 2395dd0..d129303 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/MoveEventThread.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/MoveEventThread.java
@@ -11,8 +11,6 @@ import com.fourisland.fourpuzzle.gamestate.mapview.event.LayerEvent;
11import java.util.List; 11import java.util.List;
12import java.util.Vector; 12import java.util.Vector;
13import java.util.concurrent.Semaphore; 13import java.util.concurrent.Semaphore;
14import java.util.logging.Level;
15import java.util.logging.Logger;
16 14
17/** 15/**
18 * 16 *
@@ -37,7 +35,7 @@ public class MoveEventThread implements Runnable {
37 try { 35 try {
38 moveEventWait.acquire(); 36 moveEventWait.acquire();
39 } catch (InterruptedException ex) { 37 } catch (InterruptedException ex) {
40 Logger.getLogger(MoveEventThread.class.getName()).log(Level.SEVERE, null, ex); 38 Thread.currentThread().interrupt();
41 } 39 }
42 40
43 while (ev.isMoving()) 41 while (ev.isMoving())
@@ -45,7 +43,7 @@ public class MoveEventThread implements Runnable {
45 try { 43 try {
46 Thread.sleep(2); 44 Thread.sleep(2);
47 } catch (InterruptedException ex) { 45 } catch (InterruptedException ex) {
48 Logger.getLogger(MoveEventThread.class.getName()).log(Level.SEVERE, null, ex); 46 Thread.currentThread().interrupt();
49 } 47 }
50 } 48 }
51 49
@@ -74,14 +72,10 @@ public class MoveEventThread implements Runnable {
74 return (events.contains(event)); 72 return (events.contains(event));
75 } 73 }
76 74
77 public static void moveAll() 75 public static void moveAll() throws InterruptedException
78 { 76 {
79 try { 77 moveEventWait.acquire(100);
80 moveEventWait.acquire(100); 78 moveEventWait.release(100);
81 moveEventWait.release(100);
82 } catch (InterruptedException ex) {
83 Logger.getLogger(MoveEventThread.class.getName()).log(Level.SEVERE, null, ex);
84 }
85 } 79 }
86 80
87} 81}
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/StepMoveEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/StepMoveEvent.java index d5d830e..af50087 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/StepMoveEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/StepMoveEvent.java
@@ -7,8 +7,6 @@ package com.fourisland.fourpuzzle.gamestate.mapview.event.specialmove;
7 7
8import com.fourisland.fourpuzzle.Direction; 8import com.fourisland.fourpuzzle.Direction;
9import com.fourisland.fourpuzzle.gamestate.mapview.event.Event; 9import com.fourisland.fourpuzzle.gamestate.mapview.event.Event;
10import java.util.logging.Level;
11import java.util.logging.Logger;
12 10
13/** 11/**
14 * StepMoveEvent moves the event in the direction specified. 12 * StepMoveEvent moves the event in the direction specified.
@@ -32,7 +30,7 @@ public class StepMoveEvent implements MoveEvent {
32 try { 30 try {
33 Thread.sleep(2); 31 Thread.sleep(2);
34 } catch (InterruptedException ex) { 32 } catch (InterruptedException ex) {
35 Logger.getLogger(StepMoveEvent.class.getName()).log(Level.SEVERE, null, ex); 33 Thread.currentThread().interrupt();
36 } 34 }
37 } 35 }
38 } 36 }
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/WaitMoveEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/WaitMoveEvent.java index eb56b95..565365a 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/WaitMoveEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/WaitMoveEvent.java
@@ -6,8 +6,6 @@
6package com.fourisland.fourpuzzle.gamestate.mapview.event.specialmove; 6package com.fourisland.fourpuzzle.gamestate.mapview.event.specialmove;
7 7
8import com.fourisland.fourpuzzle.gamestate.mapview.event.Event; 8import com.fourisland.fourpuzzle.gamestate.mapview.event.Event;
9import java.util.logging.Level;
10import java.util.logging.Logger;
11 9
12/** 10/**
13 * WaitMoveEvent pauses for the specifed amount of milliseconds. 11 * WaitMoveEvent pauses for the specifed amount of milliseconds.
@@ -27,7 +25,7 @@ public class WaitMoveEvent implements MoveEvent {
27 try { 25 try {
28 Thread.sleep(wait); 26 Thread.sleep(wait);
29 } catch (InterruptedException ex) { 27 } catch (InterruptedException ex) {
30 Logger.getLogger(WaitMoveEvent.class.getName()).log(Level.SEVERE, null, ex); 28 Thread.currentThread().interrupt();
31 } 29 }
32 } 30 }
33 31
diff --git a/src/com/fourisland/fourpuzzle/transition/TransitionCallbackThread.java b/src/com/fourisland/fourpuzzle/transition/TransitionCallbackThread.java index 58ea0b5..50eacc2 100644 --- a/src/com/fourisland/fourpuzzle/transition/TransitionCallbackThread.java +++ b/src/com/fourisland/fourpuzzle/transition/TransitionCallbackThread.java
@@ -6,8 +6,6 @@
6package com.fourisland.fourpuzzle.transition; 6package com.fourisland.fourpuzzle.transition;
7 7
8import com.fourisland.fourpuzzle.Display; 8import com.fourisland.fourpuzzle.Display;
9import java.util.logging.Level;
10import java.util.logging.Logger;
11 9
12/** 10/**
13 * 11 *
@@ -28,7 +26,7 @@ public class TransitionCallbackThread implements Runnable {
28 try { 26 try {
29 Thread.sleep(300); 27 Thread.sleep(300);
30 } catch (InterruptedException ex) { 28 } catch (InterruptedException ex) {
31 Logger.getLogger(TransitionCallbackThread.class.getName()).log(Level.SEVERE, null, ex); 29 Thread.currentThread().interrupt();
32 } 30 }
33 } 31 }
34 32