Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-11-09 20:15:00 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-11-09 20:15:00 +0400
commitd25b13d13f22581b7ed107f0774d1bd8c510add4 (patch)
treee9ceca49f84a8f1091e7b8491e27243411d65ab7 /source/gameengine
parentb67a297d33dc97708940b17ca50401d9277f8bd5 (diff)
code cleanup: double promotion warnings, also allow cmake to build SDL without audaspace.
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.cpp14
-rw-r--r--source/gameengine/GameLogic/SCA_RandomActuator.cpp10
-rw-r--r--source/gameengine/Rasterizer/RAS_TexVert.cpp8
3 files changed, 16 insertions, 16 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;
diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
index 2d51a45fe55..01995b13ad7 100644
--- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
@@ -220,11 +220,11 @@ bool SCA_RandomActuator::Update()
* this will be quite sufficient here.
*/
do {
- x = 2.0 * m_base->DrawFloat() - 1.0;
- y = 2.0 * m_base->DrawFloat() - 1.0;
- s = x*x + y*y;
- } while ( (s >= 1.0) || (s == 0.0) );
- t = x * sqrt( (-2.0 * log(s)) / s);
+ x = 2.0f * m_base->DrawFloat() - 1.0f;
+ y = 2.0f * m_base->DrawFloat() - 1.0f;
+ s = x * x + y * y;
+ } while ((s >= 1.0f) || (s == 0.0f));
+ t = x * sqrtf((-2.0 * log(s)) / s);
tmpval = new CFloatValue(m_parameter1 + m_parameter2 * t);
}
}
diff --git a/source/gameengine/Rasterizer/RAS_TexVert.cpp b/source/gameengine/Rasterizer/RAS_TexVert.cpp
index b60fae73e2a..3b4f4cae30e 100644
--- a/source/gameengine/Rasterizer/RAS_TexVert.cpp
+++ b/source/gameengine/Rasterizer/RAS_TexVert.cpp
@@ -63,10 +63,10 @@ const MT_Point3& RAS_TexVert::xyz()
void RAS_TexVert::SetRGBA(const MT_Vector4& rgba)
{
unsigned char *colp = (unsigned char*) &m_rgba;
- colp[0] = (unsigned char) (rgba[0]*255.0f);
- colp[1] = (unsigned char) (rgba[1]*255.0f);
- colp[2] = (unsigned char) (rgba[2]*255.0f);
- colp[3] = (unsigned char) (rgba[3]*255.0f);
+ colp[0] = (unsigned char) (rgba[0] * 255.0);
+ colp[1] = (unsigned char) (rgba[1] * 255.0);
+ colp[2] = (unsigned char) (rgba[2] * 255.0);
+ colp[3] = (unsigned char) (rgba[3] * 255.0);
}