diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-11-09 20:15:00 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-11-09 20:15:00 +0400 |
commit | d25b13d13f22581b7ed107f0774d1bd8c510add4 (patch) | |
tree | e9ceca49f84a8f1091e7b8491e27243411d65ab7 /source/gameengine/Expressions | |
parent | b67a297d33dc97708940b17ca50401d9277f8bd5 (diff) |
code cleanup: double promotion warnings, also allow cmake to build SDL without audaspace.
Diffstat (limited to 'source/gameengine/Expressions')
-rw-r--r-- | source/gameengine/Expressions/PyObjectPlus.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp index bb1d0a31c1f..03f9fb5fb19 100644 --- a/source/gameengine/Expressions/PyObjectPlus.cpp +++ b/source/gameengine/Expressions/PyObjectPlus.cpp @@ -486,8 +486,8 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef * static bool py_check_attr_float(float *var, PyObject *value, const PyAttributeDef *attrdef) { - double val = PyFloat_AsDouble(value); - if (val == -1.0 && PyErr_Occurred()) + float val = PyFloat_AsDouble(value); + if (val == -1.0f && PyErr_Occurred()) { PyErr_Format(PyExc_TypeError, "expected float value for attribute \"%s\"", attrdef->m_name); return false; @@ -664,13 +664,13 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt { float *var = reinterpret_cast<float*>(ptr); ptr += sizeof(float); - double val = PyFloat_AsDouble(item); - if (val == -1.0 && PyErr_Occurred()) + float val = PyFloat_AsDouble(item); + if (val == -1.0f && PyErr_Occurred()) { PyErr_Format(PyExc_TypeError, "expected a float for attribute \"%s\"", attrdef->m_name); goto UNDO_AND_ERROR; } - else if (attrdef->m_clamp) + else if (attrdef->m_clamp) { if (val < attrdef->m_fmin) val = attrdef->m_fmin; @@ -985,10 +985,10 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt for (int i=0; i<3; i++) { item = PySequence_GetItem(value, i); /* new ref */ - double val = PyFloat_AsDouble(item); + float val = PyFloat_AsDouble(item); Py_DECREF(item); item = NULL; - if (val == -1.0 && PyErr_Occurred()) + if (val == -1.0f && PyErr_Occurred()) { PyErr_Format(PyExc_TypeError, "expected a sequence of 3 floats for attribute \"%s\"", attrdef->m_name); goto RESTORE_AND_ERROR; |