|
@ -9,8 +9,7 @@ bool istzugerlaubt_Turm(char** Brett, int startX, int startY, int endX, int endY |
|
|
|
|
|
|
|
|
int counter = 0; |
|
|
int counter = 0; |
|
|
|
|
|
|
|
|
if(startX == endX){ |
|
|
|
|
|
if(startY<endY){ |
|
|
|
|
|
|
|
|
if(startX == endX && startY < endY){ |
|
|
counter = endY-startY; |
|
|
counter = endY-startY; |
|
|
for(int i = 1; i<counter;i++){ |
|
|
for(int i = 1; i<counter;i++){ |
|
|
if(Brett[startY+i][startX] != ' '){ |
|
|
if(Brett[startY+i][startX] != ' '){ |
|
@ -18,7 +17,7 @@ int counter = 0; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return true; |
|
|
return true; |
|
|
}else{ |
|
|
|
|
|
|
|
|
}else if(startX == endX && startY > endY){ |
|
|
counter = startY-endY; |
|
|
counter = startY-endY; |
|
|
for(int i = 1; i<counter;i++){ |
|
|
for(int i = 1; i<counter;i++){ |
|
|
if(Brett[startY-i][startX] != ' '){ |
|
|
if(Brett[startY-i][startX] != ' '){ |
|
@ -26,11 +25,8 @@ int counter = 0; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else if(startY == endY){ |
|
|
|
|
|
if(startX<endX){ |
|
|
|
|
|
|
|
|
}else if(startY == endY && startX<endX){ |
|
|
counter = endX-startX; |
|
|
counter = endX-startX; |
|
|
for(int i = 1; i<counter;i++){ |
|
|
for(int i = 1; i<counter;i++){ |
|
|
if(Brett[startY][startX+i] != ' '){ |
|
|
if(Brett[startY][startX+i] != ' '){ |
|
@ -38,7 +34,7 @@ int counter = 0; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return true; |
|
|
return true; |
|
|
}else{ |
|
|
|
|
|
|
|
|
}else if(startY == endY && startX>endX){ |
|
|
counter = startX-endX; |
|
|
counter = startX-endX; |
|
|
for(int i = 1; i<counter;i++){ |
|
|
for(int i = 1; i<counter;i++){ |
|
|
if(Brett[startY][startX-i] != ' '){ |
|
|
if(Brett[startY][startX-i] != ' '){ |
|
@ -46,13 +42,9 @@ int counter = 0; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
|
}else{ |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|