Rabbit Escape  2017-01-14_18:33:47_+0000__(tag:_v0.10.1)
Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Static Private Attributes | List of all members
rabbitescape.engine.util.WaterUtil Class Reference
Collaboration diagram for rabbitescape.engine.util.WaterUtil:
Collaboration graph
[legend]

Static Public Member Functions

static Map< CellularDirection, WaterRegionfindNeighbourhood (WaterRegion region, LookupTable2D< WaterRegion > waterTable)
 
static Map< CellularDirection, Integer > calculateFlow (Map< CellularDirection, WaterRegion > neighbourhood)
 

Static Public Attributes

static final int QUARTER_CAPACITY = 256
 
static final int HALF_CAPACITY = QUARTER_CAPACITY * 2
 
static final int MAX_CAPACITY = HALF_CAPACITY * 2
 
static final int SOURCE_RATE = 512
 

Static Private Member Functions

static int updateFlow (Map< CellularDirection, Integer > flow, Map< CellularDirection, Integer > relevantContents, Map< CellularDirection, Integer > relevantCapacity)
 
static int updateFlowDown (Map< CellularDirection, Integer > flow, int contentsHere, Map< CellularDirection, WaterRegion > neighbourhood)
 
static int updateFlowAcross (Map< CellularDirection, Integer > flow, int contentsHere, Map< CellularDirection, WaterRegion > neighbourhood)
 
static int updateFlowHere (Map< CellularDirection, Integer > flow, int contentsHere, Map< CellularDirection, WaterRegion > neighbourhood)
 
static int updateFlowUp (Map< CellularDirection, Integer > flow, int contentsHere, Map< CellularDirection, WaterRegion > neighbourhood)
 

Static Private Attributes

static final int COMPRESSION_FACTOR = 4
 
static final int MAGIC_UP_NUMERATOR = 11
 
static final int MAGIC_UP_DENOMINATOR = 20
 
static final WaterRegion FAKE_REGION = new WaterRegion(0, 0, null, 0)
 

Member Function Documentation

static Map<CellularDirection, Integer> rabbitescape.engine.util.WaterUtil.calculateFlow ( Map< CellularDirection, WaterRegion neighbourhood)
static
static Map<CellularDirection, WaterRegion> rabbitescape.engine.util.WaterUtil.findNeighbourhood ( WaterRegion  region,
LookupTable2D< WaterRegion waterTable 
)
static

Find all WaterRegions connected to the current region.

static int rabbitescape.engine.util.WaterUtil.updateFlow ( Map< CellularDirection, Integer >  flow,
Map< CellularDirection, Integer >  relevantContents,
Map< CellularDirection, Integer >  relevantCapacity 
)
staticprivate

Update the flow given some contents to split between some directions in ratio with the capacities.

static int rabbitescape.engine.util.WaterUtil.updateFlowAcross ( Map< CellularDirection, Integer >  flow,
int  contentsHere,
Map< CellularDirection, WaterRegion neighbourhood 
)
staticprivate

Update flow across and a bit down to simulate pressure at this level.

static int rabbitescape.engine.util.WaterUtil.updateFlowDown ( Map< CellularDirection, Integer >  flow,
int  contentsHere,
Map< CellularDirection, WaterRegion neighbourhood 
)
staticprivate
static int rabbitescape.engine.util.WaterUtil.updateFlowHere ( Map< CellularDirection, Integer >  flow,
int  contentsHere,
Map< CellularDirection, WaterRegion neighbourhood 
)
staticprivate

Create a 'flow' to the current cell. Any remaining can be pushed upwards.

static int rabbitescape.engine.util.WaterUtil.updateFlowUp ( Map< CellularDirection, Integer >  flow,
int  contentsHere,
Map< CellularDirection, WaterRegion neighbourhood 
)
staticprivate

Update flow up and a bit across and down to simulate pressure at the level above.

Member Data Documentation

final int rabbitescape.engine.util.WaterUtil.COMPRESSION_FACTOR = 4
staticprivate

A cell can hold 1/COMPRESSION_FACTOR extra if the cell above is full (assuming both have same capacity).

final WaterRegion rabbitescape.engine.util.WaterUtil.FAKE_REGION = new WaterRegion(0, 0, null, 0)
staticprivate

A fake water region, for referencing in situations where there is no water region in a given direction.

final int rabbitescape.engine.util.WaterUtil.HALF_CAPACITY = QUARTER_CAPACITY * 2
static

The maximum capacity of water that can be held in a half empty tile without it overflowing.

final int rabbitescape.engine.util.WaterUtil.MAGIC_UP_DENOMINATOR = 20
staticprivate
final int rabbitescape.engine.util.WaterUtil.MAGIC_UP_NUMERATOR = 11
staticprivate

A magic constant for encouraging water to flow upwards.

final int rabbitescape.engine.util.WaterUtil.MAX_CAPACITY = HALF_CAPACITY * 2
static

The maximum capacity of water that can be held in an empty tile without it overflowing.

final int rabbitescape.engine.util.WaterUtil.QUARTER_CAPACITY = 256
static

The maximum capacity of water that can be held in a quarter empty tile without it overflowing.

final int rabbitescape.engine.util.WaterUtil.SOURCE_RATE = 512
static

The default rate at which pipes produce water.


The documentation for this class was generated from the following file: