| 36 | } |
| 37 | |
| 38 | void Tr2StateMachineState::OnListModified( long event, ssize_t key, ssize_t key2, IRoot* value, const IList* list ) |
| 39 | { |
| 40 | if( list == &m_actions ) |
| 41 | { |
| 42 | switch( event & BELIST_EVENTMASK ) |
| 43 | { |
| 44 | case BELIST_INSERTED: |
| 45 | if( m_stateMachine ) |
| 46 | { |
| 47 | if( ITr2ControllerActionPtr action = BlueCastPtr( value ) ) |
| 48 | { |
| 49 | action->Link( *m_stateMachine->GetController() ); |
| 50 | if( m_isActive ) |
| 51 | { |
| 52 | action->Start( *m_stateMachine->GetController() ); |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | break; |
| 57 | case BELIST_REMOVED: |
| 58 | if( ITr2ControllerActionPtr action = BlueCastPtr( value ) ) |
| 59 | { |
| 60 | if( m_stateMachine ) |
| 61 | { |
| 62 | if( m_isActive ) |
| 63 | { |
| 64 | action->Stop( *m_stateMachine->GetController() ); |
| 65 | } |
| 66 | } |
| 67 | action->Unlink(); |
| 68 | } |
| 69 | break; |
| 70 | default: |
| 71 | break; |
| 72 | } |
| 73 | } |
| 74 | else if( list == &m_transitions ) |
| 75 | { |
| 76 | switch( event & BELIST_EVENTMASK ) |
| 77 | { |
| 78 | case BELIST_INSERTED: |
| 79 | if( m_stateMachine ) |
| 80 | { |
| 81 | if( Tr2StateMachineTransitionPtr transition = BlueCastPtr( value ) ) |
| 82 | { |
| 83 | transition->Link( *this ); |
| 84 | UpdateVariableMask(); |
| 85 | } |
| 86 | } |
| 87 | break; |
| 88 | case BELIST_REMOVED: |
| 89 | if( Tr2StateMachineTransitionPtr transition = BlueCastPtr( value ) ) |
| 90 | { |
| 91 | transition->Unlink(); |
| 92 | UpdateVariableMask(); |
| 93 | } |
| 94 | break; |
| 95 | default: |
nothing calls this directly
no test coverage detected