clearer this way?

This commit is contained in:
Steinar Hamre 2008-10-02 23:54:22 +00:00
parent bf852e861c
commit 08dc193e53

View File

@ -51,22 +51,16 @@ laser(int side) {
int ddir; int ddir;
switch (side) { switch (side) {
case 0: case 0:
x=9; y=-1; dir=0; x=9; y=0; dir=0;
break; break;
case 1: case 1:
x=0; y=8; dir=2; x=0; y=7; dir=2;
break; break;
default: default:
return 0; return 0;
} }
for (;;) { for (;;) {
switch (dir & 3) {
case 0: y++; if (y>7) return 0; break;
case 1: x++; if (x>9) return 0; break;
case 2: y--; if (y<0) return 0; break;
case 3: x--; if (x<0) return 0; break;
}
switch (board[x][y].piece) { switch (board[x][y].piece) {
case NONE: case NONE:
break; break;
@ -91,6 +85,12 @@ laser(int side) {
dir=(dir + 1 - 2*(ddir & 1)) & 3; dir=(dir + 1 - 2*(ddir & 1)) & 3;
break; break;
} }
switch (dir & 3) {
case 0: y++; if (y>7) return 0; break;
case 1: x++; if (x>9) return 0; break;
case 2: y--; if (y<0) return 0; break;
case 3: x--; if (x<0) return 0; break;
}
} }
} }