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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected PieceVisitorDispatchercreateMergeFinder(Map map, GamePiece p, Point pt)Creates a newPieceVisitorDispatcherthat will create aCommandobject to merge the target piece with any applicable pieces at the target locationprotected voidPerform the action which this Command representsDetailed information for toString()getId()protected CommandIf the action can be undone, return a Command that performs the inverse action.Methods inherited from class VASSAL.command.Command
append, execute, getSubCommands, getUndoCommand, hasNullSubcommands, 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:CommandPerform the action which this Command represents- Specified by:
executeCommandin classCommand
-
myUndoCommand
Description copied from class:CommandIf 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:
myUndoCommandin classCommand
-
createMergeFinder
Creates a newPieceVisitorDispatcherthat will create aCommandobject to merge the target piece with any applicable pieces at the target location- Parameters:
map-p-pt-- Returns:
-
getDetails
Description copied from class:CommandDetailed information for toString()- Overrides:
getDetailsin classCommand
-