mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 15:19:35 +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;
|
||||
}
|
||||
Position positionInFront = getNewPosition(conveyorBeltPosition, conveyorBeltDirection);
|
||||
if (!isValidPosition(positionInFront)) {
|
||||
return true;
|
||||
//The tile in front of the robot is not a conveyor belt and has something on it stopping the conveyor belt
|
||||
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 (!isValidPosition(positionInFront)) {
|
||||
return true;
|
||||
}
|
||||
//The tile in front of the robot is not a conveyor belt and has something on it stopping the conveyor belt
|
||||
if (!isConveyorBelt(tileInFront) &&
|
||||
hasFrontConflict(conveyorBeltPosition, positionInFront, conveyorBeltDirection)) {
|
||||
return false;
|
||||
}
|
||||
Tile tileInFront = getTileOnPosition(positionInFront);
|
||||
//There is another robot trying to enter the same crossing
|
||||
if (hasCrossingConflict(positionInFront, conveyorBeltDirection)) {
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user