soc.game
Class SOCRoad
java.lang.Object
soc.game.SOCPlayingPiece
soc.game.SOCRoad
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
- Direct Known Subclasses:
- SOCShip
public class SOCRoad
- extends SOCPlayingPiece
A road playing piece, or (on the large sea board) a ship
playing piece.
To simplify some game code, ships are a subclass of roads.
To see if this piece is actually a road, check isRoadNotShip()
.
- See Also:
- Serialized Form
Fields inherited from class soc.game.SOCPlayingPiece |
board, CITY, coord, FORTRESS, MAXPLUSONE, MIN, pieceType, player, ROAD, SETTLEMENT, SHIP, specialVP, specialVPEvent, VILLAGE |
Method Summary |
int[] |
getAdjacentNodes()
The 2 nodes touching this road. |
boolean |
isRoadNotShip()
Is this piece really a road on land, and not a ship on water (our subclass)? |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
SOCRoad
public SOCRoad(SOCPlayer pl,
int co,
SOCBoard board)
throws java.lang.IllegalArgumentException
- Make a new road
- Parameters:
pl
- player who owns the roadco
- coordinatesboard
- board if known; otherwise will extract from pl
- Throws:
java.lang.IllegalArgumentException
- if pl null, or board null and pl.board also null
getAdjacentNodes
public int[] getAdjacentNodes()
- The 2 nodes touching this road.
- Returns:
- the 2 nodes touching this road, same format as
SOCBoard.getAdjacentNodesToEdge_arr(int)
isRoadNotShip
public final boolean isRoadNotShip()
- Is this piece really a road on land, and not a ship on water (our subclass)?
- Returns:
- True for roads (pieceType
SOCPlayingPiece.ROAD
), false otherwise - Since:
- 2.0.00