merge with trunk/2.5 at r23876
[[Split portion of a mixed commit.]]
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -290,16 +307,18 @@ CValue* SCA_PropertySensor::FindIdentifier(const STR_String& identifiername)
|
||||
return GetParent()->FindIdentifier(identifiername);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
int SCA_PropertySensor::validValueForProperty(void *self, const PyAttributeDef*)
|
||||
{
|
||||
/* There is no type checking at this moment, unfortunately... */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* Integration hooks ------------------------------------------------------- */
|
||||
PyTypeObject SCA_PropertySensor::Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
@@ -334,4 +353,6 @@ PyAttributeDef SCA_PropertySensor::Attributes[] = {
|
||||
{ NULL } //Sentinel
|
||||
};
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
/* eof */
|
||||
|
||||
Reference in New Issue
Block a user