Dungeon.buildDungeon() now correctly sets Display up

This commit is contained in:
Kjistóf 2016-05-07 19:15:19 +02:00
parent 1f02ffc892
commit 3d81dc6c65
2 changed files with 12 additions and 2 deletions

View File

@ -31,7 +31,7 @@ public class Dungeon {
* S: Scale
* X: Gap
* R: Replicator */
Map<String, Tile> buildDungeon(File input) throws IOException
Map<String, Tile> buildDungeon(File input, Display display) throws IOException
{
Tile defaultTile = new Field();
defaultTile.setX(-666);
@ -63,29 +63,35 @@ public class Dungeon {
{
case 'W':
tile = new Wall();
display.addVisual(new WallDrawer((Wall) tile));
break;
case 'F':
tile = new Field();
display.addVisual(new FieldDrawer((Field) tile));
break;
case 'Z':
tile = new Field();
display.addVisual(new FieldDrawer((Field) tile));
tile.setZPMOnTile(new ZPM());
break;
case 'B':
tile = new Field();
display.addVisual(new FieldDrawer((Field) tile));
tile.putABox(new Box());
break;
case 'O':
tile = new Field();
display.addVisual(new FieldDrawer((Field) tile));
oneilllocation = tile;
break;
case 'J':
tile = new Field();
display.addVisual(new FieldDrawer((Field) tile));
jaffalocation = tile;
break;
@ -100,10 +106,12 @@ public class Dungeon {
case 'X':
tile = new Gap();
display.addVisual(new GapDrawer((Gap) tile));
break;
case 'R':
tile = new Field();
display.addVisual(new FieldDrawer((Field) tile));
replicatorlocation = tile;
break;
}
@ -125,10 +133,12 @@ public class Dungeon {
int triggerweight = Integer.parseInt(scaledata[4]);
Gate gate = new Gate();
display.addVisual(new GateDrawer(gate));
gate.setY(gy);
gate.setX(gx);
Scale scale = new Scale(gate, triggerweight);
display.addVisual(new ScaleDrawer(scale));
scale.setY(sy);
scale.setX(sx);

View File

@ -32,7 +32,7 @@ public class Game {
public void startGame(File dungeonFile) throws IOException {
Stargate.init();
Map<String, Tile> players = dungeon.buildDungeon(dungeonFile);
Map<String, Tile> players = dungeon.buildDungeon(dungeonFile, display);
oneill = new Player("O'Neill", players.get("oneill"), getRandomDirection());
jaffa = new Player("Jaffa", players.get("jaffa"), getRandomDirection());
replicator = new PlayerBase("Replicator", players.get("replicator"), getRandomDirection());