fixed infinite recursion in Field.spawnStargate()
This commit is contained in:
parent
a06feaa0ca
commit
c19f437c21
@ -8,6 +8,7 @@ public class Field extends cicaprojekt.Tile
|
||||
public static Map<Direction, Tile> testAdjacentTile = new HashMap<Direction, Tile>();
|
||||
public static Field testField = new Field();
|
||||
private static boolean testAdjTileSet = false;
|
||||
private static int recursionLimit = 0;
|
||||
|
||||
public Field() {
|
||||
setItemOnTile(new Box());
|
||||
@ -30,6 +31,10 @@ public class Field extends cicaprojekt.Tile
|
||||
public void spawnStargate(cicaprojekt.Stargate stargate, Direction direction) {
|
||||
Menu.addTab();
|
||||
System.out.println(">" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Field.spawnStargate(Stargate stargate, Direction direction)");
|
||||
|
||||
if (recursionLimit++ >= 10)
|
||||
this.adjacentTile.put(direction, new Wall());
|
||||
|
||||
adjacentTile.get(direction).spawnStargate(stargate, direction);
|
||||
System.out.println("<" + "[" + ":" + this.getClass().getSimpleName() + "]" + Menu.tabulator + "Field.spawnStargate(Stargate stargate, Direction direction)");
|
||||
Menu.removeTab();
|
||||
|
Loading…
Reference in New Issue
Block a user