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

Method EvaluateExpression

trinity/Controllers/Actions/Tr2ActionSetValue.cpp:113–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113BlueStdResult Tr2ActionSetValue::EvaluateExpression( const char* expression, float& value ) const
114{
115 if( !m_controller )
116 {
117 return BlueStdResult( BLUE_STD_RESULT_RUNTIME_ERROR, "controller needs to be running when evaluating expressions" );
118 }
119 Tr2ControllerExpression expr;
120 auto error = expr.SetExpr( expression, *m_controller );
121 if( !error.empty() )
122 {
123 return BlueStdResult( BLUE_STD_RESULT_VALUE_ERROR, error.c_str() );
124 }
125 auto result = expr.Eval();
126 if( !result.first )
127 {
128 return BlueStdResult( BLUE_STD_RESULT_RUNTIME_ERROR, "error evaluating expression" );
129 }
130 value = result.second;
131 return BlueStdResult();
132}

Callers

nothing calls this directly

Calls 3

SetExprMethod · 0.80
emptyMethod · 0.80
EvalMethod · 0.80

Tested by

no test coverage detected