MCPcopy Create free account
hub / github.com/carbonengine/trinity / Update

Method Update

trinity/Controllers/Tr2StateMachineState.cpp:184–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184Tr2StateMachineState* 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
238void Tr2StateMachineState::RebaseSimTime( Be::Time diff )
239{

Callers

nothing calls this directly

Calls 8

StartFunction · 0.85
StopFunction · 0.85
GetControllerMethod · 0.80
CanActivateMethod · 0.80
beginFunction · 0.50
endFunction · 0.50
CanTransitionMethod · 0.45
GetDestinationMethod · 0.45

Tested by

no test coverage detected