|
|
@ -10,21 +10,43 @@ bool istzugerlaubt_Turm(char** Brett, int startX, int startY, int endX, int endY |
|
|
|
int counter = 0; |
|
|
|
|
|
|
|
if(startX == startY){ |
|
|
|
if(startY<endY){ |
|
|
|
counter = endY-startY; |
|
|
|
for(int i = 0; i<counter;i++){ |
|
|
|
if(Brett[startY+i][startX] != ' '){ |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
counter = startY-endY; |
|
|
|
for(int i = 0; i<counter;i++){ |
|
|
|
if(Brett[startY-i][startX] != ' '){ |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}else if(startY == endY){ |
|
|
|
if(startX<endX){ |
|
|
|
counter = endX-startX; |
|
|
|
for(int i = 0; i<counter;i++){ |
|
|
|
if(Brett[startY][startX+i] != ' '){ |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
counter = startX-endX; |
|
|
|
for(int i = 0; i<counter;i++){ |
|
|
|
if(Brett[startY][startX-i] != ' '){ |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
|