diff --git a/src/main/java/inf112/fiasko/roborally/objects/Board.java b/src/main/java/inf112/fiasko/roborally/objects/Board.java index 57ae095..48049a5 100644 --- a/src/main/java/inf112/fiasko/roborally/objects/Board.java +++ b/src/main/java/inf112/fiasko/roborally/objects/Board.java @@ -132,14 +132,13 @@ public class Board { if (hasRobotOnPosition(newPosition)) { RobotID otherRobotID = getRobotOnPosition(newPosition); if (otherRobotID != null && !moveRobot(otherRobotID, direction)) { + //The other robot can't be shoved. Give up. return false; } } - //Some tiles may kill the robot if stepped on. - if (killRobotIfStepsOnDangerousTile(robot, newPosition)) { - return true; - } robot.setPosition(newPosition); + //Some tiles may kill the robot if stepped on. + killRobotIfStepsOnDangerousTile(robot, newPosition); return true; } @@ -176,9 +175,8 @@ public class Board { * Checks the tile the robot is about to step on and kills it if the tile is dangerous * @param robot The robot attempting to move * @param newPosition The position the robot is attempting to move to - * @return True if the robot was killed by the tile */ - private boolean killRobotIfStepsOnDangerousTile(Robot robot, Position newPosition) { + private void killRobotIfStepsOnDangerousTile(Robot robot, Position newPosition) { Tile tileRobotStepsOn = tiles.getElement(newPosition.getXCoordinate(), newPosition.getYCoordinate()); if (tileRobotStepsOn == null) { throw new IllegalArgumentException("The game board is missing a tile. This should not happen."); @@ -186,9 +184,7 @@ public class Board { TileType tileTypeRobotStepsOn = tileRobotStepsOn.getTileType(); if (tileTypeRobotStepsOn == TileType.HOLE || tileTypeRobotStepsOn == TileType.DEATH_TILE) { killRobot(robot); - return true; } - return false; } /** diff --git a/src/main/java/inf112/fiasko/roborally/utility/TextureConverterUtil.java b/src/main/java/inf112/fiasko/roborally/utility/TextureConverterUtil.java index 6d66ada..d3328d6 100644 --- a/src/main/java/inf112/fiasko/roborally/utility/TextureConverterUtil.java +++ b/src/main/java/inf112/fiasko/roborally/utility/TextureConverterUtil.java @@ -173,14 +173,14 @@ public final class TextureConverterUtil { * This class serves as a temporary container for texture region coordinates */ private static class TextureConverterContainer { - private int xNorth; - private int yNorth; - private int xEast; - private int yEast; - private int xSouth; - private int ySouth; - private int xWest; - private int yWest; + private final int xNorth; + private final int yNorth; + private final int xEast; + private final int yEast; + private final int xSouth; + private final int ySouth; + private final int xWest; + private final int yWest; TextureConverterContainer(int xNorth, int yNorth, int xEast, int yEast, int xSouth, int ySouth, int xWest, int yWest) {