mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-02-01 07:39:35 +01:00
Endret metodenavn for mer lesbarhet
This commit is contained in:
parent
f01576d34e
commit
14dfbea630
@ -345,7 +345,7 @@ public class Board {
|
|||||||
* @param walls The walls you want all positions for
|
* @param walls The walls you want all positions for
|
||||||
* @return A list of BoardElementContainers
|
* @return A list of BoardElementContainers
|
||||||
*/
|
*/
|
||||||
public List<BoardElementContainer<Wall>> getPositionsOfTileOnBoard(WallType ... walls) {
|
public List<BoardElementContainer<Wall>> getPositionsOfWallOnBoard(WallType ... walls) {
|
||||||
List<BoardElementContainer<Wall>> combinedList = new ArrayList<>();
|
List<BoardElementContainer<Wall>> combinedList = new ArrayList<>();
|
||||||
for (WallType wall : walls) {
|
for (WallType wall : walls) {
|
||||||
combinedList.addAll(makeTileList(wall, this.walls));
|
combinedList.addAll(makeTileList(wall, this.walls));
|
||||||
@ -367,18 +367,20 @@ public class Board {
|
|||||||
for (int y = grid.getHeight() - 1; y >= 0; y--) {
|
for (int y = grid.getHeight() - 1; y >= 0; y--) {
|
||||||
for (int x = 0; x < grid.getWidth(); x++) {
|
for (int x = 0; x < grid.getWidth(); x++) {
|
||||||
T gridElement = grid.getElement(x, y);
|
T gridElement = grid.getElement(x, y);
|
||||||
if (gridElement.getClass().isAssignableFrom(Tile.class)) {
|
if (gridElement != null) {
|
||||||
Tile tile = (Tile) gridElement;
|
if (gridElement.getClass().isAssignableFrom(Tile.class)) {
|
||||||
if (tile.getTileType() == type) {
|
Tile tile = (Tile) gridElement;
|
||||||
objList.add(new BoardElementContainer<>(gridElement, new Position(x,y)));
|
if (tile.getTileType() == type) {
|
||||||
|
objList.add(new BoardElementContainer<>(gridElement, new Position(x,y)));
|
||||||
|
}
|
||||||
|
} else if (gridElement.getClass().isAssignableFrom(Wall.class)) {
|
||||||
|
Wall wall = (Wall) gridElement;
|
||||||
|
if (wall.getWallType() == type) {
|
||||||
|
objList.add(new BoardElementContainer<>(gridElement, new Position(x,y)));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("Grid has unknown type.");
|
||||||
}
|
}
|
||||||
} else if (gridElement.getClass().isAssignableFrom(Wall.class)) {
|
|
||||||
Wall wall = (Wall) gridElement;
|
|
||||||
if (wall.getWallType() == type) {
|
|
||||||
objList.add(new BoardElementContainer<>(gridElement, new Position(x,y)));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new IllegalArgumentException("Grid has unknown type.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user