diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2013-03-19 02:52:43 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2013-03-19 02:52:43 +0400 |
commit | 4a5a5f29681ab6123617030289517d5379c758ca (patch) | |
tree | 9919eb1fc5ad2707ea04e8d5d869ec2a20b2f122 /source/gameengine/Expressions | |
parent | 779b26058b7df18508e48e4f8bdbe49e9da1926b (diff) |
bge bugfix: [#34677] Setting Boolean property on KX_GameObject creates Int type
we need to check for booleans before testing for longs.
Diffstat (limited to 'source/gameengine/Expressions')
-rw-r--r-- | source/gameengine/Expressions/Value.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
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) ); |