Mercurial > hg > ristipolku
diff game/Engine.java @ 40:a69103644bf6
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 18 Feb 2011 23:34:47 +0200 |
parents | e682b623aea9 |
children | a5fd4f74a767 |
line wrap: on
line diff
--- a/game/Engine.java Fri Feb 18 15:47:15 2011 +0200 +++ b/game/Engine.java Fri Feb 18 23:34:47 2011 +0200 @@ -35,7 +35,7 @@ public void print() { System.out.print("PathInfo: inP="+in+", inX="+inX+", inY="+inY+"\n"); - System.out.print(" outP="+out+", outX="+outX+", outY="+outY+"\n"); + System.out.print(" outP="+out+", outX="+outX+", outY="+outY+"\n\n"); } } @@ -200,11 +200,11 @@ if (mark) { curr.setType(PieceType.LOCKED); - curr.setActiveConnection(point); + curr.setConnectionState(curr.getRotatedPoint(point), true); } // Get next piece - point = curr.getConnection(point); + point = curr.getConnection(curr.getRotatedPoint(point)); switch (point) { case 0: y--; point = 5; break; @@ -237,14 +237,11 @@ // Do we have a piece? if (current != null) { - // Yes, place and lock it - current.setType(PieceType.LOCKED); + // Yes, start resolving path to next piece placement PathInfo i = resolvePath(moveX, moveY, movePoint, true); - + if (i != null) { - System.out.print("moveX="+moveX+", moveY="+moveY+", movePoint="+movePoint+"\n"); - i.print(); moveX = i.outX; moveY = i.outY; movePoint = i.out; @@ -265,7 +262,10 @@ // Resolve path PathInfo i = resolvePath(moveX, moveY, movePoint, true); if (i != null) + { + // Path found, place the piece board[moveX][moveY] = current; + } else { // Path ended up center/gameboard walls - it's game over, man