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