summary refs log tree commit diff stats
path: root/src/com/fourisland/fourpuzzle/gamestate/mapview/event
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2009-01-24 15:25:58 -0500
committerStarla Insigna <hatkirby@fourisland.com>2009-01-24 15:25:58 -0500
commitcd6b39590b8aced78fc2f6ed0c345fb9af1960c0 (patch)
tree807bc48adeb2a78a3f1d9b93f3471012509b5e51 /src/com/fourisland/fourpuzzle/gamestate/mapview/event
parenta581d9b4136bb633771e5e881bbee5a36247b0e0 (diff)
downloadfourpuzzle-cd6b39590b8aced78fc2f6ed0c345fb9af1960c0.tar.gz
fourpuzzle-cd6b39590b8aced78fc2f6ed0c345fb9af1960c0.tar.bz2
fourpuzzle-cd6b39590b8aced78fc2f6ed0c345fb9af1960c0.zip
Replaced checked exceptions with RuntimeException
Diffstat (limited to 'src/com/fourisland/fourpuzzle/gamestate/mapview/event')
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java10
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java20
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java20
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java5
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java18
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/BlankEventGraphic.java3
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/CharSetEventGraphic.java2
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/EventGraphic.java2
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/CustomMovementType.java2
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/MovementType.java2
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/RandomMovementType.java3
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/StayStillMovementType.java2
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/HeroInPartyPrecondition.java3
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/HeroLevelPrecondition.java3
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/Precondition.java2
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/SwitchPrecondition.java3
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/VariableNumberPrecondition.java3
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/VariableVariablePrecondition.java3
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/FaceMoveEvent.java2
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/MoveEvent.java2
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/MoveEventThread.java6
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/StepMoveEvent.java10
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/WaitMoveEvent.java10
23 files changed, 73 insertions, 63 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java index 1aa74c1..fbcfd7a 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/Event.java
@@ -23,13 +23,13 @@ public interface Event {
23 public void setLocation(Point location); 23 public void setLocation(Point location);
24 public void setLocation(int x, int y); 24 public void setLocation(int x, int y);
25 25
26 public void render(Graphics g) throws Exception; 26 public void render(Graphics g);
27 27
28 public Direction getDirection() throws Exception; 28 public Direction getDirection();
29 public void setDirection(Direction direction) throws Exception; 29 public void setDirection(Direction direction);
30 30
31 public boolean isMoving(); 31 public boolean isMoving();
32 public void startMoving(Direction direction) throws Exception; 32 public void startMoving(Direction direction);
33 33
34 public Layer getLayer() throws Exception; 34 public Layer getLayer();
35} 35}
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java index 3bdb9de..50e16c8 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/HeroEvent.java
@@ -12,7 +12,6 @@ import com.fourisland.fourpuzzle.Direction;
12import com.fourisland.fourpuzzle.Game; 12import com.fourisland.fourpuzzle.Game;
13import com.fourisland.fourpuzzle.GameCharacter; 13import com.fourisland.fourpuzzle.GameCharacter;
14import com.fourisland.fourpuzzle.gamestate.mapview.CharSet; 14import com.fourisland.fourpuzzle.gamestate.mapview.CharSet;
15import com.fourisland.fourpuzzle.NoCharactersInPartyException;
16 15
17/** 16/**
18 * 17 *
@@ -44,7 +43,7 @@ public class HeroEvent implements Event {
44 location.setLocation(x, y); 43 location.setLocation(x, y);
45 } 44 }
46 45
47 public void render(Graphics g) throws Exception 46 public void render(Graphics g)
48 { 47 {
49 int x = (location.x * 16) - 4; 48 int x = (location.x * 16) - 4;
50 int y = (location.y * 16) - 16; 49 int y = (location.y * 16) - 16;
@@ -66,15 +65,10 @@ public class HeroEvent implements Event {
66 } 65 }
67 } 66 }
68 67
69 try 68 GameCharacter toDraw = Game.getSaveFile().getParty().getLeader();
70 { 69 if (!toDraw.getGraphic().equals("blank"))
71 GameCharacter toDraw = Game.getSaveFile().getParty().getLeader();
72 if (!toDraw.getGraphic().equals("blank"))
73 {
74 g.drawImage(CharSet.getCharSet(toDraw.getGraphic()).getImage(toDraw.getGraphicOffset(), direction, animationStep), x, y, null);
75 }
76 } catch (NoCharactersInPartyException ex)
77 { 70 {
71 g.drawImage(CharSet.getCharSet(toDraw.getGraphic()).getImage(toDraw.getGraphicOffset(), direction, animationStep), x, y, null);
78 } 72 }
79 } 73 }
80 74
@@ -91,7 +85,7 @@ public class HeroEvent implements Event {
91 85
92 private int moveTimer; 86 private int moveTimer;
93 private Direction moveDirection; 87 private Direction moveDirection;
94 public void startMoving(Direction toMove) throws Exception 88 public void startMoving(Direction toMove)
95 { 89 {
96 setDirection(toMove); 90 setDirection(toMove);
97 setAnimationStep(2); 91 setAnimationStep(2);
@@ -99,7 +93,7 @@ public class HeroEvent implements Event {
99 moving = true; 93 moving = true;
100 moveDirection = toMove; 94 moveDirection = toMove;
101 } 95 }
102 public void processMoving() throws Exception 96 public void processMoving()
103 { 97 {
104 if (moving) 98 if (moving)
105 { 99 {
@@ -149,7 +143,7 @@ public class HeroEvent implements Event {
149 this.animationStep = animationStep; 143 this.animationStep = animationStep;
150 } 144 }
151 145
152 public Layer getLayer() throws Exception 146 public Layer getLayer()
153 { 147 {
154 return Layer.Middle; 148 return Layer.Middle;
155 } 149 }
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java index b67f2aa..05192ce 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/LayerEvent.java
@@ -68,7 +68,7 @@ public class LayerEvent implements Event {
68 events.add(pe); 68 events.add(pe);
69 } 69 }
70 70
71 private PossibleEvent getPossibleEvent() throws Exception 71 private PossibleEvent getPossibleEvent()
72 { 72 {
73 int i; 73 int i;
74 for (i=(events.size()-1);i>-1;i--) 74 for (i=(events.size()-1);i>-1;i--)
@@ -89,7 +89,7 @@ public class LayerEvent implements Event {
89 return new PossibleEvent(); 89 return new PossibleEvent();
90 } 90 }
91 91
92 public void render(Graphics g) throws Exception 92 public void render(Graphics g)
93 { 93 {
94 int x = (location.x * 16) - 4; 94 int x = (location.x * 16) - 4;
95 int y = (location.y * 16) - 16; 95 int y = (location.y * 16) - 16;
@@ -131,7 +131,7 @@ public class LayerEvent implements Event {
131 131
132 private int moveTimer; 132 private int moveTimer;
133 private Direction moveDirection; 133 private Direction moveDirection;
134 public void startMoving(Map map) throws Exception 134 public void startMoving(Map map)
135 { 135 {
136 Direction toMove = getPossibleEvent().getMovement().startMoving(); 136 Direction toMove = getPossibleEvent().getMovement().startMoving();
137 137
@@ -143,7 +143,7 @@ public class LayerEvent implements Event {
143 } 143 }
144 } 144 }
145 } 145 }
146 public void startMoving(Direction toMove) throws Exception 146 public void startMoving(Direction toMove)
147 { 147 {
148 getPossibleEvent().setDirection(toMove); 148 getPossibleEvent().setDirection(toMove);
149 getPossibleEvent().setAnimationStep(2); 149 getPossibleEvent().setAnimationStep(2);
@@ -151,7 +151,7 @@ public class LayerEvent implements Event {
151 moving = true; 151 moving = true;
152 moveDirection = toMove; 152 moveDirection = toMove;
153 } 153 }
154 public void processMoving() throws Exception 154 public void processMoving()
155 { 155 {
156 if (moving) 156 if (moving)
157 { 157 {
@@ -181,26 +181,26 @@ public class LayerEvent implements Event {
181 } 181 }
182 } 182 }
183 183
184 public Direction getDirection() throws Exception 184 public Direction getDirection()
185 { 185 {
186 return getPossibleEvent().getDirection(); 186 return getPossibleEvent().getDirection();
187 } 187 }
188 public void setDirection(Direction direction) throws Exception 188 public void setDirection(Direction direction)
189 { 189 {
190 getPossibleEvent().setDirection(direction); 190 getPossibleEvent().setDirection(direction);
191 } 191 }
192 192
193 public Layer getLayer() throws Exception 193 public Layer getLayer()
194 { 194 {
195 return getPossibleEvent().getLayer(); 195 return getPossibleEvent().getLayer();
196 } 196 }
197 197
198 public EventCallTime getCalltime() throws Exception 198 public EventCallTime getCalltime()
199 { 199 {
200 return getPossibleEvent().getCalltime(); 200 return getPossibleEvent().getCalltime();
201 } 201 }
202 202
203 public EventCall getCallback() throws Exception 203 public EventCall getCallback()
204 { 204 {
205 return getPossibleEvent().getCallback(); 205 return getPossibleEvent().getCallback();
206 } 206 }
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java index ce9773f..c18385d 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/PossibleEvent.java
@@ -47,7 +47,7 @@ public class PossibleEvent {
47 animationStep = 1; 47 animationStep = 1;
48 } 48 }
49 49
50 public BufferedImage getImage() throws Exception 50 public BufferedImage getImage()
51 { 51 {
52 return graphic.getImage(); 52 return graphic.getImage();
53 } 53 }
@@ -88,7 +88,8 @@ public class PossibleEvent {
88 return direction; 88 return direction;
89 } 89 }
90 90
91 public void setDirection(Direction direction) throws Exception { 91 public void setDirection(Direction direction)
92 {
92 if (Functions.canTurn(this)) 93 if (Functions.canTurn(this))
93 { 94 {
94 this.direction = direction; 95 this.direction = direction;
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java index 121bbe8..077f42e 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/SpecialEvent.java
@@ -129,18 +129,16 @@ public class SpecialEvent {
129 129
130 /** 130 /**
131 * Triggers the Game Over sequence 131 * Triggers the Game Over sequence
132 * @throws Exception
133 */ 132 */
134 public void GameOver() throws Exception 133 public void GameOver()
135 { 134 {
136 throw new UnsupportedOperationException("Not yet implemented"); 135 throw new UnsupportedOperationException("Not yet implemented");
137 } 136 }
138 137
139 /** 138 /**
140 * Returns the player to the Title Screen 139 * Returns the player to the Title Screen
141 * @throws Exception
142 */ 140 */
143 public void TitleScreen() throws Exception 141 public void TitleScreen()
144 { 142 {
145 throw new UnsupportedOperationException("Not yet implemented"); 143 throw new UnsupportedOperationException("Not yet implemented");
146 } 144 }
@@ -151,9 +149,8 @@ public class SpecialEvent {
151 * @param map The name of the map to move to 149 * @param map The name of the map to move to
152 * @param x The X position on the map to move to 150 * @param x The X position on the map to move to
153 * @param y The Y position on the map to move to 151 * @param y The Y position on the map to move to
154 * @throws java.lang.Exception
155 */ 152 */
156 public void Teleport(String map, int x, int y) throws Exception 153 public void Teleport(String map, int x, int y)
157 { 154 {
158 throw new UnsupportedOperationException("Not yet implemented"); 155 throw new UnsupportedOperationException("Not yet implemented");
159 } 156 }
@@ -162,11 +159,14 @@ public class SpecialEvent {
162 * Waits for a specified interval 159 * Waits for a specified interval
163 * 160 *
164 * @param wait The time to wait in milliseconds 161 * @param wait The time to wait in milliseconds
165 * @throws java.lang.InterruptedException
166 */ 162 */
167 public void Wait(int wait) throws InterruptedException 163 public void Wait(int wait)
168 { 164 {
169 Thread.sleep(wait); 165 try {
166 Thread.sleep(wait);
167 } catch (InterruptedException ex) {
168 Logger.getLogger(SpecialEvent.class.getName()).log(Level.SEVERE, null, ex);
169 }
170 } 170 }
171 171
172} 172}
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/BlankEventGraphic.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/BlankEventGraphic.java index 592c8a7..1f317f8 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/BlankEventGraphic.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/BlankEventGraphic.java
@@ -17,7 +17,8 @@ public class BlankEventGraphic implements EventGraphic {
17 private Direction direction; 17 private Direction direction;
18 private int animationStep; 18 private int animationStep;
19 19
20 public BufferedImage getImage() throws Exception { 20 public BufferedImage getImage()
21 {
21 return null; 22 return null;
22 } 23 }
23 24
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/CharSetEventGraphic.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/CharSetEventGraphic.java index b71a0b8..a2e8831 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/CharSetEventGraphic.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/CharSetEventGraphic.java
@@ -26,7 +26,7 @@ public class CharSetEventGraphic implements EventGraphic {
26 this.graphicOffset = graphicOffset; 26 this.graphicOffset = graphicOffset;
27 } 27 }
28 28
29 public BufferedImage getImage() throws Exception 29 public BufferedImage getImage()
30 { 30 {
31 return CharSet.getCharSet(getGraphic()).getImage(getGraphicOffset(), getDirection(), getAnimationStep()); 31 return CharSet.getCharSet(getGraphic()).getImage(getGraphicOffset(), getDirection(), getAnimationStep());
32 } 32 }
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/EventGraphic.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/EventGraphic.java index 60afca5..7e83dd9 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/EventGraphic.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/graphic/EventGraphic.java
@@ -14,7 +14,7 @@ import java.awt.image.BufferedImage;
14 */ 14 */
15public interface EventGraphic { 15public interface EventGraphic {
16 16
17 public BufferedImage getImage() throws Exception; 17 public BufferedImage getImage();
18 18
19 public Direction getDirection(); 19 public Direction getDirection();
20 public void setDirection(Direction direction); 20 public void setDirection(Direction direction);
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/CustomMovementType.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/CustomMovementType.java index 3e3773f..5a82f91 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/CustomMovementType.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/CustomMovementType.java
@@ -21,7 +21,7 @@ public class CustomMovementType implements MovementType {
21 this.moves = moves; 21 this.moves = moves;
22 } 22 }
23 23
24 public Direction startMoving() throws Exception 24 public Direction startMoving()
25 { 25 {
26 if (step >= moves.length) 26 if (step >= moves.length)
27 { 27 {
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/MovementType.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/MovementType.java index 4911a54..5d5822e 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/MovementType.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/MovementType.java
@@ -13,7 +13,7 @@ import com.fourisland.fourpuzzle.Direction;
13 */ 13 */
14public interface MovementType { 14public interface MovementType {
15 15
16 public Direction startMoving() throws Exception; 16 public Direction startMoving();
17 17
18} 18}
19 19
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/RandomMovementType.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/RandomMovementType.java index d0d96ce..b714ced 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/RandomMovementType.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/RandomMovementType.java
@@ -14,7 +14,8 @@ import java.util.Random;
14 */ 14 */
15public class RandomMovementType implements MovementType { 15public class RandomMovementType implements MovementType {
16 16
17 public Direction startMoving() throws Exception { 17 public Direction startMoving()
18 {
18 Random r = new Random(); 19 Random r = new Random();
19 int ra = r.nextInt(1000); 20 int ra = r.nextInt(1000);
20 Direction toMove = null; 21 Direction toMove = null;
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/StayStillMovementType.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/StayStillMovementType.java index a34a1f1..1f2a49c 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/StayStillMovementType.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/movement/StayStillMovementType.java
@@ -13,7 +13,7 @@ import com.fourisland.fourpuzzle.Direction;
13 */ 13 */
14public class StayStillMovementType implements MovementType { 14public class StayStillMovementType implements MovementType {
15 15
16 public Direction startMoving() throws Exception 16 public Direction startMoving()
17 { 17 {
18 return null; // Do nothing, stay still 18 return null; // Do nothing, stay still
19 } 19 }
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/HeroInPartyPrecondition.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/HeroInPartyPrecondition.java index 7700674..0c0af20 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/HeroInPartyPrecondition.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/HeroInPartyPrecondition.java
@@ -20,7 +20,8 @@ public class HeroInPartyPrecondition implements Precondition {
20 this.heroName = heroName; 20 this.heroName = heroName;
21 } 21 }
22 22
23 public boolean match() { 23 public boolean match()
24 {
24 return Game.getSaveFile().getParty().exists(heroName); 25 return Game.getSaveFile().getParty().exists(heroName);
25 } 26 }
26 27
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/HeroLevelPrecondition.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/HeroLevelPrecondition.java index 1b10e91..ae8183d 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/HeroLevelPrecondition.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/HeroLevelPrecondition.java
@@ -22,7 +22,8 @@ public class HeroLevelPrecondition implements Precondition {
22 this.level = level; 22 this.level = level;
23 } 23 }
24 24
25 public boolean match() throws Exception { 25 public boolean match()
26 {
26 return (Game.getSaveFile().getParty().exists(heroName) && (Game.getSaveFile().getParty().get(heroName).getLevel() == level)); 27 return (Game.getSaveFile().getParty().exists(heroName) && (Game.getSaveFile().getParty().get(heroName).getLevel() == level));
27 } 28 }
28 29
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/Precondition.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/Precondition.java index 3f75984..b275100 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/Precondition.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/Precondition.java
@@ -11,6 +11,6 @@ package com.fourisland.fourpuzzle.gamestate.mapview.event.precondition;
11 */ 11 */
12public interface Precondition { 12public interface Precondition {
13 13
14 public boolean match() throws Exception; 14 public boolean match();
15 15
16} 16}
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/SwitchPrecondition.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/SwitchPrecondition.java index 794eae4..7bccadf 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/SwitchPrecondition.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/SwitchPrecondition.java
@@ -20,7 +20,8 @@ public class SwitchPrecondition implements Precondition {
20 this.switchID = switchID; 20 this.switchID = switchID;
21 } 21 }
22 22
23 public boolean match() { 23 public boolean match()
24 {
24 return (Game.getSaveFile().getSwitches().containsKey(switchID) && Game.getSaveFile().getSwitches().get(switchID)); 25 return (Game.getSaveFile().getSwitches().containsKey(switchID) && Game.getSaveFile().getSwitches().get(switchID));
25 } 26 }
26 27
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/VariableNumberPrecondition.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/VariableNumberPrecondition.java index a3ce086..afedadd 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/VariableNumberPrecondition.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/VariableNumberPrecondition.java
@@ -25,7 +25,8 @@ public class VariableNumberPrecondition implements Precondition {
25 this.number = number; 25 this.number = number;
26 } 26 }
27 27
28 public boolean match() { 28 public boolean match()
29 {
29 if (Game.getSaveFile().getVariables().containsKey(variableID)) 30 if (Game.getSaveFile().getVariables().containsKey(variableID))
30 { 31 {
31 int n1 = Game.getSaveFile().getVariables().get(variableID); 32 int n1 = Game.getSaveFile().getVariables().get(variableID);
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/VariableVariablePrecondition.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/VariableVariablePrecondition.java index 1eb9b0c..dbdf019 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/VariableVariablePrecondition.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/precondition/VariableVariablePrecondition.java
@@ -25,7 +25,8 @@ public class VariableVariablePrecondition implements Precondition {
25 this.variableID2 = variableID2; 25 this.variableID2 = variableID2;
26 } 26 }
27 27
28 public boolean match() { 28 public boolean match()
29 {
29 if (Game.getSaveFile().getVariables().containsKey(variableID)) 30 if (Game.getSaveFile().getVariables().containsKey(variableID))
30 { 31 {
31 int n1 = Game.getSaveFile().getVariables().get(variableID); 32 int n1 = Game.getSaveFile().getVariables().get(variableID);
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/FaceMoveEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/FaceMoveEvent.java index a9dc891..fcc0a7a 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/FaceMoveEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/FaceMoveEvent.java
@@ -20,7 +20,7 @@ public class FaceMoveEvent implements MoveEvent {
20 this.direction = direction; 20 this.direction = direction;
21 } 21 }
22 22
23 public void doAction(Event ev) throws Exception 23 public void doAction(Event ev)
24 { 24 {
25 ev.setDirection(direction); 25 ev.setDirection(direction);
26 } 26 }
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/MoveEvent.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/MoveEvent.java index 66c9f6d..1d64d9e 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/MoveEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/MoveEvent.java
@@ -14,6 +14,6 @@ import com.fourisland.fourpuzzle.gamestate.mapview.event.Event;
14 */ 14 */
15public interface MoveEvent { 15public interface MoveEvent {
16 16
17 public void doAction(Event ev) throws Exception; 17 public void doAction(Event ev);
18 18
19} 19}
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 d6971f3..ab160f1 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/MoveEventThread.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/MoveEventThread.java
@@ -42,11 +42,7 @@ public class MoveEventThread implements Runnable {
42 42
43 for (MoveEvent action : actions) 43 for (MoveEvent action : actions)
44 { 44 {
45 try { 45 action.doAction(ev);
46 action.doAction(ev);
47 } catch (Exception ex) {
48 Logger.getLogger(MoveEventThread.class.getName()).log(Level.SEVERE, null, ex);
49 }
50 } 46 }
51 47
52 events.remove(ev); 48 events.remove(ev);
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 12b2421..74affc4 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/StepMoveEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/StepMoveEvent.java
@@ -7,6 +7,8 @@ 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;
10 12
11/** 13/**
12 * 14 *
@@ -20,13 +22,17 @@ public class StepMoveEvent implements MoveEvent {
20 this.direction = direction; 22 this.direction = direction;
21 } 23 }
22 24
23 public void doAction(Event ev) throws Exception 25 public void doAction(Event ev)
24 { 26 {
25 ev.startMoving(direction); 27 ev.startMoving(direction);
26 28
27 while (ev.isMoving()) 29 while (ev.isMoving())
28 { 30 {
29 Thread.sleep(2); 31 try {
32 Thread.sleep(2);
33 } catch (InterruptedException ex) {
34 Logger.getLogger(StepMoveEvent.class.getName()).log(Level.SEVERE, null, ex);
35 }
30 } 36 }
31 } 37 }
32 38
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 d9823d5..1464bcd 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/WaitMoveEvent.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/specialmove/WaitMoveEvent.java
@@ -6,6 +6,8 @@
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;
9 11
10/** 12/**
11 * 13 *
@@ -19,9 +21,13 @@ public class WaitMoveEvent implements MoveEvent {
19 this.wait = wait; 21 this.wait = wait;
20 } 22 }
21 23
22 public void doAction(Event ev) throws Exception 24 public void doAction(Event ev)
23 { 25 {
24 Thread.sleep(wait); 26 try {
27 Thread.sleep(wait);
28 } catch (InterruptedException ex) {
29 Logger.getLogger(WaitMoveEvent.class.getName()).log(Level.SEVERE, null, ex);
30 }
25 } 31 }
26 32
27} 33}