added record and restore method to MagicGame as convienent wrapper for undoing in a regular and AI game

master
melvin 2013-10-31 14:33:46 +08:00
parent 37c9d5a00e
commit 0a97959943
1 changed files with 16 additions and 0 deletions

View File

@ -623,6 +623,22 @@ public class MagicGame {
undoPoints.addLast(markerAction);
}
public void record() {
if (artificial) {
startActions();
} else {
createUndoPoint();
}
}
public void restore() {
if (artificial) {
undoActions();
} else {
gotoLastUndoPoint();
}
}
public void gotoLastUndoPoint() {
final MagicAction markerAction = undoPoints.removeLast();
MagicAction action;