rails.game.move
Class MoveStack
java.lang.Object
rails.game.move.MoveStack
public class MoveStack
- extends java.lang.Object
This class represent one game's complete "move stack", which is a list
of MoveSets. Each MoveSet contains the (low-level) changes caused by
one particular player action.
The only purpose of the move stack is to enable Undo and Redo.
- Author:
- Erik Vos
Field Summary |
protected static org.apache.log4j.Logger |
log
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected static org.apache.log4j.Logger log
MoveStack
public MoveStack()
enable
public void enable()
- Start making moves undoable. Will be called once, after all
initialisations are complete.
start
public MoveSet start(boolean undoableByPlayer)
finish
public boolean finish()
cancel
public boolean cancel()
addMove
public boolean addMove(Move move)
linkToPreviousMoveSet
public void linkToPreviousMoveSet()
undoMoveSet
public boolean undoMoveSet(boolean forced)
redoMoveSet
public boolean redoMoveSet()
isUndoableByPlayer
public boolean isUndoableByPlayer()
isRedoable
public boolean isRedoable()
isUndoableByManager
public boolean isUndoableByManager()
isOpen
public boolean isOpen()
getIndex
public int getIndex()
getCurrentIndex
public int getCurrentIndex()
- the current index is the one of either the open moveset or
if none is open of the latest added
size
public int size()
gotoIndex
public boolean gotoIndex(int index)
- undo/redo to a given moveStack index