File black-box-1.4.8-range.patch of Package black-box
--- src/blackbox.c
+++ src/blackbox.c
@@ -406,26 +406,26 @@
{
case 0:
if (y==0) {end=1;} else
- if (map[x-1][y-1]==1) {dir=1;} else
- if (map[x][y-1]==1) {dir=3;}
+ if (x!=0&&map[x-1][y-1]==1) {dir=1;} else
+ if (x<10&&map[x][y-1]==1) {dir=3;}
else {y--;}
break;
case 1:
- if (x==12) {end=1;} else
- if (map[x][y]==1) {dir=0;} else
- if (map[x][y-1]==1) {dir=2;}
+ if (x==11) {end=1;} else
+ if (y<8&&map[x][y]==1) {dir=0;} else
+ if (y!=0&&map[x][y-1]==1) {dir=2;}
else {x++;}
break;
case 2:
if (y==9) {end=1;} else
- if (map[x][y]==1) {dir=3;} else
- if (map[x-1][y]==1) {dir=1;}
+ if (x<10&&map[x][y]==1) {dir=3;} else
+ if (x!=0&&map[x-1][y]==1) {dir=1;}
else {y++;}
break;
case 3:
if (x==0) {end=1;} else
- if (map[x-1][y]==1) {dir=0;} else
- if (map[x-1][y-1]==1) {dir=2;}
+ if (y<8&&map[x-1][y]==1) {dir=0;} else
+ if (y!=0&&map[x-1][y-1]==1) {dir=2;}
else {x--;}
break;
}
@@ -740,15 +740,15 @@
{
//block highlighting
case SDL_BUTTON(3):
- if ((light[div(mouse_x+25,50).quot-2][div(mouse_y+25,50).quot-2]==0)
- &&(div(mouse_x+25,50).quot>1)&&(div(mouse_y+25,50).quot>1)
- &&(div(mouse_x+25,50).quot<13)&&(div(mouse_y+25,50).quot<11))
+ if ((div(mouse_x+25,50).quot>1)&&(div(mouse_y+25,50).quot>1)
+ &&(div(mouse_x+25,50).quot<13)&&(div(mouse_y+25,50).quot<11)
+ &&(light[div(mouse_x+25,50).quot-2][div(mouse_y+25,50).quot-2]==0))
{
light[div(mouse_x+25,50).quot-2][div(mouse_y+25,50).quot-2]=1;
}else
- if ((light[div(mouse_x+25,50).quot-2][div(mouse_y+25,50).quot-2]==1)
- &&(div(mouse_x+25,50).quot>1)&&(div(mouse_y+25,50).quot>1)
- &&(div(mouse_x+25,50).quot<13)&&(div(mouse_y+25,50).quot<11))
+ if ((div(mouse_x+25,50).quot>1)&&(div(mouse_y+25,50).quot>1)
+ &&(div(mouse_x+25,50).quot<13)&&(div(mouse_y+25,50).quot<11)
+ &&(light[div(mouse_x+25,50).quot-2][div(mouse_y+25,50).quot-2]==1))
{
light[div(mouse_x+25,50).quot-2][div(mouse_y+25,50).quot-2]=0;
}
@@ -795,15 +795,15 @@
break;
case SDL_BUTTON(1):
//think
- if ((think[div(mouse_x,50).quot-2][div(mouse_y,50).quot-2]==0)
- &&(div(mouse_x,50).quot>1)&&(div(mouse_y,50).quot>1)
- &&(div(mouse_x,50).quot<12)&&(div(mouse_y,50).quot<10))
+ if ((div(mouse_x,50).quot>1)&&(div(mouse_y,50).quot>1)
+ &&(div(mouse_x,50).quot<12)&&(div(mouse_y,50).quot<10)
+ &&(think[div(mouse_x,50).quot-2][div(mouse_y,50).quot-2]==0))
{
think[div(mouse_x,50).quot-2][div(mouse_y,50).quot-2]=1;
} else
- if ((think[div(mouse_x,50).quot-2][div(mouse_y,50).quot-2]==1)
- &&(div(mouse_x,50).quot>1)&&(div(mouse_y,50).quot>1)
- &&(div(mouse_x,50).quot<12)&&(div(mouse_y,50).quot<10))
+ if ((div(mouse_x,50).quot>1)&&(div(mouse_y,50).quot>1)
+ &&(div(mouse_x,50).quot<12)&&(div(mouse_y,50).quot<10)
+ &&(think[div(mouse_x,50).quot-2][div(mouse_y,50).quot-2]==1))
{
think[div(mouse_x,50).quot-2][div(mouse_y,50).quot-2]=0;
}