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

Method EvaluateExpression

trinity/Controllers/Tr2StateMachineTransition.cpp:128–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128BlueStdResult Tr2StateMachineTransition::EvaluateExpression( const char* expression, float& value ) const
129{
130 if( !m_source )
131 {
132 return BlueStdResult( BLUE_STD_RESULT_RUNTIME_ERROR, "controller needs to be running when evaluating expressions" );
133 }
134 Tr2ControllerExpression expr;
135 auto error = expr.SetExpr( expression, *m_source->GetStateMachine() );
136 if( !error.empty() )
137 {
138 return BlueStdResult( BLUE_STD_RESULT_VALUE_ERROR, error.c_str() );
139 }
140 auto result = expr.Eval();
141 if( !result.first )
142 {
143 return BlueStdResult( BLUE_STD_RESULT_RUNTIME_ERROR, "error evaluating expression" );
144 }
145 value = result.second;
146 return BlueStdResult();
147}

Callers

nothing calls this directly

Calls 4

SetExprMethod · 0.80
GetStateMachineMethod · 0.80
emptyMethod · 0.80
EvalMethod · 0.80

Tested by

no test coverage detected