Legger til sjekk for robotkollisjon ved transportbånd bevegelse

This commit is contained in:
torlunjen 2020-03-30 18:10:21 +02:00
parent da17c923df
commit 4a47517ca6

View File

@ -365,11 +365,16 @@ public class RoboRallyGame implements IDrawableGame {
List<BoardElementContainer<Tile>> pointingNeighbours = listOfConveyorBeltsWithRobotPointingAtTile(true,
nextElementContainer, conveyorBeltsWithRobotsOn);
int conveyorBeltsWithRobotsPointingToSameTile = listOfConveyorBeltsWithRobotPointingAtTile(true,
nextElementContainer, conveyorBeltsWithRobotsOn).size();
listOfRow.add(currentConveyorBelt);
if (blacklistedTiles.contains(nextElementContainer)) {
blacklistedTiles.addAll(listOfRow);
listOfRow.clear();
} else if (conveyorBeltsWithRobotsPointingToSameTile > 0) {
blacklistedTiles.addAll(listOfRow);
listOfRow.clear();
} else if (currentConveyorBelt.getElement().getDirection() == Direction.getReverseDirection(nextDirection) &&
conveyorBeltsWithRobotsOn.contains(nextElementContainer)) {
blacklistedTiles.addAll(listOfRow);