megamek.common
Interface IBoard

All Known Implementing Classes:
Board

public interface IBoard


Method Summary
 void addBoardListener(BoardListener listener)
          Adds the specified board listener to receive board events from this board.
 void addInfernoTo(Coords coords, InfernoTracker.Inferno round, int hits)
          Record that the given coordinates have recieved a hit from an inferno.
 void addSpecialHexDisplay(Coords coords, SpecialHexDisplay shd)
           
 boolean burnInferno(Coords coords)
          Record that a new round of burning has passed for the given coordinates.
 void collapseBuilding(Building bldg)
          The given building has collapsed.
 void collapseBuilding(Coords coords)
          The given building hex has collapsed.
 void collapseBuilding(java.util.Vector<Coords> bldgs)
          Collapse an array of buildings.
 boolean contains(Coords c)
          Determines whether this Board "contains" the specified Coords.
 boolean contains(int x, int y)
          Determines whether this Board "contains" the specified Coords.
 Building getBuildingAt(Coords coords)
          Get the building at the given coordinates.
 java.util.Enumeration<Building> getBuildings()
          Get an enumeration of all buildings on the board.
 int getHeight()
           
 IHex getHex(Coords c)
          Returns the Hex at the specified Coords.
 IHex getHex(int x, int y)
          Determines if this Board contains the (x, y) Coords, and if so, returns the Hex at that position.
 java.util.Enumeration<Coords> getHexesAtDistance(Coords coords, int distance)
           
 IHex getHexInDir(Coords c, int dir)
          Gets the hex in the specified direction from the specified starting coordinates.
 IHex getHexInDir(int x, int y, int dir)
          Gets the hex in the specified direction from the specified starting coordinates.
 java.util.Enumeration<Coords> getInfernoBurningCoords()
          Get an enumeration of all coordinates with infernos still burning.
 int getInfernoBurnTurns(Coords coords)
          Determine the remaining number of turns the given coordinates will have a burning inferno.
 int getInfernoIVBurnTurns(Coords coords)
          Determine the remaining number of turns the given coordinates will have a burning Inferno IV round.
 java.util.Hashtable<Coords,InfernoTracker> getInfernos()
          returns a hash of the inferno trackers
 int getMaxElevation()
          Returns the highest elevation hex on the board.
 int getMinElevation()
          Returns the lowest elevation hex on the board.
 boolean getRoadsAutoExit()
          Get the current value of the "road auto-exit" option.
 java.util.Collection<SpecialHexDisplay> getSpecialHexDisplay(Coords coords)
          This returns special events that should be makred on hexes, such as artilery fire.
 java.util.Hashtable<Coords,java.util.Collection<SpecialHexDisplay>> getSpecialHexDisplayTable()
           
 int getType()
           
 int getWidth()
           
 boolean inAtmosphere()
           
 void initializeAround(int x, int y)
          Initialize a hex and the hexes around it
 boolean inSpace()
           
 boolean isInfernoBurning(Coords coords)
          Determine if the given coordinates has a burning inferno.
 boolean isLegalDeployment(Coords c, int nDir)
          Can the player deploy an entity here?
 void load(java.io.InputStream is)
          Loads this board from an InputStream
 void load(java.lang.String filename)
          Loads this board from a filename in data/boards
 void newData(int width, int height)
          Creates a new data set for the board, with the specified dimensions; notifies listeners that a new data set has been created.
 void newData(int width, int height, IHex[] data)
          Creates a new data set for the board, with the specified dimensions and data; notifies listeners that a new data set has been created.
 boolean onGround()
           
 void removeBoardListener(BoardListener listener)
          Removes the specified board listener.
 void removeInfernoFrom(Coords coords)
          Extinguish inferno at the target hex.
 void resetStoredElevation()
          Resets the Min and Max elevations to their default values.
 void save(java.io.OutputStream os)
          Writes data for the board, as text to the OutputStream
 void setBridgeCF(int value)
          Set the CF of bridges
 void setHex(Coords c, IHex hex)
          Sets the hex into the location specified by the Coords.
 void setHex(int x, int y, IHex hex)
          Determines if this Board contains the (x, y) Coords, and if so, sets the specified Hex into that position and initializes it.
 void setRoadsAutoExit(boolean value)
          Set the value of the "road auto-exit" option.
 void setSpecialHexDisplayTable(java.util.Hashtable<Coords,java.util.Collection<SpecialHexDisplay>> shd)
           
 void setType(int t)
           
 void updateBuildingCF(java.util.Vector<Building> bldgs)
          Update the construction factors on an array of buildings.
 

Method Detail

getWidth

int getWidth()
Returns:
Map widht in hexes

getHeight

int getHeight()
Returns:
Map height in hexes

newData

void newData(int width,
             int height,
             IHex[] data)
Creates a new data set for the board, with the specified dimensions and data; notifies listeners that a new data set has been created.

Parameters:
width - the width dimension.
height - the height dimension.
data - new hex data appropriate for the board.

newData

void newData(int width,
             int height)
Creates a new data set for the board, with the specified dimensions; notifies listeners that a new data set has been created.

Parameters:
width - the width dimension.
height - the height dimension.

getHex

IHex getHex(int x,
            int y)
Determines if this Board contains the (x, y) Coords, and if so, returns the Hex at that position.

Parameters:
x - the x Coords.
y - the y Coords.
Returns:
the Hex, if this Board contains the (x, y) location; null otherwise.

getHexInDir

IHex getHexInDir(Coords c,
                 int dir)
Gets the hex in the specified direction from the specified starting coordinates.

Parameters:
c - starting coordinates
dir - direction
Returns:
the hex in the specified direction from the specified starting coordinates.

getHexesAtDistance

java.util.Enumeration<Coords> getHexesAtDistance(Coords coords,
                                                 int distance)

getHexInDir

IHex getHexInDir(int x,
                 int y,
                 int dir)
Gets the hex in the specified direction from the specified starting coordinates. Avoids calls to Coords.translated, and thus, object construction.

Parameters:
x - starting x coordinate
y - starting y coordinate
dir - direction
Returns:
the hex in the specified direction from the specified starting coordinates.

initializeAround

void initializeAround(int x,
                      int y)
Initialize a hex and the hexes around it


contains

boolean contains(int x,
                 int y)
Determines whether this Board "contains" the specified Coords.

Parameters:
x - the x Coords.
y - the y Coords.
Returns:
true if the board contains the specified coords

contains

boolean contains(Coords c)
Determines whether this Board "contains" the specified Coords.

Parameters:
c - the Coords.
Returns:
true if the board contains the specified coords

getHex

IHex getHex(Coords c)
Returns the Hex at the specified Coords.

Parameters:
c - the Coords.

setHex

void setHex(int x,
            int y,
            IHex hex)
Determines if this Board contains the (x, y) Coords, and if so, sets the specified Hex into that position and initializes it.

Parameters:
x - the x Coords.
y - the y Coords.
hex - the hex to be set into position.

setHex

void setHex(Coords c,
            IHex hex)
Sets the hex into the location specified by the Coords.

Parameters:
c - the Coords.
hex - the hex to be set into position.

addBoardListener

void addBoardListener(BoardListener listener)
Adds the specified board listener to receive board events from this board.

Parameters:
listener - the board listener.

removeBoardListener

void removeBoardListener(BoardListener listener)
Removes the specified board listener.

Parameters:
listener - the board listener.

isLegalDeployment

boolean isLegalDeployment(Coords c,
                          int nDir)
Can the player deploy an entity here? There are no canon rules for the deployment phase (?!). I'm using 3 hexes from map edge.


addInfernoTo

void addInfernoTo(Coords coords,
                  InfernoTracker.Inferno round,
                  int hits)
Record that the given coordinates have recieved a hit from an inferno.

Parameters:
coords - - the Coords of the hit.
round - - the kind of round that hit the hex.
hits - - the int number of rounds that hit. If a negative number is passed, then an IllegalArgumentException will be thrown.

removeInfernoFrom

void removeInfernoFrom(Coords coords)
Extinguish inferno at the target hex.

Parameters:
coords - - the Coords of the hit.

isInfernoBurning

boolean isInfernoBurning(Coords coords)
Determine if the given coordinates has a burning inferno.

Parameters:
coords - - the Coords being checked.
Returns:
true if those coordinates have a burning inferno round. false if no inferno has hit those coordinates or if it has burned out.

burnInferno

boolean burnInferno(Coords coords)
Record that a new round of burning has passed for the given coordinates. This routine also determines if the fire is still burning.

Parameters:
coords - - the Coords being checked.
Returns:
true if those coordinates have a burning inferno round. false if no inferno has hit those coordinates or if it has burned out.

getInfernoBurningCoords

java.util.Enumeration<Coords> getInfernoBurningCoords()
Get an enumeration of all coordinates with infernos still burning.

Returns:
an Enumeration of Coords that have infernos still burning.

getInfernos

java.util.Hashtable<Coords,InfernoTracker> getInfernos()
returns a hash of the inferno trackers

Returns:
an HashtableInfernoTrackers on the board.

getInfernoBurnTurns

int getInfernoBurnTurns(Coords coords)
Determine the remaining number of turns the given coordinates will have a burning inferno.

Parameters:
coords - - the Coords being checked. This value must not be null. Unchecked.
Returns:
the int number of burn turns left for all infernos This value will be non-negative.

getInfernoIVBurnTurns

int getInfernoIVBurnTurns(Coords coords)
Determine the remaining number of turns the given coordinates will have a burning Inferno IV round.

Parameters:
coords - - the Coords being checked. This value must not be null. Unchecked.
Returns:
the int number of burn turns left for Arrow IV infernos. This value will be non-negative.

getSpecialHexDisplay

java.util.Collection<SpecialHexDisplay> getSpecialHexDisplay(Coords coords)
This returns special events that should be makred on hexes, such as artilery fire.


addSpecialHexDisplay

void addSpecialHexDisplay(Coords coords,
                          SpecialHexDisplay shd)

setSpecialHexDisplayTable

void setSpecialHexDisplayTable(java.util.Hashtable<Coords,java.util.Collection<SpecialHexDisplay>> shd)

getSpecialHexDisplayTable

java.util.Hashtable<Coords,java.util.Collection<SpecialHexDisplay>> getSpecialHexDisplayTable()

getBuildings

java.util.Enumeration<Building> getBuildings()
Get an enumeration of all buildings on the board.

Returns:
an Enumeration of Buildings.

getBuildingAt

Building getBuildingAt(Coords coords)
Get the building at the given coordinates.

Parameters:
coords - - the Coords being examined.
Returns:
a Building object, if there is one at the given coordinates, otherwise a null will be returned.

collapseBuilding

void collapseBuilding(java.util.Vector<Coords> bldgs)
Collapse an array of buildings.

Parameters:
bldgs - - the Vector of Building objects to be collapsed.

collapseBuilding

void collapseBuilding(Building bldg)
The given building has collapsed. Remove it from the board and replace it with rubble.

Parameters:
bldg - - the Building that has collapsed.

collapseBuilding

void collapseBuilding(Coords coords)
The given building hex has collapsed. Remove it from the board and replace it with rubble.

Parameters:
coords - - the Building that has collapsed.

updateBuildingCF

void updateBuildingCF(java.util.Vector<Building> bldgs)
Update the construction factors on an array of buildings.

Parameters:
bldgs - - the Vector of Building objects to be updated.

getRoadsAutoExit

boolean getRoadsAutoExit()
Get the current value of the "road auto-exit" option.

Returns:
true if roads should automatically exit onto all adjacent pavement hexes. false otherwise.

setRoadsAutoExit

void setRoadsAutoExit(boolean value)
Set the value of the "road auto-exit" option.

Parameters:
value - - The value to set for the option; true if roads should automatically exit onto all adjacent pavement hexes. false otherwise.

setBridgeCF

void setBridgeCF(int value)
Set the CF of bridges

Parameters:
value - - The value to set the bridge CF to.

setType

void setType(int t)

getType

int getType()

onGround

boolean onGround()

inAtmosphere

boolean inAtmosphere()

inSpace

boolean inSpace()

load

void load(java.lang.String filename)
Loads this board from a filename in data/boards

Parameters:
filename - filename to load from

load

void load(java.io.InputStream is)
Loads this board from an InputStream

Parameters:
is - input stream

save

void save(java.io.OutputStream os)
Writes data for the board, as text to the OutputStream

Parameters:
os - output stream

getMinElevation

int getMinElevation()
Returns the lowest elevation hex on the board.

Returns:

getMaxElevation

int getMaxElevation()
Returns the highest elevation hex on the board.

Returns:

resetStoredElevation

void resetStoredElevation()
Resets the Min and Max elevations to their default values.