Class games.Battle.shared.sys.Cell
All Packages Class Hierarchy This Package Previous Next Index
Class games.Battle.shared.sys.Cell
java.lang.Object
|
+----games.Battle.shared.sys.Cell
- public class Cell
- extends Object
A base class for an individual cell (square) in the game board. Both the
client and server derive more specialized versions of cell to store the
infomration that is of interest to them.
-
Cell(int, int)
- construct a general battle game cell
-
clearModified()
- clear the contents modified flag
-
clearPipes()
- clear all the pipes in this cell.
-
clearTerrainModified()
- clear the terrain modified flag
-
getCity()
- return the city amount
-
getCol()
- return the column that this cell is in
-
getOccupancy()
- return the occupancy
-
getPipe(int)
- return the state of the pipe in the direction given
-
getPipeMask()
- build a pipe mask from the current pipe state.
-
getPipes()
- return the array of pipes.
-
getRow()
- return the row that this cell is in
-
getTerrain()
- return the level of the terrain in this cell.
-
getTroops()
- return the number of troops in this cell
-
isModified()
- return true if this cell's contents have been modified
-
isTerrainModified()
- return true if this cell's terrain has been modified
-
isVisible(int)
- return whether or not this cell is visible to a particuler player.
-
setCity(int)
- set the city construction amount
-
setCity()
- Make this cell a functioning city (i.e.
-
setModified()
- set the content modified flag
-
setOccupancy(int)
- set the occupancy
-
setPipe(int, boolean)
- set or clear a pipe in the given direction.
-
setPipes(int)
- special method for setting pipes.
-
setTerrain(int)
- set the height of the terrain in this cell.
-
setTerrainModified()
- set the terrain modified flag
-
setTroops(int)
- set how many troops are in this cell.
Cell
public Cell(int r,
int c)
- construct a general battle game cell
- Parameters:
- r - the row
- c - the column
setOccupancy
public final void setOccupancy(int occ)
- set the occupancy
setCity
public final void setCity(int amt)
- set the city construction amount
- Parameters:
- amt - the amount of city that is here. Always complete
cities for now.
setPipe
public final void setPipe(int dir,
boolean state)
- set or clear a pipe in the given direction.
- Parameters:
- dir - the direction; 0 is north. defines are in Symbols
- state - the state of the pipe, on or off.
clearPipes
public final void clearPipes()
- clear all the pipes in this cell.
setTerrain
public final void setTerrain(int level)
- set the height of the terrain in this cell.
- Parameters:
- level - the height of the land.
setTroops
public final void setTroops(int num)
- set how many troops are in this cell.
- Parameters:
- num - the number of troops.
setPipes
public final void setPipes(int mask)
- special method for setting pipes. the lower four bits in
mask indicate which pipes are on and which are off. bits
3, 2, 1, and 0 represent the north, east, south and west
pipes, respectively
This method is convenient because of the way data is transmitted
between client and server.
- Parameters:
- mask - the bitmask of pipes.
getOccupancy
public final int getOccupancy()
- return the occupancy
getCity
public final int getCity()
- return the city amount
getPipes
public final boolean[] getPipes()
- return the array of pipes.
getPipe
public final boolean getPipe(int dir)
- return the state of the pipe in the direction given
- Parameters:
- dir - the direction
getPipeMask
public final int getPipeMask()
- build a pipe mask from the current pipe state. The lower four
bits of the returned int represent the state of each pipe.
getTerrain
public final int getTerrain()
- return the level of the terrain in this cell.
getTroops
public final int getTroops()
- return the number of troops in this cell
getRow
public final int getRow()
- return the row that this cell is in
getCol
public final int getCol()
- return the column that this cell is in
isModified
public final boolean isModified()
- return true if this cell's contents have been modified
isTerrainModified
public final boolean isTerrainModified()
- return true if this cell's terrain has been modified
clearModified
public void clearModified()
- clear the contents modified flag
clearTerrainModified
public void clearTerrainModified()
- clear the terrain modified flag
setModified
public final void setModified()
- set the content modified flag
setTerrainModified
public final void setTerrainModified()
- set the terrain modified flag
isVisible
public boolean isVisible(int player)
- return whether or not this cell is visible to a particuler player.
this method should be overridden to create the effect of invisible
cells.
setCity
public void setCity()
- Make this cell a functioning city (i.e. a city with the maximum
number of city segments.
All Packages Class Hierarchy This Package Previous Next Index