VASSAL.command
Class MovePiece
java.lang.Object
|
+--VASSAL.command.Command
|
+--VASSAL.command.MovePiece
- public class MovePiece
- extends Command
Command that moves a piece to a new location and position within a stack.
While this can be accomplished with a ChangePiece command, this
command is safer in terms of recovering from changes to the game state that may have occurred
since the command was created. For instance, A ChangePiece command that adds
a piece to a Stack will cause the piece to disappear if the
stack has been deleted. This Command will recover more gracefully.
|
Constructor Summary |
MovePiece(java.lang.String id,
java.lang.String newMapId,
java.awt.Point newPosition,
java.lang.String newUnderneathId,
java.lang.String oldMapId,
java.awt.Point oldPosition,
java.lang.String oldUnderneathId,
java.lang.String playerId)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
MovePiece
public MovePiece(java.lang.String id,
java.lang.String newMapId,
java.awt.Point newPosition,
java.lang.String newUnderneathId,
java.lang.String oldMapId,
java.awt.Point oldPosition,
java.lang.String oldUnderneathId,
java.lang.String playerId)
- Parameters:
id - The id of the piece being movednewMapId - The id of the map being moved tonewPosition - the new positionnewUnderneathId - The id of the piece which will be immediately beneath this piece in any containing Stack. May be nulloldMapId - The id of the map being moved fromoldPosition - the old positionoldUnderneathId - The id of the piece which was immediately beneath this piece in its original containing Stack.playerId - the id of the player making this move
getId
public java.lang.String getId()
getNewMapId
public java.lang.String getNewMapId()
getOldMapId
public java.lang.String getOldMapId()
getNewPosition
public java.awt.Point getNewPosition()
getOldPosition
public java.awt.Point getOldPosition()
getNewUnderneathId
public java.lang.String getNewUnderneathId()
getOldUnderneathId
public java.lang.String getOldUnderneathId()
getPlayerId
public java.lang.String getPlayerId()
executeCommand
protected void executeCommand()
- Description copied from class:
Command
- Perform the action which this Command represents
- Overrides:
executeCommand in class Command
myUndoCommand
protected Command myUndoCommand()
- Description copied from class:
Command
- If the action can be undone, return a Command that performs the
inverse action. The Command returned should only undo
Command.executeCommand(), not the actions of subcommands
- Overrides:
myUndoCommand in class Command
createMergeFinder
protected PieceVisitorDispatcher createMergeFinder(Map map,
GamePiece p,
java.awt.Point pt)
- Creates a new
PieceVisitorDispatcher that will create a Command object
to merge the target piece with any applicable pieces at the target location
- Parameters:
map - p - pt - - Returns:
-