diff game/Piece.java @ 37:3dc5ae9f1c80

Work on game logic.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 18 Feb 2011 04:58:30 +0200
parents 6f6c551cc14c
children e682b623aea9
line wrap: on
line diff
--- a/game/Piece.java	Thu Feb 17 22:05:48 2011 +0200
+++ b/game/Piece.java	Fri Feb 18 04:58:30 2011 +0200
@@ -86,7 +86,11 @@
 
     public int getConnection(int in)
     {
-        return connections[(in + (currRotation * 2)) % 8];
+        int offs = (in + (currRotation * 2)) % 8;
+        if (offs < 0)
+            offs = 8 + offs;
+
+        return connections[offs];
     }
     
     public void rotate(RotateDir dir)