Commit 3dfeea64 authored by christof@ilja.athome.local's avatar christof@ilja.athome.local Committed by Christof Musik

* removed some compile warnings

parent ff90c2ff
......@@ -4,7 +4,7 @@ import java.io.*;
class HighScores implements Serializable{
private int level;
private int max_items;
private TreeMap scores = new TreeMap();
private TreeMap<Integer, HighScoreItem> scores = new TreeMap<Integer, HighScoreItem>();
public HighScores(int level, int max) {
this.level = level;
......
......@@ -10,10 +10,10 @@ class Sokoban extends JFrame implements ActionListener{
JLabel status;
JMenuItem undo;
TreeMap levelsets = new TreeMap();
TreeMap<String, File> levelsets = new TreeMap<String, File>();
File levelfile = new File("./levels/Sokoban.levels");
TreeMap highscores = new TreeMap();
TreeMap<Integer, HighScoreItem> highscores = new TreeMap<Integer, HighScoreItem>();
String playername;
HighScoreItem current_highscore;
int level_max = 0;
......@@ -296,7 +296,7 @@ class Sokoban extends JFrame implements ActionListener{
int l=0;
int height=0;
int width=0;
LinkedList list = new LinkedList();
LinkedList<String> list = new LinkedList<String>();
if (levelno <= 0 || levelno > level_max) throw new LevelNotFoundException();
if (!name.exists() && !name.canRead()) throw new LevelNotFoundException("Level File not found!");
......@@ -340,7 +340,7 @@ class Sokoban extends JFrame implements ActionListener{
try {
String c = str.substring(k,k+1);
if ((c.equals(" ")||c.equals("")) && out) level[i][k]=Block.OUT_SPACE;
if ((c.equals(" ")||c.equals("\n")) && out) level[i][k]=Block.OUT_SPACE;
if (c.equals("#")) {
level[i][k]=Block.FIXED;
out = false;
......@@ -439,7 +439,7 @@ class Sokoban extends JFrame implements ActionListener{
changeLevelSet( (File) ins.readObject(), false );
int field[][] = (int[][]) ins.readObject();
Stack undostack = (Stack) ins.readObject();
Stack<UndoMove> undostack = (Stack<UndoMove>) ins.readObject();
playfield.changeLevel(field);
playfield.setUndoStack(undostack);
......@@ -567,10 +567,10 @@ class Sokoban extends JFrame implements ActionListener{
}
}
private TreeMap openHighScores() {
private TreeMap<Integer, HighScoreItem> openHighScores() {
try {
ObjectInputStream in = new ObjectInputStream(new FileInputStream(levelfile.getName()+".scores"));
TreeMap t = (TreeMap) in.readObject();
TreeMap<Integer,HighScoreItem> t = (TreeMap<Integer,HighScoreItem>) in.readObject();
in.close();
return t;
} catch (FileNotFoundException e) {
......@@ -580,7 +580,7 @@ class Sokoban extends JFrame implements ActionListener{
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return new TreeMap();
return new TreeMap<Integer,HighScoreItem>();
}
private boolean checkNewHighScore() {
......@@ -608,6 +608,6 @@ class Sokoban extends JFrame implements ActionListener{
g.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
g.pack();
g.show();
g.setVisible(true);
}
}
......@@ -21,9 +21,9 @@ class SokobanField extends JComponent {
private int [][] field;
private LinkedList targets;
private Stack undostack = new Stack();
private Stack redostack = new Stack();
private LinkedList<Point> targets;
private Stack<UndoMove> undostack = new Stack<UndoMove>();
private Stack<UndoMove> redostack = new Stack<UndoMove>();
private Image cursimg;
private Image green;
......@@ -142,7 +142,7 @@ class SokobanField extends JComponent {
private void findTargetsCursor() {
int tmp=0;
targets = new LinkedList();
targets = new LinkedList<Point>();
for (int i=0; i<height;i++) {
for (int k=0; k<width; k++) {
if (field[i][k]==Block.CURSOR) {
......@@ -296,7 +296,7 @@ class SokobanField extends JComponent {
return undostack;
}
public void setUndoStack(Stack u) {
public void setUndoStack(Stack<UndoMove> u) {
undostack = u;
}
......@@ -362,7 +362,7 @@ class SokobanField extends JComponent {
g2.draw(new Line2D.Double(i*blocksize+blocksize, k*blocksize+diff, i*blocksize+blocksize, k*blocksize+blocksize));
g2.draw(new Line2D.Double(i*blocksize+diff, k*blocksize+blocksize, i*blocksize+blocksize, k*blocksize+blocksize));
// 45
// 45 degree
g2.draw(new Line2D.Double(i*blocksize+innerblock, k*blocksize, i*blocksize+blocksize, k*blocksize+diff));
g2.draw(new Line2D.Double(i*blocksize+innerblock, k*blocksize+innerblock, i*blocksize+blocksize, k*blocksize+blocksize));
g2.draw(new Line2D.Double(i*blocksize, k*blocksize+innerblock, i*blocksize+diff, k*blocksize+blocksize));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment