You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.1 KiB

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include "spieler.h"
#include "Moving.h"
#include "Turm.h"
bool istzugerlaubt_Turm(char** Brett, int startX, int startY, int endX, int endY, Player player) {
int counter = 0;
if(startX == endX && startY < endY){
counter = endY-startY;
for(int i = 1; i<counter;i++){
if(Brett[startY+i][startX] != ' '){
return false;
}
}
return true;
}else if(startX == endX && startY > endY){
counter = startY-endY;
for(int i = 1; i<counter;i++){
if(Brett[startY-i][startX] != ' '){
return false;
}
}
return true;
}else if(startY == endY && startX<endX){
counter = endX-startX;
for(int i = 1; i<counter;i++){
if(Brett[startY][startX+i] != ' '){
return false;
}
}
return true;
}else if(startY == endY && startX>endX){
counter = startX-endX;
for(int i = 1; i<counter;i++){
if(Brett[startY][startX-i] != ' '){
return false;
}
}
return true;
}else{
return false;
}
}