From 6ac96d73e236b41dccb27031ff4399c9f5cfba46 Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Thu, 23 Apr 2020 11:30:28 +0200 Subject: [PATCH] =?UTF-8?q?Fikser=20et=20problem=20med=20roboter=20som=20s?= =?UTF-8?q?t=C3=A5r=20p=C3=A5=20transportb=C3=A5nd=20med=20en=20tile=20mel?= =?UTF-8?q?lom=20seg=20og=20enden=20av=20kartet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inf112/fiasko/roborally/objects/Board.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/inf112/fiasko/roborally/objects/Board.java b/src/main/java/inf112/fiasko/roborally/objects/Board.java index 0b86cc3..4f74a52 100644 --- a/src/main/java/inf112/fiasko/roborally/objects/Board.java +++ b/src/main/java/inf112/fiasko/roborally/objects/Board.java @@ -401,20 +401,20 @@ public class Board { private boolean hasCrossingConflict(Position crossingPosition, Direction conveyorBeltDirection) { Position frontLeftPosition = getNewPosition(crossingPosition, Direction.getLeftRotatedDirection(conveyorBeltDirection)); - Tile frontLeftTile = getTileOnPosition(frontLeftPosition); Position frontRightPosition = getNewPosition(crossingPosition, Direction.getRightRotatedDirection(conveyorBeltDirection)); - Tile frontRightTile = getTileOnPosition(frontRightPosition); Position twoForwardPosition = getNewPosition(crossingPosition, conveyorBeltDirection); - Tile twoForwardTile = getTileOnPosition(twoForwardPosition); //If another robot is standing on a conveyor belt pointing to the tile in front, a conflict happens - return (isValidPosition(frontLeftPosition) && isConveyorBelt(frontLeftTile) && frontLeftTile.getDirection() == + return (isValidPosition(frontLeftPosition) && isConveyorBelt(getTileOnPosition(frontLeftPosition)) && + getTileOnPosition(frontLeftPosition).getDirection() == Direction.getRightRotatedDirection(conveyorBeltDirection) && hasRobotOnPosition(frontLeftPosition)) || - (isValidPosition(frontRightPosition) && isConveyorBelt(frontRightTile) - && frontRightTile.getDirection() == Direction.getLeftRotatedDirection(conveyorBeltDirection) + (isValidPosition(frontRightPosition) && isConveyorBelt(getTileOnPosition(frontRightPosition)) + && getTileOnPosition(frontRightPosition).getDirection() == + Direction.getLeftRotatedDirection(conveyorBeltDirection) && hasRobotOnPosition(frontRightPosition)) || - (isValidPosition(twoForwardPosition) && isConveyorBelt(twoForwardTile) - && twoForwardTile.getDirection() == Direction.getReverseDirection(conveyorBeltDirection) + (isValidPosition(twoForwardPosition) && isConveyorBelt(getTileOnPosition(twoForwardPosition)) + && getTileOnPosition(twoForwardPosition).getDirection() == + Direction.getReverseDirection(conveyorBeltDirection) && hasRobotOnPosition(twoForwardPosition)); }