| 68 | } |
| 69 | |
| 70 | void MECreateUndoAction::undo() |
| 71 | { |
| 72 | for ( S32 i= mObjects.size()-1; i >= 0; i-- ) |
| 73 | { |
| 74 | ObjectState &state = mObjects[i]; |
| 75 | |
| 76 | SimObject *object = Sim::findObject( state.id ); |
| 77 | if ( !object ) |
| 78 | continue; |
| 79 | |
| 80 | // Save the state. |
| 81 | if ( !state.memento.hasState() ) |
| 82 | state.memento.save( object ); |
| 83 | |
| 84 | // Store the group. |
| 85 | SimGroup *group = object->getGroup(); |
| 86 | if ( group ) |
| 87 | state.groupId = group->getId(); |
| 88 | |
| 89 | // We got what we need... delete it. |
| 90 | object->deleteObject(); |
| 91 | } |
| 92 | |
| 93 | Con::executef( this, "onUndone" ); |
| 94 | } |
| 95 | |
| 96 | void MECreateUndoAction::redo() |
| 97 | { |
nothing calls this directly
no test coverage detected