| 182 | } |
| 183 | |
| 184 | Tr2StateMachineState* Tr2StateMachineState::Update( uint64_t variableDirtyMask ) |
| 185 | { |
| 186 | if( !m_isActive ) |
| 187 | { |
| 188 | return nullptr; |
| 189 | } |
| 190 | if( m_isFinalizing ) |
| 191 | { |
| 192 | auto next = GetNextState(); |
| 193 | |
| 194 | if( !next ) |
| 195 | { |
| 196 | m_isActive = false; |
| 197 | Start(); |
| 198 | } |
| 199 | if( !m_finalizer || m_finalizer->CanTransition( *m_stateMachine->GetController() ) ) |
| 200 | { |
| 201 | return next; |
| 202 | } |
| 203 | return nullptr; |
| 204 | } |
| 205 | // If an action has vetoed transition before, we can't rely on variable dirty state anymore |
| 206 | if( m_hasBeenVetoed ) |
| 207 | { |
| 208 | variableDirtyMask = 0xffffffffffffffffull; |
| 209 | } |
| 210 | if( m_transitionVariableMask != 0 && ( ( m_transitionVariableMask & variableDirtyMask ) == 0 ) ) |
| 211 | { |
| 212 | return nullptr; |
| 213 | } |
| 214 | for( auto it = begin( m_transitions ); it != end( m_transitions ); ++it ) |
| 215 | { |
| 216 | if( ( *it )->CanActivate( variableDirtyMask ) && ( *it )->GetDestination() ) |
| 217 | { |
| 218 | for( auto ai = begin( m_actions ); ai != end( m_actions ); ++ai ) |
| 219 | { |
| 220 | if( !( *ai )->CanTransition() ) |
| 221 | { |
| 222 | m_hasBeenVetoed = true; |
| 223 | return nullptr; |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | Stop(); |
| 228 | if( m_isFinalizing ) |
| 229 | { |
| 230 | return nullptr; |
| 231 | } |
| 232 | return ( *it )->GetDestination(); |
| 233 | } |
| 234 | } |
| 235 | return nullptr; |
| 236 | } |
| 237 | |
| 238 | void Tr2StateMachineState::RebaseSimTime( Be::Time diff ) |
| 239 | { |
nothing calls this directly
no test coverage detected