summary refs log tree commit diff stats
path: root/src/com/fourisland
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/fourisland')
-rw-r--r--src/com/fourisland/fourpuzzle/Audio.java68
-rw-r--r--src/com/fourisland/fourpuzzle/Display.java4
-rw-r--r--src/com/fourisland/fourpuzzle/Game.java2
-rw-r--r--src/com/fourisland/fourpuzzle/GameCharacters.java2
-rw-r--r--src/com/fourisland/fourpuzzle/NoCharactersInPartyException.java14
-rw-r--r--src/com/fourisland/fourpuzzle/PuzzleApplication.java54
-rw-r--r--src/com/fourisland/fourpuzzle/SaveFile.java24
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/GameOverGameState.java13
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/GameState.java10
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/TitleScreenGameState.java13
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/CharSet.java3
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/ChipSet.java30
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/Map.java4
-rw-r--r--src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java38
-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
-rw-r--r--src/com/fourisland/fourpuzzle/transition/SquareTransition.java2
-rw-r--r--src/com/fourisland/fourpuzzle/transition/Transition.java3
-rw-r--r--src/com/fourisland/fourpuzzle/transition/TransitionUnsupportedException.java2
-rw-r--r--src/com/fourisland/fourpuzzle/util/Functions.java4
-rw-r--r--src/com/fourisland/fourpuzzle/util/ObjectLoader.java59
-rw-r--r--src/com/fourisland/fourpuzzle/util/ResourceNotFoundException.java29
43 files changed, 320 insertions, 194 deletions
diff --git a/src/com/fourisland/fourpuzzle/Audio.java b/src/com/fourisland/fourpuzzle/Audio.java index 39ce3d8..bc34eda 100644 --- a/src/com/fourisland/fourpuzzle/Audio.java +++ b/src/com/fourisland/fourpuzzle/Audio.java
@@ -6,7 +6,11 @@
6package com.fourisland.fourpuzzle; 6package com.fourisland.fourpuzzle;
7 7
8import com.fourisland.fourpuzzle.util.ObjectLoader; 8import com.fourisland.fourpuzzle.util.ObjectLoader;
9import java.util.logging.Level;
10import java.util.logging.Logger;
11import javax.sound.midi.InvalidMidiDataException;
9import javax.sound.midi.MidiSystem; 12import javax.sound.midi.MidiSystem;
13import javax.sound.midi.MidiUnavailableException;
10import javax.sound.midi.Sequencer; 14import javax.sound.midi.Sequencer;
11 15
12/** 16/**
@@ -17,57 +21,61 @@ public class Audio {
17 21
18 private static Sequencer seq; 22 private static Sequencer seq;
19 23
20 public static void init() throws Exception 24 public static void init()
21 { 25 {
22 seq = MidiSystem.getSequencer(); 26 try {
23 seq.open(); 27 seq = MidiSystem.getSequencer();
28 seq.open();
24 29
25 Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { 30 Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
26 public void run() { 31 public void run() {
27 if (seq.isRunning()) 32 if (seq.isRunning()) {
28 { 33 seq.stop();
29 seq.stop(); 34 }
30 }
31 35
32 seq.close(); 36 seq.close();
33 } 37 }
34 })); 38 }));
39 } catch (MidiUnavailableException ex) {
40 Logger.getLogger(Audio.class.getName()).log(Level.SEVERE, null, ex);
41 }
35 } 42 }
36 43
37 public static void playMusic(String file) throws Exception 44 public static void playMusic(String file)
38 { 45 {
39 playMusic(file, true, 1F); 46 playMusic(file, true, 1F);
40 } 47 }
41 48
42 public static void playMusic(String file, boolean loop) throws Exception 49 public static void playMusic(String file, boolean loop)
43 { 50 {
44 playMusic(file, loop, 1F); 51 playMusic(file, loop, 1F);
45 } 52 }
46 53
47 public static void playMusic(String file, boolean loop, float speed) throws Exception 54 public static void playMusic(String file, boolean loop, float speed)
48 { 55 {
49 seq.setSequence(ObjectLoader.getMusic(file)); 56 try {
57 seq.setSequence(ObjectLoader.getMusic(file));
50 58
51 if (loop) 59 if (loop) {
52 { 60 seq.setLoopCount(seq.LOOP_CONTINUOUSLY);
53 seq.setLoopCount(seq.LOOP_CONTINUOUSLY); 61 } else {
54 } else { 62 seq.setLoopCount(0);
55 seq.setLoopCount(0); 63 }
64
65 seq.setTempoFactor(speed);
66
67 seq.start();
68 } catch (InvalidMidiDataException ex) {
69 Logger.getLogger(Audio.class.getName()).log(Level.SEVERE, null, ex);
56 } 70 }
57
58 seq.setTempoFactor(speed);
59
60 seq.start();
61 } 71 }
62 72
63 public static void stopMusic() throws Exception 73 public static void stopMusic()
64 { 74 {
65 if (seq == null) 75 if (seq != null)
66 { 76 {
67 init(); 77 seq.stop();
68 } 78 }
69
70 seq.stop();
71 } 79 }
72 80
73} 81}
diff --git a/src/com/fourisland/fourpuzzle/Display.java b/src/com/fourisland/fourpuzzle/Display.java index 45e6c22..6fab3ea 100644 --- a/src/com/fourisland/fourpuzzle/Display.java +++ b/src/com/fourisland/fourpuzzle/Display.java
@@ -21,7 +21,7 @@ public class Display {
21 21
22 public static int tileAnimationFrame = 0; 22 public static int tileAnimationFrame = 0;
23 23
24 public static void render(JDialog gameFrame) throws Exception 24 public static void render(JDialog gameFrame)
25 { 25 {
26 if (enabled) 26 if (enabled)
27 { 27 {
@@ -57,7 +57,7 @@ public class Display {
57 } 57 }
58 } 58 }
59 59
60 private static void render(JDialog gameFrame, VolatileImage vImg) throws Exception 60 private static void render(JDialog gameFrame, VolatileImage vImg)
61 { 61 {
62 if (vImg.validate(gameFrame.getGraphicsConfiguration()) == VolatileImage.IMAGE_INCOMPATIBLE) 62 if (vImg.validate(gameFrame.getGraphicsConfiguration()) == VolatileImage.IMAGE_INCOMPATIBLE)
63 { 63 {
diff --git a/src/com/fourisland/fourpuzzle/Game.java b/src/com/fourisland/fourpuzzle/Game.java index 3e79dc5..0788a75 100644 --- a/src/com/fourisland/fourpuzzle/Game.java +++ b/src/com/fourisland/fourpuzzle/Game.java
@@ -33,7 +33,7 @@ public class Game {
33 { 33 {
34 return gameState; 34 return gameState;
35 } 35 }
36 public static void setGameState(GameState gameState) throws Exception 36 public static void setGameState(GameState gameState)
37 { 37 {
38 if (Game.gameState != null) 38 if (Game.gameState != null)
39 { 39 {
diff --git a/src/com/fourisland/fourpuzzle/GameCharacters.java b/src/com/fourisland/fourpuzzle/GameCharacters.java index 2a3b050..933b333 100644 --- a/src/com/fourisland/fourpuzzle/GameCharacters.java +++ b/src/com/fourisland/fourpuzzle/GameCharacters.java
@@ -30,7 +30,7 @@ public class GameCharacters extends ArrayList<GameCharacter>
30 return temp; 30 return temp;
31 } 31 }
32 32
33 public GameCharacter getLeader() throws Exception 33 public GameCharacter getLeader()
34 { 34 {
35 for (GameCharacter chara : this) 35 for (GameCharacter chara : this)
36 { 36 {
diff --git a/src/com/fourisland/fourpuzzle/NoCharactersInPartyException.java b/src/com/fourisland/fourpuzzle/NoCharactersInPartyException.java deleted file mode 100644 index 5d6d457..0000000 --- a/src/com/fourisland/fourpuzzle/NoCharactersInPartyException.java +++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5
6package com.fourisland.fourpuzzle;
7
8/**
9 *
10 * @author hatkirby
11 */
12public class NoCharactersInPartyException extends Exception {
13
14}
diff --git a/src/com/fourisland/fourpuzzle/PuzzleApplication.java b/src/com/fourisland/fourpuzzle/PuzzleApplication.java index 7a9aa6f..6fbe3a0 100644 --- a/src/com/fourisland/fourpuzzle/PuzzleApplication.java +++ b/src/com/fourisland/fourpuzzle/PuzzleApplication.java
@@ -130,27 +130,10 @@ public class PuzzleApplication extends Application {
130 } 130 }
131 } 131 }
132 } 132 }
133 } catch (Throwable ex) { 133 } catch (RuntimeException ex) {
134 JFrame errorBox = new JFrame(ex.getClass().getSimpleName()); 134 reportError(ex);
135 JLabel text = new JLabel(); 135 } catch (Error ex) {
136 text.setText("<HTML><CENTER>I'm sorry, but " + INSTANCE.getContext().getResourceMap().getString("Application.title") + 136 reportError(ex);
137 " has run into an error and been forced to quit.<BR>Your save file has not been kept. The error was:<BR><BR>" +
138 ex.getMessage() + "</CENTER>");
139 if (ex instanceof Error)
140 {
141 text.setText(text.getText() + "<P><CENTER>We have identified this problem as a serious error in the game.");
142 }
143 errorBox.add(text);
144 errorBox.addWindowListener(new WindowAdapter() {
145 @Override
146 public void windowClosing(WindowEvent e) {
147 System.exit(0);
148 }
149 });
150 errorBox.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
151 errorBox.pack();
152 errorBox.setVisible(true);
153 ex.printStackTrace();
154 } 137 }
155 } 138 }
156 },"GameCycle").start(); 139 },"GameCycle").start();
@@ -160,4 +143,33 @@ public class PuzzleApplication extends Application {
160 { 143 {
161 return INSTANCE.getContext().getResourceMap().getString("Application.package"); 144 return INSTANCE.getContext().getResourceMap().getString("Application.package");
162 } 145 }
146
147 public void reportError(Throwable ex)
148 {
149 if ((ex instanceof Exception) && !(ex instanceof RuntimeException))
150 {
151 return;
152 }
153
154 JFrame errorBox = new JFrame(ex.getClass().getSimpleName());
155 JLabel text = new JLabel();
156 text.setText("<HTML><CENTER>I'm sorry, but " + INSTANCE.getContext().getResourceMap().getString("Application.title") +
157 " has run into an error and been forced to quit.<BR>Your save file has not been kept. The error was:<BR><BR>" +
158 ex.getMessage() + "</CENTER>");
159 if (ex instanceof Error)
160 {
161 text.setText(text.getText() + "<P><CENTER>We have identified this problem as a serious error in the game.");
162 }
163 errorBox.add(text);
164 errorBox.addWindowListener(new WindowAdapter() {
165 @Override
166 public void windowClosing(WindowEvent e) {
167 System.exit(0);
168 }
169 });
170 errorBox.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
171 errorBox.pack();
172 errorBox.setVisible(true);
173 ex.printStackTrace();
174 }
163} 175}
diff --git a/src/com/fourisland/fourpuzzle/SaveFile.java b/src/com/fourisland/fourpuzzle/SaveFile.java index 27a5662..6e3e441 100644 --- a/src/com/fourisland/fourpuzzle/SaveFile.java +++ b/src/com/fourisland/fourpuzzle/SaveFile.java
@@ -12,6 +12,8 @@ import java.io.ObjectOutputStream;
12import java.io.OutputStream; 12import java.io.OutputStream;
13import java.io.Serializable; 13import java.io.Serializable;
14import java.util.HashMap; 14import java.util.HashMap;
15import java.util.logging.Level;
16import java.util.logging.Logger;
15 17
16/** 18/**
17 * 19 *
@@ -21,9 +23,8 @@ public class SaveFile implements Serializable {
21 23
22 /** 24 /**
23 * Creates a new SaveFile 25 * Creates a new SaveFile
24 * @throws java.lang.CloneNotSupportedException
25 */ 26 */
26 public SaveFile() throws CloneNotSupportedException 27 public SaveFile()
27 { 28 {
28 switches = new HashMap<String, Boolean>(); 29 switches = new HashMap<String, Boolean>();
29 party = GameCharacters.createParty(); 30 party = GameCharacters.createParty();
@@ -35,21 +36,28 @@ public class SaveFile implements Serializable {
35 /** 36 /**
36 * Loads a SaveFile 37 * Loads a SaveFile
37 * @param file The ID of the SaveFile to load 38 * @param file The ID of the SaveFile to load
38 * @throws java.io.IOException 39 * @throws IOException if the SaveFile specified does not exist
39 * @throws java.lang.ClassNotFoundException
40 */ 40 */
41 public SaveFile(int file) throws IOException, ClassNotFoundException 41 public SaveFile(int file) throws IOException
42 { 42 {
43 InputStream is = PuzzleApplication.INSTANCE.getContext().getLocalStorage().openInputFile("Save" + file + ".sav"); 43 InputStream is = PuzzleApplication.INSTANCE.getContext().getLocalStorage().openInputFile("Save" + file + ".sav");
44 ObjectInputStream ois = new ObjectInputStream(is); 44 ObjectInputStream ois = new ObjectInputStream(is);
45 SaveFile temp = (SaveFile) ois.readObject(); 45 SaveFile temp = null;
46 46 try {
47 temp = (SaveFile) ois.readObject();
48 } catch (IOException ex) {
49 Logger.getLogger(SaveFile.class.getName()).log(Level.SEVERE, null, ex);
50 } catch (ClassNotFoundException ex) {
51 Logger.getLogger(SaveFile.class.getName()).log(Level.SEVERE, null, ex);
52 }
53
47 switches = temp.getSwitches(); 54 switches = temp.getSwitches();
48 variables = temp.getVariables(); 55 variables = temp.getVariables();
49 party = temp.getParty(); 56 party = temp.getParty();
50 currentMap = temp.getCurrentMap(); 57 currentMap = temp.getCurrentMap();
51 58
52 ois.close(); 59 ois.close();
60 is.close();
53 } 61 }
54 62
55 public void saveGame(int file) throws IOException 63 public void saveGame(int file) throws IOException
diff --git a/src/com/fourisland/fourpuzzle/gamestate/GameOverGameState.java b/src/com/fourisland/fourpuzzle/gamestate/GameOverGameState.java index ebff457..48706ad 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/GameOverGameState.java +++ b/src/com/fourisland/fourpuzzle/gamestate/GameOverGameState.java
@@ -22,17 +22,18 @@ import java.util.logging.Logger;
22 */ 22 */
23public class GameOverGameState implements GameState { 23public class GameOverGameState implements GameState {
24 24
25 public void initalize() throws Exception 25 public void initalize()
26 { 26 {
27 Audio.playMusic("GameOver"); 27 Audio.playMusic("GameOver");
28 } 28 }
29 29
30 public void deinitalize() throws Exception 30 public void deinitalize()
31 { 31 {
32 Audio.stopMusic(); 32 Audio.stopMusic();
33 } 33 }
34 34
35 public void processInput() throws Exception { 35 public void processInput()
36 {
36 if ((Game.getKey().getKeyCode() == KeyEvent.VK_ENTER) || (Game.getKey().getKeyCode() == KeyEvent.VK_SPACE)) 37 if ((Game.getKey().getKeyCode() == KeyEvent.VK_ENTER) || (Game.getKey().getKeyCode() == KeyEvent.VK_SPACE))
37 { 38 {
38 Game.setSaveFile(new SaveFile()); 39 Game.setSaveFile(new SaveFile());
@@ -49,11 +50,13 @@ public class GameOverGameState implements GameState {
49 } 50 }
50 } 51 }
51 52
52 public void doGameCycle() throws Exception { 53 public void doGameCycle()
54 {
53 // Do nothing 55 // Do nothing
54 } 56 }
55 57
56 public void render(Graphics2D g) throws Exception { 58 public void render(Graphics2D g)
59 {
57 g.drawImage(ObjectLoader.getImage("Picture", "GameOver"), 0, 0, null); 60 g.drawImage(ObjectLoader.getImage("Picture", "GameOver"), 0, 0, null);
58 } 61 }
59 62
diff --git a/src/com/fourisland/fourpuzzle/gamestate/GameState.java b/src/com/fourisland/fourpuzzle/gamestate/GameState.java index 362631d..de4d7de 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/GameState.java +++ b/src/com/fourisland/fourpuzzle/gamestate/GameState.java
@@ -13,12 +13,12 @@ import java.awt.Graphics2D;
13 */ 13 */
14public interface GameState { 14public interface GameState {
15 15
16 public void initalize() throws Exception; 16 public void initalize();
17 public void deinitalize() throws Exception; 17 public void deinitalize();
18 18
19 public void processInput() throws Exception; 19 public void processInput();
20 public void doGameCycle() throws Exception; 20 public void doGameCycle();
21 public void render(Graphics2D g) throws Exception; 21 public void render(Graphics2D g);
22 22
23} 23}
24 24
diff --git a/src/com/fourisland/fourpuzzle/gamestate/TitleScreenGameState.java b/src/com/fourisland/fourpuzzle/gamestate/TitleScreenGameState.java index 1f9c376..683b361 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/TitleScreenGameState.java +++ b/src/com/fourisland/fourpuzzle/gamestate/TitleScreenGameState.java
@@ -17,17 +17,18 @@ import java.awt.event.KeyEvent;
17 */ 17 */
18public class TitleScreenGameState implements GameState { 18public class TitleScreenGameState implements GameState {
19 19
20 public void initalize() throws Exception 20 public void initalize()
21 { 21 {
22 Audio.playMusic("Opening"); 22 Audio.playMusic("Opening");
23 } 23 }
24 24
25 public void deinitalize() throws Exception 25 public void deinitalize()
26 { 26 {
27 Audio.stopMusic(); 27 Audio.stopMusic();
28 } 28 }
29 29
30 public void processInput() throws Exception { 30 public void processInput()
31 {
31 if (Game.getKey().getKeyCode() == KeyEvent.VK_ENTER) 32 if (Game.getKey().getKeyCode() == KeyEvent.VK_ENTER)
32 { 33 {
33 Game.setSaveFile(new SaveFile()); 34 Game.setSaveFile(new SaveFile());
@@ -38,11 +39,13 @@ public class TitleScreenGameState implements GameState {
38 } 39 }
39 } 40 }
40 41
41 public void doGameCycle() throws Exception { 42 public void doGameCycle()
43 {
42 // Do nothing, yet 44 // Do nothing, yet
43 } 45 }
44 46
45 public void render(Graphics2D g) throws Exception { 47 public void render(Graphics2D g)
48 {
46 g.drawImage(ObjectLoader.getImage("Picture", "Title"), 0, 0, null); 49 g.drawImage(ObjectLoader.getImage("Picture", "Title"), 0, 0, null);
47 } 50 }
48 51
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/CharSet.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/CharSet.java index b6e23d6..841eaa4 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/CharSet.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/CharSet.java
@@ -29,7 +29,8 @@ public class CharSet {
29 return charSetImage.getSubimage(sx, sy, 24, 32); 29 return charSetImage.getSubimage(sx, sy, 24, 32);
30 } 30 }
31 31
32 public static CharSet getCharSet(String charSet) throws Exception { 32 public static CharSet getCharSet(String charSet)
33 {
33 CharSet temp = new CharSet(); 34 CharSet temp = new CharSet();
34 temp.charSetImage = ObjectLoader.getImage("CharSet", charSet); 35 temp.charSetImage = ObjectLoader.getImage("CharSet", charSet);
35 return temp; 36 return temp;
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/ChipSet.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/ChipSet.java index 6eb40cc..7ebb4eb 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/ChipSet.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/ChipSet.java
@@ -7,11 +7,11 @@ package com.fourisland.fourpuzzle.gamestate.mapview;
7 7
8import com.fourisland.fourpuzzle.PuzzleApplication; 8import com.fourisland.fourpuzzle.PuzzleApplication;
9import com.fourisland.fourpuzzle.util.ObjectLoader; 9import com.fourisland.fourpuzzle.util.ObjectLoader;
10import java.awt.Graphics; 10import com.fourisland.fourpuzzle.util.ResourceNotFoundException;
11import java.awt.Image;
12import java.awt.image.BufferedImage; 11import java.awt.image.BufferedImage;
13import java.util.HashMap; 12import java.util.HashMap;
14import java.util.Vector; 13import java.util.logging.Level;
14import java.util.logging.Logger;
15 15
16/** 16/**
17 * 17 *
@@ -30,15 +30,25 @@ public abstract class ChipSet {
30 return chipSetImage.getSubimage(sx, sy, 16, 16); 30 return chipSetImage.getSubimage(sx, sy, 16, 16);
31 } 31 }
32 32
33 public static ChipSet getChipSet(String chipSet) throws Exception 33 public static ChipSet getChipSet(String chipSet)
34 { 34 {
35 Class chipSetClass = Class.forName(PuzzleApplication.INSTANCE.getGamePackage() + ".gamedata.chipset." + chipSet); 35 try {
36 Object chipSetObject = chipSetClass.newInstance(); 36 Class chipSetClass = Class.forName(PuzzleApplication.INSTANCE.getGamePackage() + ".gamedata.chipset." + chipSet);
37 ChipSet temp = (ChipSet) chipSetObject; 37 Object chipSetObject = chipSetClass.newInstance();
38 temp.initalize(); 38 ChipSet temp = (ChipSet) chipSetObject;
39 temp.chipSetImage = ObjectLoader.getImage("ChipSet", chipSet); 39 temp.initalize();
40 temp.chipSetImage = ObjectLoader.getImage("ChipSet", chipSet);
41
42 return temp;
43 } catch (InstantiationException ex) {
44 Logger.getLogger(ChipSet.class.getName()).log(Level.SEVERE, null, ex);
45 } catch (IllegalAccessException ex) {
46 Logger.getLogger(ChipSet.class.getName()).log(Level.SEVERE, null, ex);
47 } catch (ClassNotFoundException ex) {
48 throw new ResourceNotFoundException("ChipSetData", chipSet);
49 }
40 50
41 return temp; 51 return null;
42 } 52 }
43 53
44 private HashMap<Integer,ChipSetData> chipSetData = new HashMap<Integer,ChipSetData>(); //162 54 private HashMap<Integer,ChipSetData> chipSetData = new HashMap<Integer,ChipSetData>(); //162
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/Map.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/Map.java index 3df55dd..3e9c717 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/Map.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/Map.java
@@ -18,7 +18,7 @@ import java.util.Vector;
18 */ 18 */
19public abstract class Map { 19public abstract class Map {
20 20
21 public abstract void initalize() throws Exception; 21 public abstract void initalize();
22 22
23 public void initalize(Dimension size) 23 public void initalize(Dimension size)
24 { 24 {
@@ -59,7 +59,7 @@ public abstract class Map {
59 return null; 59 return null;
60 } 60 }
61 61
62 public boolean checkForCollision(int x, int y, Direction toMove) throws Exception 62 public boolean checkForCollision(int x, int y, Direction toMove)
63 { 63 {
64 if ((toMove == Direction.North) && (y == 0)) 64 if ((toMove == Direction.North) && (y == 0))
65 { 65 {
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java index 6aeac83..3d8d15d 100644 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/MapViewGameState.java
@@ -17,8 +17,11 @@ import com.fourisland.fourpuzzle.gamestate.mapview.event.EventList;
17import com.fourisland.fourpuzzle.gamestate.mapview.event.LayerEvent; 17import com.fourisland.fourpuzzle.gamestate.mapview.event.LayerEvent;
18import com.fourisland.fourpuzzle.gamestate.mapview.event.specialmove.MoveEventThread; 18import com.fourisland.fourpuzzle.gamestate.mapview.event.specialmove.MoveEventThread;
19import com.fourisland.fourpuzzle.util.Functions; 19import com.fourisland.fourpuzzle.util.Functions;
20import com.fourisland.fourpuzzle.util.ResourceNotFoundException;
20import java.awt.Graphics2D; 21import java.awt.Graphics2D;
21import java.awt.event.KeyEvent; 22import java.awt.event.KeyEvent;
23import java.util.logging.Level;
24import java.util.logging.Logger;
22 25
23/** 26/**
24 * 27 *
@@ -30,14 +33,14 @@ public class MapViewGameState implements GameState {
30 boolean processInput = true; 33 boolean processInput = true;
31 Map currentMap; 34 Map currentMap;
32 35
33 public MapViewGameState(String map, int x, int y) throws Exception 36 public MapViewGameState(String map, int x, int y)
34 { 37 {
35 //currentMap = ObjectLoader.getMap(map); 38 //currentMap = ObjectLoader.getMap(map);
36 setCurrentMap(map); 39 setCurrentMap(map);
37 Game.getSaveFile().getHero().setLocation(x, y); 40 Game.getSaveFile().getHero().setLocation(x, y);
38 } 41 }
39 42
40 public void initalize() throws Exception 43 public void initalize()
41 { 44 {
42 //if (!currentMap.getMusic().equals("")) 45 //if (!currentMap.getMusic().equals(""))
43 { 46 {
@@ -45,7 +48,7 @@ public class MapViewGameState implements GameState {
45 } 48 }
46 } 49 }
47 50
48 public void deinitalize() throws Exception 51 public void deinitalize()
49 { 52 {
50 //if (!currentMap.getMusic().equals("")) 53 //if (!currentMap.getMusic().equals(""))
51 { 54 {
@@ -53,7 +56,7 @@ public class MapViewGameState implements GameState {
53 } 56 }
54 } 57 }
55 58
56 public void processInput() throws Exception 59 public void processInput()
57 { 60 {
58 if (processInput) 61 if (processInput)
59 { 62 {
@@ -132,7 +135,7 @@ public class MapViewGameState implements GameState {
132 } 135 }
133 } 136 }
134 137
135 public void doGameCycle() throws Exception 138 public void doGameCycle()
136 { 139 {
137 HeroEvent hero = Game.getSaveFile().getHero(); 140 HeroEvent hero = Game.getSaveFile().getHero();
138 if (hero.isMoving()) 141 if (hero.isMoving())
@@ -154,7 +157,7 @@ public class MapViewGameState implements GameState {
154 } 157 }
155 } 158 }
156 159
157 public void render(Graphics2D g) throws Exception 160 public void render(Graphics2D g)
158 { 161 {
159 ChipSet chipSet = ChipSet.getChipSet(currentMap.getChipSet()); 162 ChipSet chipSet = ChipSet.getChipSet(currentMap.getChipSet());
160 int i,x,y; 163 int i,x,y;
@@ -202,19 +205,28 @@ public class MapViewGameState implements GameState {
202 } 205 }
203 } 206 }
204 207
205 public void initCurrentMap(String mapName) throws Exception 208 public void initCurrentMap(String mapName)
206 { 209 {
207 Class mapClass = Class.forName(PuzzleApplication.INSTANCE.getGamePackage() + ".gamedata.map." + mapName); 210 try {
208 Object mapObject = mapClass.newInstance(); 211 Class mapClass = Class.forName(PuzzleApplication.INSTANCE.getGamePackage() + ".gamedata.map." + mapName);
209 Map map = (Map) mapObject; 212 Object mapObject = mapClass.newInstance();
210 map.initalize(); 213 Map map = (Map) mapObject;
211 currentMap = map; 214 map.initalize();
215 currentMap = map;
216 } catch (InstantiationException ex) {
217 Logger.getLogger(MapViewGameState.class.getName()).log(Level.SEVERE, null, ex);
218 } catch (IllegalAccessException ex) {
219 Logger.getLogger(MapViewGameState.class.getName()).log(Level.SEVERE, null, ex);
220 } catch (ClassNotFoundException ex) {
221 throw new ResourceNotFoundException("Map", mapName);
222 }
212 } 223 }
213 public void setCurrentMap(String mapName) throws Exception 224 public void setCurrentMap(String mapName)
214 { 225 {
215 Game.getSaveFile().setCurrentMap(mapName); 226 Game.getSaveFile().setCurrentMap(mapName);
216 initCurrentMap(mapName); 227 initCurrentMap(mapName);
217 } 228 }
229
218 public Map getCurrentMap() 230 public Map getCurrentMap()
219 { 231 {
220 return currentMap; 232 return currentMap;
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}
diff --git a/src/com/fourisland/fourpuzzle/transition/SquareTransition.java b/src/com/fourisland/fourpuzzle/transition/SquareTransition.java index dc17844..d60282d 100644 --- a/src/com/fourisland/fourpuzzle/transition/SquareTransition.java +++ b/src/com/fourisland/fourpuzzle/transition/SquareTransition.java
@@ -15,7 +15,7 @@ import java.awt.Graphics2D;
15public class SquareTransition extends Transition { 15public class SquareTransition extends Transition {
16 16
17 private int tick; 17 private int tick;
18 public SquareTransition(boolean from) throws TransitionUnsupportedException 18 public SquareTransition(boolean from)
19 { 19 {
20 setDirection(from); 20 setDirection(from);
21 21
diff --git a/src/com/fourisland/fourpuzzle/transition/Transition.java b/src/com/fourisland/fourpuzzle/transition/Transition.java index 83cec17..e25fbc9 100644 --- a/src/com/fourisland/fourpuzzle/transition/Transition.java +++ b/src/com/fourisland/fourpuzzle/transition/Transition.java
@@ -14,7 +14,7 @@ import java.awt.Graphics2D;
14public abstract class Transition { 14public abstract class Transition {
15 15
16 private boolean way; 16 private boolean way;
17 protected void setDirection(boolean from) throws TransitionUnsupportedException 17 protected void setDirection(boolean from)
18 { 18 {
19 if ((from) && !(isFromSupported())) 19 if ((from) && !(isFromSupported()))
20 { 20 {
@@ -26,6 +26,7 @@ public abstract class Transition {
26 way = from; 26 way = from;
27 } 27 }
28 } 28 }
29
29 public boolean getDirection() 30 public boolean getDirection()
30 { 31 {
31 return way; 32 return way;
diff --git a/src/com/fourisland/fourpuzzle/transition/TransitionUnsupportedException.java b/src/com/fourisland/fourpuzzle/transition/TransitionUnsupportedException.java index a3d28ef..40f3db8 100644 --- a/src/com/fourisland/fourpuzzle/transition/TransitionUnsupportedException.java +++ b/src/com/fourisland/fourpuzzle/transition/TransitionUnsupportedException.java
@@ -9,7 +9,7 @@ package com.fourisland.fourpuzzle.transition;
9 * 9 *
10 * @author hatkirby 10 * @author hatkirby
11 */ 11 */
12public class TransitionUnsupportedException extends Exception { 12public class TransitionUnsupportedException extends RuntimeException {
13 13
14 public TransitionUnsupportedException(String className, String direction) 14 public TransitionUnsupportedException(String className, String direction)
15 { 15 {
diff --git a/src/com/fourisland/fourpuzzle/util/Functions.java b/src/com/fourisland/fourpuzzle/util/Functions.java index d1995f9..038ca46 100644 --- a/src/com/fourisland/fourpuzzle/util/Functions.java +++ b/src/com/fourisland/fourpuzzle/util/Functions.java
@@ -15,7 +15,7 @@ import com.fourisland.fourpuzzle.gamestate.mapview.event.PossibleEvent;
15 */ 15 */
16public class Functions { 16public class Functions {
17 17
18 public static boolean canTurn(PossibleEvent ev) throws Exception 18 public static boolean canTurn(PossibleEvent ev)
19 { 19 {
20 switch (ev.getAnimation()) 20 switch (ev.getAnimation())
21 { 21 {
@@ -30,7 +30,7 @@ public class Functions {
30 return false; 30 return false;
31 } 31 }
32 32
33 public static boolean isFacing(Event ev1, Event ev2) throws Exception 33 public static boolean isFacing(Event ev1, Event ev2)
34 { 34 {
35 if ((ev1.getDirection() == Direction.North) && (ev2.getLocation().x == ev1.getLocation().x) && (ev2.getLocation().y == (ev1.getLocation().y - 1))) 35 if ((ev1.getDirection() == Direction.North) && (ev2.getLocation().x == ev1.getLocation().x) && (ev2.getLocation().y == (ev1.getLocation().y - 1)))
36 { 36 {
diff --git a/src/com/fourisland/fourpuzzle/util/ObjectLoader.java b/src/com/fourisland/fourpuzzle/util/ObjectLoader.java index c14a8a1..b149ddd 100644 --- a/src/com/fourisland/fourpuzzle/util/ObjectLoader.java +++ b/src/com/fourisland/fourpuzzle/util/ObjectLoader.java
@@ -11,8 +11,13 @@ import java.awt.Image;
11import java.awt.Toolkit; 11import java.awt.Toolkit;
12import java.awt.image.BufferedImage; 12import java.awt.image.BufferedImage;
13import java.awt.image.FilteredImageSource; 13import java.awt.image.FilteredImageSource;
14import java.io.IOException;
15import java.io.InputStream;
14import java.util.HashMap; 16import java.util.HashMap;
17import java.util.logging.Level;
18import java.util.logging.Logger;
15import javax.imageio.ImageIO; 19import javax.imageio.ImageIO;
20import javax.sound.midi.InvalidMidiDataException;
16import javax.sound.midi.MidiSystem; 21import javax.sound.midi.MidiSystem;
17import javax.sound.midi.Sequence; 22import javax.sound.midi.Sequence;
18import org.jdesktop.application.ResourceMap; 23import org.jdesktop.application.ResourceMap;
@@ -25,13 +30,25 @@ public class ObjectLoader {
25 30
26 private static HashMap<String,Object> objectCache = new HashMap<String,Object>(); 31 private static HashMap<String,Object> objectCache = new HashMap<String,Object>();
27 32
28 public static BufferedImage getImage(String type, String name) throws Exception 33 public static BufferedImage getImage(String type, String name)
29 { 34 {
30 if (!objectCache.containsKey(type + "/" + name)) 35 if (!objectCache.containsKey(type + "/" + name))
31 { 36 {
32 ResourceMap rm = PuzzleApplication.INSTANCE.getContext().getResourceManager().getResourceMap(); 37 ResourceMap rm = PuzzleApplication.INSTANCE.getContext().getResourceManager().getResourceMap();
33 String filename = rm.getResourcesDir() + type.toLowerCase() + "/" + name + ".png"; 38 String filename = rm.getResourcesDir() + type.toLowerCase() + "/" + name + ".png";
34 BufferedImage bImg = ImageIO.read(rm.getClassLoader().getResourceAsStream(filename)); 39 InputStream str = rm.getClassLoader().getResourceAsStream(filename);
40
41 if (str == null)
42 {
43 throw new ResourceNotFoundException(type, name);
44 }
45
46 BufferedImage bImg = null;
47 try {
48 bImg = ImageIO.read(str);
49 } catch (IOException ex) {
50 Logger.getLogger(ObjectLoader.class.getName()).log(Level.SEVERE, null, ex);
51 }
35 52
36 addToObjectCache(type,name,bImg); 53 addToObjectCache(type,name,bImg);
37 } 54 }
@@ -39,13 +56,26 @@ public class ObjectLoader {
39 return (BufferedImage) objectCache.get(type + "/" + name); 56 return (BufferedImage) objectCache.get(type + "/" + name);
40 } 57 }
41 58
42 public static BufferedImage getImage(String type, String name, int transparencyColor) throws Exception 59 public static BufferedImage getImage(String type, String name, int transparencyColor)
43 { 60 {
44 if (!objectCache.containsKey(type + "/" + name)) 61 if (!objectCache.containsKey(type + "/" + name))
45 { 62 {
46 ResourceMap rm = PuzzleApplication.INSTANCE.getContext().getResourceManager().getResourceMap(); 63 ResourceMap rm = PuzzleApplication.INSTANCE.getContext().getResourceManager().getResourceMap();
47 String filename = rm.getResourcesDir() + type + "/" + name + ".png"; 64 String filename = rm.getResourcesDir() + type.toLowerCase() + "/" + name + ".png";
48 BufferedImage bImg = ImageIO.read(rm.getClassLoader().getResourceAsStream(filename)); 65 InputStream str = rm.getClassLoader().getResourceAsStream(filename);
66
67 if (str == null)
68 {
69 throw new ResourceNotFoundException(type, name);
70 }
71
72 BufferedImage bImg = null;
73 try {
74 bImg = ImageIO.read(str);
75 } catch (IOException ex) {
76 Logger.getLogger(ObjectLoader.class.getName()).log(Level.SEVERE, null, ex);
77 }
78
49 bImg = new BufferedImage(bImg.getWidth(), bImg.getHeight(), BufferedImage.TYPE_INT_RGB); 79 bImg = new BufferedImage(bImg.getWidth(), bImg.getHeight(), BufferedImage.TYPE_INT_RGB);
50 Image image = Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(bImg.getSource(), new TransparentImageFilter(transparencyColor))); 80 Image image = Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(bImg.getSource(), new TransparentImageFilter(transparencyColor)));
51 bImg.createGraphics().drawImage(image, 0, 0, null); 81 bImg.createGraphics().drawImage(image, 0, 0, null);
@@ -65,7 +95,7 @@ public class ObjectLoader {
65 return map; 95 return map;
66 }*/ 96 }*/
67 97
68 public static void addToObjectCache(String type, String name, Object object) throws Exception 98 public static void addToObjectCache(String type, String name, Object object)
69 { 99 {
70 if (objectCache.size() >= 100) 100 if (objectCache.size() >= 100)
71 { 101 {
@@ -75,13 +105,26 @@ public class ObjectLoader {
75 objectCache.put(type + "/" + name, object); 105 objectCache.put(type + "/" + name, object);
76 } 106 }
77 107
78 public static Sequence getMusic(String name) throws Exception 108 public static Sequence getMusic(String name)
79 { 109 {
80 if (!objectCache.containsKey("Music/" + name)) 110 if (!objectCache.containsKey("Music/" + name))
81 { 111 {
82 ResourceMap rm = PuzzleApplication.INSTANCE.getContext().getResourceManager().getResourceMap(); 112 ResourceMap rm = PuzzleApplication.INSTANCE.getContext().getResourceManager().getResourceMap();
83 String filename = rm.getResourcesDir() + "music/" + name + ".mid"; 113 String filename = rm.getResourcesDir() + "music/" + name + ".mid";
84 Sequence seq = MidiSystem.getSequence(rm.getClassLoader().getResourceAsStream(filename)); 114 InputStream str = rm.getClassLoader().getResourceAsStream(filename);
115 if (str == null)
116 {
117 throw new ResourceNotFoundException("Music", name);
118 }
119
120 Sequence seq = null;
121 try {
122 seq = MidiSystem.getSequence(str);
123 } catch (InvalidMidiDataException ex) {
124 Logger.getLogger(ObjectLoader.class.getName()).log(Level.SEVERE, null, ex);
125 } catch (IOException ex) {
126 Logger.getLogger(ObjectLoader.class.getName()).log(Level.SEVERE, null, ex);
127 }
85 128
86 addToObjectCache("Music", name, seq); 129 addToObjectCache("Music", name, seq);
87 } 130 }
diff --git a/src/com/fourisland/fourpuzzle/util/ResourceNotFoundException.java b/src/com/fourisland/fourpuzzle/util/ResourceNotFoundException.java new file mode 100644 index 0000000..4db2f61 --- /dev/null +++ b/src/com/fourisland/fourpuzzle/util/ResourceNotFoundException.java
@@ -0,0 +1,29 @@
1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5
6package com.fourisland.fourpuzzle.util;
7
8/**
9 *
10 * @author hatkirby
11 */
12public class ResourceNotFoundException extends RuntimeException {
13
14 String type;
15 String name;
16
17 public ResourceNotFoundException(String type, String name)
18 {
19 this.type = type;
20 this.name = name;
21 }
22
23 @Override
24 public String getMessage()
25 {
26 return type + " \"" + name + "\" could not be found";
27 }
28
29}