From: Erik V. <ev...@us...> - 2009-11-26 20:14:40
|
Update of /cvsroot/rails/18xx/rails/game/move In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv17273/rails/game/move Modified Files: MoveStack.java MoveSet.java Log Message: Name change only Index: MoveSet.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/move/MoveSet.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** MoveSet.java 7 Oct 2009 19:00:38 -0000 1.12 --- MoveSet.java 26 Nov 2009 20:14:30 -0000 1.13 *************** *** 19,26 **** private List<Move> moves = new ArrayList<Move>(); - private List<Move> reversedMoves = null; private boolean undoableByPlayer; /** If TRUE, undoing this move will also undo the previous one. */ ! private boolean linkedToPrevious = false; protected static Logger log = --- 19,25 ---- private List<Move> moves = new ArrayList<Move>(); private boolean undoableByPlayer; /** If TRUE, undoing this move will also undo the previous one. */ ! private boolean linkedToPreviousMoveSet = false; protected static Logger log = *************** *** 46,54 **** protected void unexecute() { ! // Create a reversed move list, if not yet done ! if (reversedMoves == null) { ! reversedMoves = new ArrayList<Move>(moves); ! Collections.reverse(reversedMoves); ! } for (Move move : reversedMoves) { move.undo(); --- 45,51 ---- protected void unexecute() { ! // Create a reversed move list ! List<Move> reversedMoves = new ArrayList<Move>(moves); ! Collections.reverse(reversedMoves); for (Move move : reversedMoves) { move.undo(); *************** *** 61,70 **** } ! public void setLinkedToPrevious() { ! linkedToPrevious = true; } ! protected boolean isLinkedToPrevious() { ! return linkedToPrevious; } --- 58,67 ---- } ! public void linkToPreviousMoveSet() { ! linkedToPreviousMoveSet = true; } ! protected boolean isLinkedToPreviousMove() { ! return linkedToPreviousMoveSet; } Index: MoveStack.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/move/MoveStack.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MoveStack.java 7 Oct 2009 19:00:38 -0000 1.1 --- MoveStack.java 26 Nov 2009 20:14:30 -0000 1.2 *************** *** 42,46 **** } ! public boolean start(boolean undoableByPlayer) { log.debug(">>> Start MoveSet(index=" + (lastIndex + 1) + ")"); if (currentMoveSet == null) { --- 42,46 ---- } ! public MoveSet start(boolean undoableByPlayer) { log.debug(">>> Start MoveSet(index=" + (lastIndex + 1) + ")"); if (currentMoveSet == null) { *************** *** 49,56 **** moveStack.remove(moveStack.size() - 1); } ! return true; } else { ! log.warn("MoveStack is already open"); ! return false; } } --- 49,56 ---- moveStack.remove(moveStack.size() - 1); } ! return currentMoveSet; } else { ! log.warn("MoveSet is already open"); ! return currentMoveSet; } } *************** *** 97,103 **** } ! public void setLinkedToPrevious() { if (currentMoveSet != null) { ! currentMoveSet.setLinkedToPrevious(); } else { log.warn("No MoveSet open"); --- 97,103 ---- } ! public void linkToPreviousMoveSet() { if (currentMoveSet != null) { ! currentMoveSet.linkToPreviousMoveSet(); } else { log.warn("No MoveSet open"); *************** *** 115,119 **** undoAction = moveStack.get(lastIndex--); undoAction.unexecute(); ! } while (undoAction.isLinkedToPrevious()); return true; } else { --- 115,119 ---- undoAction = moveStack.get(lastIndex--); undoAction.unexecute(); ! } while (undoAction.isLinkedToPreviousMove()); return true; } else { |