public class MapModule extends Object implements Comparable<MapModule>, Serializable
Modifier and Type | Field and Description |
---|---|
ArrayList<Coord> |
bottomDoors |
int |
category |
int[][] |
environment
The room/cave/corridor/wall status for each cell of this section of map.
|
ArrayList<Coord> |
leftDoors |
char[][] |
map
The contents of this section of map.
|
Coord |
max
The maximum point on the bounding rectangle of the room, including walls.
|
Coord |
min
The minimum point on the bounding rectangle of the room, including walls.
|
ArrayList<Coord> |
rightDoors |
ArrayList<Coord> |
topDoors |
Coord[] |
validDoors
Stores Coords just outside the contents of the MapModule, where doors are allowed to connect into this.
|
Constructor and Description |
---|
MapModule() |
MapModule(char[][] map)
Constructs a MapModule given only a 2D char array as the contents of this section of map.
|
MapModule(char[][] map,
Coord[] validDoors,
Coord min,
Coord max)
Constructs a MapModule from the given arguments without modifying them, copying map without changing its size,
copying validDoors, and using the same min and max (which are immutable, so they can be reused).
|
MapModule(MapModule other)
Copies another MapModule and uses it to construct a new one.
|
MapModule(short[] packed,
int width,
int height)
Constructs a MapModule given only a short array of packed data (as produced by CoordPacker and consumed or produced
by several other classes) that when unpacked will yield the contents of this section of map.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(MapModule o) |
MapModule |
flip(boolean flipLeftRight,
boolean flipUpDown) |
MapModule |
rotate(int turns)
Rotates a copy of this MapModule by the given number of 90-degree turns.
|
public char[][] map
public int[][] environment
public Coord[] validDoors
public ArrayList<Coord> rightDoors
public ArrayList<Coord> bottomDoors
public int category
public MapModule()
public MapModule(char[][] map)
map
- the 2D char array that contains the contents of this section of mappublic MapModule(short[] packed, int width, int height)
packed
- the short array, as packed data from CoordPacker, that contains the contents of this section of mappublic MapModule(char[][] map, Coord[] validDoors, Coord min, Coord max)
map
- the 2D char array that contains the contents of this section of map; will be copied exactlyvalidDoors
- a Coord array that stores viable locations to place doors in map; will be clonedmin
- the minimum Coord of this MapModule's bounding rectanglemax
- the maximum Coord of this MapModule's bounding rectanglepublic MapModule rotate(int turns)
turns
- the number of 90 degree turns to adjust this bypublic int compareTo(MapModule o)
compareTo
in interface Comparable<MapModule>
Copyright © 2012–2016. All rights reserved.