diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-11-11 02:32:15 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-11-11 02:32:15 +0400 |
commit | 67b74f96daa98809d5f9a348adfcd561f5f54f07 (patch) | |
tree | 55a59e2defe174187efc29c87a6717b479caa283 /source/gameengine/GameLogic | |
parent | 1ca4670267c3709d1c233264012882b4c0902748 (diff) |
- property sensor was converting floating point values to text then back to float - for floating point properties.
- IntValue's GetNumber() was convert int -> float -> double.
- BL_Shader was using STR_String rather then char*, where most callers had a char*, use a char* to avoid STR_String conversion-and-alloc on shader access.
Diffstat (limited to 'source/gameengine/GameLogic')
-rw-r--r-- | source/gameengine/GameLogic/SCA_PropertySensor.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.cpp b/source/gameengine/GameLogic/SCA_PropertySensor.cpp index 5dd4cc501ca..ced3b8418fe 100644 --- a/source/gameengine/GameLogic/SCA_PropertySensor.cpp +++ b/source/gameengine/GameLogic/SCA_PropertySensor.cpp @@ -126,7 +126,6 @@ bool SCA_PropertySensor::Evaluate() bool SCA_PropertySensor::CheckPropertyCondition() { - m_recentresult=false; bool result=false; bool reverse = false; @@ -174,7 +173,7 @@ bool SCA_PropertySensor::CheckPropertyCondition() case KX_PROPSENSOR_EXPRESSION: { - /* +#if 0 if (m_rightexpr) { CValue* resultval = m_rightexpr->Calculate(); @@ -189,7 +188,7 @@ bool SCA_PropertySensor::CheckPropertyCondition() result = resultval->GetNumber() != 0; } } - */ +#endif break; } case KX_PROPSENSOR_INTERVAL: @@ -197,7 +196,16 @@ bool SCA_PropertySensor::CheckPropertyCondition() CValue* orgprop = GetParent()->FindIdentifier(m_checkpropname); if (!orgprop->IsError()) { - float val = orgprop->GetText().ToFloat(), min = m_checkpropval.ToFloat(), max = m_checkpropmaxval.ToFloat(); + const float min = m_checkpropval.ToFloat(); + const float max = m_checkpropmaxval.ToFloat(); + float val; + + if (dynamic_cast<CStringValue *>(orgprop) == NULL) { + val = orgprop->GetNumber(); + } + else { + val = orgprop->GetText().ToFloat(); + } result = (min <= val) && (val <= max); } |