/** * Constructs a new SaveMoveDouble object. * * @param move the MoveDouble to convert to a SaveMoveDouble. */ public SaveMoveDouble(MoveDouble move) { super(move.colour); moves = new ArrayList<SaveMoveTicket>(); MoveTicket mt1 = move.move1; SaveMoveTicket newMove1 = new SaveMoveTicket(mt1); moves.add(newMove1); MoveTicket mt2 = move.move2; SaveMoveTicket newMove2 = new SaveMoveTicket(mt2); moves.add(newMove2); }
/** * Adds a Move to the save game. * * @param move the Move to be added to the save game. */ public void addMove(Move move) { SaveMove saveMove = null; if (move instanceof MoveDouble) { saveMove = new SaveMoveDouble((MoveDouble) move); } else if (move instanceof MovePass) { saveMove = new SaveMovePass((MovePass) move); } else if (move instanceof MoveTicket) { saveMove = new SaveMoveTicket((MoveTicket) move); } if (saveMove != null) moves.add(saveMove); }