Ignore:
Timestamp:
Mar 25, 2010, 12:01:27 PM (16 years ago)
Author:
Tillmann Crueger <crueger@…>
Children:
c3294f, fe3540
Parents:
521e29
git-author:
Tillmann Crueger <crueger@…> (03/25/10 11:59:56)
git-committer:
Tillmann Crueger <crueger@…> (03/25/10 12:01:27)
Message:

Added full undo functioniality

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/Actions/Action.cpp

    r521e29 r8d9984  
    1010#include "Actions/Action.hpp"
    1111#include "Actions/ActionRegistry.hpp"
     12#include "Actions/ActionHistory.hpp"
    1213
    1314using namespace std;
     
    3435void Action::call(){
    3536  // forward to private virtual
    36   performCall();
     37  state_ptr state = performCall();
     38  if(shouldUndo() && state != failure){
     39    if(canUndo()){
     40      ActionHistory::getInstance().addElement(this,state);
     41    }
     42    else{
     43      ActionHistory::getInstance().clear();
     44    }
     45  }
    3746}
    3847Action::state_ptr Action::undo(state_ptr _state) {
Note: See TracChangeset for help on using the changeset viewer.