attempt to fix stargate spawning

still gives stackoverflow, as there's no stop condition
This commit is contained in:
Bokros Bálint 2016-03-29 11:52:52 +02:00 committed by Kjistóf
parent 5ece8b8f27
commit a06feaa0ca

View File

@ -1,19 +1,29 @@
package cicaprojekt; package cicaprojekt;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
public class Field extends cicaprojekt.Tile public class Field extends cicaprojekt.Tile
{ {
public static Map<Direction, Tile> testAdjacentTile = new HashMap<Direction, Tile>();
public static Field testField = new Field(); public static Field testField = new Field();
private static boolean testAdjTileSet = false;
public Field() { public Field() {
setItemOnTile(new Box()); setItemOnTile(new Box());
adjacentTile = new HashMap<Direction, Tile>(); adjacentTile = testAdjacentTile;
adjacentTile.put(Direction.NORTH, Field.testField); setTestAdjacentTile();
adjacentTile.put(Direction.EAST, Field.testField); }
adjacentTile.put(Direction.SOUTH, Field.testField);
adjacentTile.put(Direction.WEST, Field.testField); private void setTestAdjacentTile() {
if(!testAdjTileSet) {
testAdjacentTile.put(Direction.NORTH, Field.testField);
testAdjacentTile.put(Direction.EAST, Field.testField);
testAdjacentTile.put(Direction.SOUTH, Field.testField);
testAdjacentTile.put(Direction.WEST, Field.testField);
testAdjTileSet = true;
}
} }
@Override @Override