Rename osx directory to src since it's now the official source base
This commit is contained in:
40
src/tools/undo.cpp
Normal file
40
src/tools/undo.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* undo.cpp
|
||||
* BoE
|
||||
*
|
||||
* Created by Celtic Minstrel on 29/05/09.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "undo.h"
|
||||
|
||||
cUndoList::cUndoList(){
|
||||
lastSave = cur = theList.begin();
|
||||
}
|
||||
|
||||
size_t cUndoList::maxUndoSize = 0;
|
||||
|
||||
//TODO: These functions should have error checking to ensure they do not access an out of bounds action
|
||||
void cUndoList::undo(){
|
||||
(*cur)->undo();
|
||||
cur--;
|
||||
}
|
||||
|
||||
void cUndoList::redo(){
|
||||
cur++;
|
||||
(*cur)->redo();
|
||||
}
|
||||
|
||||
void cUndoList::save(){
|
||||
lastSave = cur;
|
||||
}
|
||||
|
||||
void cUndoList::revert(){
|
||||
while(cur != lastSave) undo();
|
||||
}
|
||||
|
||||
void cUndoList::add(cAction* what){
|
||||
theList.push_back(what);
|
||||
num_actions++;
|
||||
while(num_actions > maxUndoSize) theList.pop_front(), num_actions--;
|
||||
}
|
Reference in New Issue
Block a user