public class MultiSpill extends Object
Modifier and Type | Field and Description |
---|---|
boolean[][] |
anySpillMap
The cells that are filled by the any spiller will be true, others will be false.
|
int |
filled
The amount of cells filled by this Spill, which may be less than the volume passed to start() if the boundaries
are reached on all sides and the Spill has no more room to fill.
|
int |
height
Height of the map.
|
Spill.Measurement |
measurement
This affects how distance is measured on diagonal directions vs.
|
boolean[][] |
physicalMap
Stores which parts of the map are accessible (with a value of true) and which are not (with a value of false,
including both walls and unreachable sections of the map).
|
StatefulRNG |
rng
The StatefulRNG used to decide how to randomly fill a space; can have its state set and read.
|
short[][] |
spillMap
The cells that are filled by the a spiller with index n when it reaches its volume or limits will be equal to n;
others will be -1.
|
ArrayList<ArrayList<Coord>> |
spreadPattern
Each spiller in the MultiSpill corresponds to a list of points that it will randomly fill, starting with the
initial point for each spiller passed to start(), in order of when they are reached.
|
int |
width
Width of the map.
|
Constructor and Description |
---|
MultiSpill()
Construct a Spill without a level to actually scan.
|
MultiSpill(char[][] level)
Constructor meant to take a char[][] returned by DungeonGen.generate(), or any other
char[][] where '#' means a wall and anything else is a walkable tile.
|
MultiSpill(char[][] level,
char alternateWall)
Constructor meant to take a char[][] returned by DungeonGen.generate(), or any other
char[][] where one char means a wall and anything else is a walkable tile.
|
MultiSpill(char[][] level,
Spill.Measurement measurement)
Constructor meant to take a char[][] returned by DungeonGen.generate(), or any other
char[][] where '#' means a wall and anything else is a walkable tile.
|
MultiSpill(char[][] level,
Spill.Measurement measurement,
RNG random)
Constructor meant to take a char[][] returned by DungeonGen.generate(), or any other
char[][] where '#' means a wall and anything else is a walkable tile.
|
MultiSpill(RNG random)
Construct a Spill without a level to actually scan.
|
MultiSpill(short[][] level)
Used to construct a Spill from the output of another.
|
MultiSpill(short[][] level,
Spill.Measurement measurement)
Used to construct a Spill from the output of another, specifying a distance calculation.
|
Modifier and Type | Method and Description |
---|---|
MultiSpill |
initialize(char[][] level)
Used to initialize or re-initialize a Spill that needs a new PhysicalMap because it either wasn't given
one when it was constructed, or because the contents of the terrain have changed permanently (not if a
creature moved; for that you pass the positions of creatures that block paths to scan() or findPath() ).
|
MultiSpill |
initialize(char[][] level,
char alternateWall)
Used to initialize or re-initialize a Spill that needs a new PhysicalMap because it either wasn't given
one when it was constructed, or because the contents of the terrain have changed permanently (not if a
creature moved; for that you pass the positions of creatures that block paths to scan() or findPath() ).
|
MultiSpill |
initialize(short[][] level)
Used to initialize or re-initialize a Spill that needs a new PhysicalMap because it either wasn't given
one when it was constructed, or because the contents of the terrain have changed permanently.
|
void |
reset()
Resets this Spill to a state with an empty spillMap and an empty spreadPattern.
|
void |
resetCell(Coord pt)
Reverts a cell to an unfilled state (false in spillMap).
|
void |
resetCell(int x,
int y)
Reverts a cell to an unfilled state (false in spillMap).
|
void |
resetMap()
Resets the spillMap to being empty.
|
protected void |
setFresh(int idx,
Coord pt) |
protected void |
setFresh(int idx,
int x,
int y) |
ArrayList<ArrayList<Coord>> |
start(LinkedHashMap<Coord,Double> entries,
int volume,
Set<Coord> impassable)
Recalculate the spillMap and return the spreadPattern.
|
ArrayList<ArrayList<Coord>> |
start(List<Coord> entries,
int volume,
Set<Coord> impassable)
Recalculate the spillMap and return the spreadPattern.
|
public Spill.Measurement measurement
public boolean[][] physicalMap
public short[][] spillMap
public boolean[][] anySpillMap
public ArrayList<ArrayList<Coord>> spreadPattern
public int height
public int width
public int filled
public StatefulRNG rng
public MultiSpill()
public MultiSpill(RNG random)
random
- an RNG that will be converted to a StatefulRNG if it is not one alreadypublic MultiSpill(short[][] level)
level
- a short[][] that should have been the spillMap of another MultiSpillpublic MultiSpill(short[][] level, Spill.Measurement measurement)
level
- a short[][] that should have been the spillMap of another MultiSpillmeasurement
- a Spill.Measurement that should usually be MANHATTANpublic MultiSpill(char[][] level)
level
- a char[][] that should use '#' for walls and '.' for floorspublic MultiSpill(char[][] level, char alternateWall)
level
- a char[][] that should use alternateWall for walls and '.' for floorsalternateWall
- the char to use for wallspublic MultiSpill(char[][] level, Spill.Measurement measurement)
level
- a char[][] that should use '#' for walls and '.' for floorsmeasurement
- a Spill.Measurement that should usually be MANHATTANpublic MultiSpill(char[][] level, Spill.Measurement measurement, RNG random)
level
- a char[][] that should use '#' for walls and '.' for floorsmeasurement
- a Spill.Measurement that should usually be MANHATTANrandom
- an RNG that will be converted to a StatefulRNG if it is not one alreadypublic MultiSpill initialize(short[][] level)
level
- a short[][] that should have been the spillMap of another MultiSpillpublic MultiSpill initialize(char[][] level)
level
- a char[][] that should use '#' for walls and '.' for floorspublic MultiSpill initialize(char[][] level, char alternateWall)
level
- a char[][] that should use alternateWall for walls and '.' for floorsalternateWall
- the char to use for wallspublic void resetMap()
public void reset()
public void resetCell(int x, int y)
x
- y
- public void resetCell(Coord pt)
pt
- protected void setFresh(int idx, int x, int y)
public ArrayList<ArrayList<Coord>> start(List<Coord> entries, int volume, Set<Coord> impassable)
entries
- the first cell for each spiller to spread from, which should really be passable.volume
- the total number of cells to attempt to fill; if negative will fill the whole map.impassable
- a Set of Position keys representing the locations of moving obstacles to a
fill that cannot be moved through; this can be null if there are no such obstacles.public ArrayList<ArrayList<Coord>> start(LinkedHashMap<Coord,Double> entries, int volume, Set<Coord> impassable)
entries
- key: the first cell for each spiller to spread from. value: the bias toward advancing this key;
1.0 will always advance, 0.0 will never advance beyond the key, in between will randomly choosevolume
- the total number of cells to attempt to fill; if negative will fill the whole map.impassable
- a Set of Position keys representing the locations of moving obstacles to a
fill that cannot be moved through; this can be null if there are no such obstacles.Copyright © 2012–2016. All rights reserved.