Package VASSAL.command
Class MovePiece
java.lang.Object
VASSAL.command.Command
VASSAL.command.MovePiece
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
-
Method Summary
Modifier and TypeMethodDescriptionprotected PieceVisitorDispatcher
createMergeFinder
(Map map, GamePiece p, Point pt) Creates a newPieceVisitorDispatcher
that will create aCommand
object to merge the target piece with any applicable pieces at the target locationprotected void
Perform the action which this Command representsDetailed information for toString()getId()
protected Command
If the action can be undone, return a Command that performs the inverse action.Methods inherited from class VASSAL.command.Command
append, execute, getSubCommands, getUndoCommand, isAtomic, isLoggable, isNull, isNullOrContainsOnly, stripSubCommands, toString
-
Constructor Details
-
MovePiece
public MovePiece(String id, String newMapId, Point newPosition, String newUnderneathId, String oldMapId, Point oldPosition, String oldUnderneathId, 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
-
-
Method Details
-
getId
-
getNewMapId
-
getOldMapId
-
getNewPosition
-
getOldPosition
-
getNewUnderneathId
-
getOldUnderneathId
-
getPlayerId
-
executeCommand
protected void executeCommand()Description copied from class:Command
Perform the action which this Command represents- Specified by:
executeCommand
in classCommand
-
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 undoCommand.executeCommand()
, not the actions of subcommands- Specified by:
myUndoCommand
in classCommand
-
createMergeFinder
Creates a newPieceVisitorDispatcher
that will create aCommand
object to merge the target piece with any applicable pieces at the target location- Parameters:
map
-p
-pt
-- Returns:
-
getDetails
Description copied from class:Command
Detailed information for toString()- Overrides:
getDetails
in classCommand
-