From 4a5a5f29681ab6123617030289517d5379c758ca Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Mon, 18 Mar 2013 22:52:43 +0000 Subject: bge bugfix: [#34677] Setting Boolean property on KX_GameObject creates Int type we need to check for booleans before testing for longs. --- source/gameengine/Expressions/Value.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/gameengine/Expressions') diff --git a/source/gameengine/Expressions/Value.cpp b/source/gameengine/Expressions/Value.cpp index bcfb7e92d71..706cfc13ca3 100644 --- a/source/gameengine/Expressions/Value.cpp +++ b/source/gameengine/Expressions/Value.cpp @@ -18,6 +18,7 @@ * */ #include "Value.h" +#include "BoolValue.h" #include "FloatValue.h" #include "IntValue.h" #include "VectorValue.h" @@ -573,6 +574,11 @@ CValue* CValue::ConvertPythonToValue(PyObject *pyobj, const char *error_prefix) } else #endif + /* note: Boolean check should go before Int check [#34677] */ + if (PyBool_Check(pyobj)) + { + vallie = new CBoolValue( (bool)PyLong_AsLongLong(pyobj) ); + } else if (PyFloat_Check(pyobj)) { vallie = new CFloatValue( (float)PyFloat_AsDouble(pyobj) ); -- cgit v1.2.3