svn merge https://svn.blender.org/svnroot/bf-blender/branches/blender2.4 -r23566...
authorCampbell Barton <ideasman42@gmail.com>
Wed, 30 Sep 2009 13:58:21 +0000 (13:58 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 30 Sep 2009 13:58:21 +0000 (13:58 +0000)
source/gameengine/GameLogic/SCA_PropertySensor.cpp

index 40c5ac687f61adf7fde406f78e7709890f409eef..2a4222af355f00937b1bfb491fc165dbd75ce6e5 100644 (file)
@@ -38,6 +38,7 @@
 #include "SCA_EventManager.h"
 #include "SCA_LogicManager.h"
 #include "BoolValue.h"
+#include "FloatValue.h"
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -190,6 +191,22 @@ bool       SCA_PropertySensor::CheckPropertyCondition()
                                        m_checkpropval.Upper();
                                }
                                result = (testprop == m_checkpropval);
+                               
+                               /* Patch: floating point values cant use strings usefully since you can have "0.0" == "0.0000"
+                                * this could be made into a generic Value class function for comparing values with a string.
+                                */
+                               if(result==false && dynamic_cast<CFloatValue *>(orgprop) != NULL) {
+                                       float f;
+                                       
+                                       if(EOF == sscanf(m_checkpropval.ReadPtr(), "%f", &f))
+                                       {
+                                               //error
+                                       } 
+                                       else {
+                                               result = (f == ((CFloatValue *)orgprop)->GetFloat());
+                                       }
+                               }
+                               /* end patch */
                        }
                        orgprop->Release();