megamek.common
Interface IHex

All Superinterfaces:
java.lang.Cloneable
All Known Implementing Classes:
Hex

public interface IHex
extends java.lang.Cloneable

IHex represents a single hex on the board.


Method Summary
 void addTerrain(ITerrain terrain)
          Adds the specified terrain
 int ceiling()
           
 void clearExits()
          Clears the "exits" flag for all terrains in the hex where it is not manually specified.
 boolean containsTerrain(int type)
           
 boolean containsTerrain(int type, int level)
           
 boolean containsTerrainExit(int terrType, int direction)
          Determine if this Hex contains the indicated terrain that exits in the specified direction.
 int depth()
           
 int displayableTerrainsPresent()
           
 IHex duplicate()
           
 int floor()
           
 int getBogDownModifier(EntityMovementMode moveMode, boolean largeVee)
           
 Coords getCoords()
           
 int getElevation()
           
 int getFireTurn()
           
 int getIgnitionModifier()
           
 ITerrain getTerrain(int type)
           
 java.lang.String getTheme()
          The theme is intended as a tag for the tileset file to indicate a special graphic for the hex.
 int getUnstuckModifier(int elev)
           
 boolean hasPavement()
           
 void incrementFireTurn()
           
 boolean isClear()
           
 boolean isIgnitable()
           
 int movementCost(EntityMovementMode moveType)
          (Only if statically determinable)
 void removeAllTerrains()
          Removes all Terreains from the hex.
 void removeTerrain(int type)
          Removes the specified terrain
 void resetFireTurn()
           
 void setElevation(int elevation)
          set the elevation
 void setExits(IHex other, int direction)
          Sets the "exits" flag appropriately, assuming the specified hex lies in the specified direction on the board.
 void setExits(IHex other, int direction, boolean roadsAutoExit)
          Sets the "exits" flag appropriately, assuming the specified hex lies in the specified direction on the board.
 void setTheme(java.lang.String theme)
          Set the hex theme.
 int surface()
           
 int terrainLevel(int type)
           
 int terrainPilotingModifier(EntityMovementMode moveType)
           
 int terrainsPresent()
           
 

Method Detail

getElevation

int getElevation()
Returns:
hex elevation

setElevation

void setElevation(int elevation)
set the elevation

Parameters:
elevation -

getTheme

java.lang.String getTheme()
The theme is intended as a tag for the tileset file to indicate a special graphic for the hex.

Returns:
theme name

setTheme

void setTheme(java.lang.String theme)
Set the hex theme.

Parameters:
theme - theme name
See Also:
getTheme

clearExits

void clearExits()
Clears the "exits" flag for all terrains in the hex where it is not manually specified.


setExits

void setExits(IHex other,
              int direction)
Sets the "exits" flag appropriately, assuming the specified hex lies in the specified direction on the board. Does not reset connects in other directions. All Terrain.ROADs will exit onto Terrain.PAVEMENT hexes automatically.

Parameters:
other - neighbour hex
direction - - the int direction of the exit. This value should be between 0 and 5 (inclusive).
See Also:
setExits(IHex, int, boolean)

setExits

void setExits(IHex other,
              int direction,
              boolean roadsAutoExit)
Sets the "exits" flag appropriately, assuming the specified hex lies in the specified direction on the board. Does not reset connects in other directions. If the value of roadsAutoExit is true, any Terrain.ROAD will exit onto Terrain.PAVEMENT hexes automatically.

Parameters:
other - neighbour hex
direction - - the int direction of the exit. This value should be between 0 and 5 (inclusive).
roadsAutoExit -
See Also:
setExits(IHex, int)

containsTerrainExit

boolean containsTerrainExit(int terrType,
                            int direction)
Determine if this Hex contains the indicated terrain that exits in the specified direction.

Parameters:
terrType - - the int type of the terrain.
direction - - the int direction of the exit. This value should be between 0 and 5 (inclusive).
Returns:
true if this Hex contains the indicated terrain that exits in the specified direction. false if bad input is supplied, if no such terrain exists, or if it doesn't exit in that direction.
See Also:
setExits(IHex, int, boolean)

ceiling

int ceiling()
Returns:
the highest level that features in this hex extend to. Above this level is assumed to be air.

surface

int surface()
Returns:
the surface level of the hex. Equal to getElevation().

floor

int floor()
Returns:
the lowest level that features in this hex extend to. Below this level is assumed to be bedrock.

depth

int depth()
Returns:
a level indicating how far features in this hex extend below the surface elevation.

hasPavement

boolean hasPavement()
Returns:
true if there is pavement, a road or a bridge in the hex.

containsTerrain

boolean containsTerrain(int type)
Parameters:
type - terrain to check
Returns:
true if the specified terrain is represented in the hex at any level.
See Also:
containsTerrain(int, int)

containsTerrain

boolean containsTerrain(int type,
                        int level)
Parameters:
type - terrain type to check
level - level to check the presence of the given terrain at
Returns:
true if the specified terrain is represented in the hex at given level.
See Also:
containsTerrain(int)

terrainLevel

int terrainLevel(int type)
Returns:
the level of the terrain specified, or ITerrain.LEVEL_NONE if the terrain is not present in the hex

getTerrain

ITerrain getTerrain(int type)
Parameters:
type -
Returns:
the terrain of the specified type, or null if the terrain is not present in the hex

addTerrain

void addTerrain(ITerrain terrain)
Adds the specified terrain

Parameters:
terrain - terrain to add

removeTerrain

void removeTerrain(int type)
Removes the specified terrain

Parameters:
type -

removeAllTerrains

void removeAllTerrains()
Removes all Terreains from the hex.


displayableTerrainsPresent

int displayableTerrainsPresent()
Returns:
the number of terrain attributes present that are displayable in tooltips

terrainsPresent

int terrainsPresent()
Returns:
the number of terrain attributes present

duplicate

IHex duplicate()
Returns:
new hex wich is equals to this

terrainPilotingModifier

int terrainPilotingModifier(EntityMovementMode moveType)
Returns:
modifier to PSRs made in the hex

movementCost

int movementCost(EntityMovementMode moveType)
(Only if statically determinable)

Returns:
extra movement cost for entering the hex

getIgnitionModifier

int getIgnitionModifier()
Returns:
the modifier to the roll to ignite this hex

isIgnitable

boolean isIgnitable()
Returns:
true if this hex is ignitable

getFireTurn

int getFireTurn()

incrementFireTurn

void incrementFireTurn()

resetFireTurn

void resetFireTurn()

getBogDownModifier

int getBogDownModifier(EntityMovementMode moveMode,
                       boolean largeVee)

getUnstuckModifier

int getUnstuckModifier(int elev)

isClear

boolean isClear()

getCoords

Coords getCoords()