mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Fikser sjekking av en robot som står på et transporbånd som peker ut av brettet, men som blir stoppet av en vegg
This commit is contained in:
parent
417681d1e2
commit
ea855573e0
@ -329,19 +329,18 @@ public class Board {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Position positionInFront = getNewPosition(conveyorBeltPosition, conveyorBeltDirection);
|
Position positionInFront = getNewPosition(conveyorBeltPosition, conveyorBeltDirection);
|
||||||
if (!isValidPosition(positionInFront)) {
|
//The tile in front of the robot is not a conveyor belt and has something on it stopping the conveyor belt
|
||||||
return true;
|
if ((!isValidPosition(positionInFront) && moveIsStoppedByWall(conveyorBeltPosition, positionInFront,
|
||||||
|
conveyorBeltDirection)) || (isValidPosition(positionInFront) &&
|
||||||
|
!isConveyorBelt(getTileOnPosition(positionInFront)) &&
|
||||||
|
hasFrontConflict(conveyorBeltPosition, positionInFront, conveyorBeltDirection))) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
Tile tileInFront = getTileOnPosition(positionInFront);
|
|
||||||
//If a conveyor belt will move the robot outside the map, the move is valid
|
//If a conveyor belt will move the robot outside the map, the move is valid
|
||||||
if (!isValidPosition(positionInFront)) {
|
if (!isValidPosition(positionInFront)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//The tile in front of the robot is not a conveyor belt and has something on it stopping the conveyor belt
|
Tile tileInFront = getTileOnPosition(positionInFront);
|
||||||
if (!isConveyorBelt(tileInFront) &&
|
|
||||||
hasFrontConflict(conveyorBeltPosition, positionInFront, conveyorBeltDirection)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//There is another robot trying to enter the same crossing
|
//There is another robot trying to enter the same crossing
|
||||||
if (hasCrossingConflict(positionInFront, conveyorBeltDirection)) {
|
if (hasCrossingConflict(positionInFront, conveyorBeltDirection)) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user