diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-06-17 13:58:26 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-06-17 13:58:26 +0400 |
commit | f5f25b81e8963aeba0a4c09f09358de070e0f927 (patch) | |
tree | c7fd6345d3a372845a0621e90087f88c90e4b8b8 /source/gameengine | |
parent | 245c94a75e60c2c0b58c1f39d189258e2e424e29 (diff) |
style cleanup:
also fix for building ghost test and fix double free in one of the tests
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Converter/BL_BlenderDataConversion.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/Converter/KX_ConvertActuators.cpp | 2 | ||||
-rw-r--r-- | source/gameengine/Expressions/PyObjectPlus.h | 2 | ||||
-rw-r--r-- | source/gameengine/GameLogic/SCA_ILogicBrick.h | 7 | ||||
-rw-r--r-- | source/gameengine/GameLogic/SCA_JoystickSensor.cpp | 3 | ||||
-rw-r--r-- | source/gameengine/Ketsji/BL_Shader.cpp | 10 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_BlenderMaterial.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_BulletPhysicsController.h | 2 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Dome.cpp | 10 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 20 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_PyMath.h | 13 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_RadarSensor.cpp | 14 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp | 2 | ||||
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp | 4 |
14 files changed, 50 insertions, 47 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 927a0535870..3c9ca77b37e 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -446,8 +446,8 @@ static void GetRGB(short type, c2 = KX_Mcol2uint_new(mmcol[2]); if (mface->v4) c3 = KX_Mcol2uint_new(mmcol[3]); - }else // backup white - { + } + else { // backup white c0 = KX_rgbaint2uint_new(color); c1 = KX_rgbaint2uint_new(color); c2 = KX_rgbaint2uint_new(color); diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index 07680297b7d..28e34769ab8 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -860,7 +860,7 @@ void BL_ConvertActuators(const char* maggiename, float paraArg1 = 0.0; float paraArg2 = 0.0; - switch (randAct->distribution) { + switch (randAct->distribution) { case ACT_RANDOM_BOOL_CONST: modeArg = SCA_RandomActuator::KX_RANDOMACT_BOOL_CONST; paraArg1 = (float) randAct->int_arg_1; diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h index c50e42446a5..124a8e28f57 100644 --- a/source/gameengine/Expressions/PyObjectPlus.h +++ b/source/gameengine/Expressions/PyObjectPlus.h @@ -588,7 +588,7 @@ public: /* These static functions are referenced by ALL PyObjectPlus_Proxy types * they take the C++ reference from the PyObjectPlus_Proxy and call - * its own virtual py_repr, py_base_dealloc ,etc. functions. + * its own virtual py_repr, py_base_dealloc, etc. functions. */ static PyObject* py_base_new(PyTypeObject *type, PyObject *args, PyObject *kwds); /* allows subclassing */ diff --git a/source/gameengine/GameLogic/SCA_ILogicBrick.h b/source/gameengine/GameLogic/SCA_ILogicBrick.h index 9a23244fa96..b505353c7cd 100644 --- a/source/gameengine/GameLogic/SCA_ILogicBrick.h +++ b/source/gameengine/GameLogic/SCA_ILogicBrick.h @@ -94,7 +94,7 @@ public: void InsertActiveQList(SG_QList& head) { SG_QList::iterator<SCA_ILogicBrick> it(head); - for(it.begin(); !it.end() && m_Execute_Priority > (*it)->m_Execute_Priority; ++it); + for (it.begin(); !it.end() && m_Execute_Priority > (*it)->m_Execute_Priority; ++it); it.add_back(this); } @@ -119,9 +119,8 @@ public: // this element comes before the first *current = this; } - else - { - for(++it; !it.end() && (*it)->m_gameobj == m_gameobj && m_Execute_Priority > (*it)->m_Execute_Priority; ++it); + else { + for (++it; !it.end() && (*it)->m_gameobj == m_gameobj && m_Execute_Priority > (*it)->m_Execute_Priority; ++it); } it.add_back(this); } diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp index c82e015919d..2c6beb79fd3 100644 --- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp @@ -191,7 +191,8 @@ bool SCA_JoystickSensor::Evaluate() if (( m_bAllEvents && js->aAnyButtonPressIsPositive()) || (!m_bAllEvents && js->aButtonPressIsPositive(m_button))) { m_istrig = 1; result = true; - }else { + } + else { if (m_istrig) { m_istrig = 0; result = true; diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp index 98854115d0a..c0fca88c426 100644 --- a/source/gameengine/Ketsji/BL_Shader.cpp +++ b/source/gameengine/Ketsji/BL_Shader.cpp @@ -835,12 +835,12 @@ KX_PYMETHODDEF_DOC( BL_Shader, isValid, "isValid()" ) return PyLong_FromSsize_t( ( mShader !=0 && mOk ) ); } -KX_PYMETHODDEF_DOC( BL_Shader, getVertexProg ,"getVertexProg( )" ) +KX_PYMETHODDEF_DOC( BL_Shader, getVertexProg, "getVertexProg( )" ) { return PyUnicode_FromString(vertProg?vertProg:""); } -KX_PYMETHODDEF_DOC( BL_Shader, getFragmentProg ,"getFragmentProg( )" ) +KX_PYMETHODDEF_DOC( BL_Shader, getFragmentProg, "getFragmentProg( )" ) { return PyUnicode_FromString(fragProg?fragProg:""); } @@ -941,7 +941,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform1f, "setUniform1f(name, fx)" ) } -KX_PYMETHODDEF_DOC( BL_Shader, setUniform2f , "setUniform2f(name, fx, fy)") +KX_PYMETHODDEF_DOC( BL_Shader, setUniform2f, "setUniform2f(name, fx, fy)") { if (mError) { Py_RETURN_NONE; @@ -1038,7 +1038,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform1i, "setUniform1i(name, ix)" ) } -KX_PYMETHODDEF_DOC( BL_Shader, setUniform2i , "setUniform2i(name, ix, iy)") +KX_PYMETHODDEF_DOC( BL_Shader, setUniform2i, "setUniform2i(name, ix, iy)") { if (mError) { Py_RETURN_NONE; @@ -1109,7 +1109,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform4i, "setUniform4i(name, ix,iy,iz, iw) " return NULL; } -KX_PYMETHODDEF_DOC( BL_Shader, setUniformfv , "setUniformfv( float (list2 or list3 or list4) )") +KX_PYMETHODDEF_DOC( BL_Shader, setUniformfv, "setUniformfv( float (list2 or list3 or list4) )") { if (mError) { Py_RETURN_NONE; diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp index 5459ebe945c..79e6c35e6a2 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp @@ -899,8 +899,8 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()") mMaterial->SetSharedMaterial(true); mScene->GetBucketManager()->ReleaseDisplayLists(this); return mShader->GetProxy(); - }else - { + } + else { // decref all references to the object // then delete it! // We will then go back to fixed functionality diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.h b/source/gameengine/Ketsji/KX_BulletPhysicsController.h index 3b3a1f5cbfb..5fcd591d822 100644 --- a/source/gameengine/Ketsji/KX_BulletPhysicsController.h +++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.h @@ -12,7 +12,7 @@ #include "CcdPhysicsController.h" #endif -class KX_BulletPhysicsController : public KX_IPhysicsController ,public CcdPhysicsController +class KX_BulletPhysicsController : public KX_IPhysicsController, public CcdPhysicsController { private: int m_savedCollisionFlags; diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp index 6d57b6950f1..f149b676aa5 100644 --- a/source/gameengine/Ketsji/KX_Dome.cpp +++ b/source/gameengine/Ketsji/KX_Dome.cpp @@ -105,7 +105,8 @@ KX_Dome::KX_Dome ( CreateMeshDome180(); m_numfaces = 4; - }else if (m_angle > 180) { + } + else if (m_angle > 180) { cubetop.resize(2); cubebottom.resize(2); cubeleft.resize(2); @@ -140,7 +141,8 @@ KX_Dome::KX_Dome ( CreateMeshDome180(); m_numfaces = 4; - }else if (m_angle > 180) { + } + else if (m_angle > 180) { cubetop.resize(2); cubebottom.resize(2); cubeleft.resize(2); @@ -595,7 +597,7 @@ void KX_Dome::CreateMeshDome180(void) /* Left face - two triangles */ cubeleft[0].verts[0][0] = -M_SQRT2 / 2.0; - cubeleft[0].verts[0][1] = .0; + cubeleft[0].verts[0][1] = 0.0; cubeleft[0].verts[0][2] = -0.5; cubeleft[0].u[0] = 0.0; cubeleft[0].v[0] = 0.0; @@ -1547,7 +1549,7 @@ void KX_Dome::CalculateCameraOrientation() m_locRot[1] = MT_Matrix3x3( // Bottom c, s, 0.0, - 0.0 ,0.0, 1.0, + 0.0, 0.0, 1.0, s, -c, 0.0); m_locRot[2] = MT_Matrix3x3( // 45deg - Left diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 836005cf25e..04113607531 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -1472,18 +1472,18 @@ void KX_KetsjiEngine::RenderDebugProperties() for (int j = tc_first; j < tc_numCategories; j++) { debugtxt.Format(m_profileLabels[j]); - m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED, - debugtxt.Ptr(), - xcoord,ycoord, - m_canvas->GetWidth(), - m_canvas->GetHeight()); + m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED, + debugtxt.Ptr(), + xcoord,ycoord, + m_canvas->GetWidth(), + m_canvas->GetHeight()); double time = m_logger->GetAverage((KX_TimeCategory)j); debugtxt.Format("%.3fms (%2.2f %%)", time*1000.f, time/tottime * 100.f); - m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED, - debugtxt.Ptr(), - xcoord + 60 ,ycoord, - m_canvas->GetWidth(), - m_canvas->GetHeight()); + m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED, + debugtxt.Ptr(), + xcoord + 60, ycoord, + m_canvas->GetWidth(), + m_canvas->GetHeight()); ycoord += 14; } } diff --git a/source/gameengine/Ketsji/KX_PyMath.h b/source/gameengine/Ketsji/KX_PyMath.h index b0000405893..8924567acde 100644 --- a/source/gameengine/Ketsji/KX_PyMath.h +++ b/source/gameengine/Ketsji/KX_PyMath.h @@ -104,19 +104,20 @@ bool PyMatTo(PyObject* pymat, T& mat) if (!PyErr_Occurred() && PySequence_Check(pyrow)) { unsigned int cols = PySequence_Size(pyrow); - if (cols != Size(mat)) + if (cols != Size(mat)) { noerror = false; - else - { - for(unsigned int col = 0; col < cols; col++) - { + } + else { + for (unsigned int col = 0; col < cols; col++) { PyObject *item = PySequence_GetItem(pyrow, col); /* new ref */ mat[row][col] = PyFloat_AsDouble(item); Py_DECREF(item); } } - } else + } + else { noerror = false; + } Py_DECREF(pyrow); } } else diff --git a/source/gameengine/Ketsji/KX_RadarSensor.cpp b/source/gameengine/Ketsji/KX_RadarSensor.cpp index 978944c20e8..74009f51078 100644 --- a/source/gameengine/Ketsji/KX_RadarSensor.cpp +++ b/source/gameengine/Ketsji/KX_RadarSensor.cpp @@ -104,42 +104,42 @@ void KX_RadarSensor::SynchronizeTransform() { MT_Quaternion rotquatje(MT_Vector3(0,0,1),MT_radians(90)); trans.rotate(rotquatje); - trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0)); + trans.translate(MT_Vector3 (0, -m_coneheight/2.0, 0)); break; }; case SENS_RADAR_Y_AXIS: // +Y Axis { MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-180)); trans.rotate(rotquatje); - trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0)); + trans.translate(MT_Vector3 (0, -m_coneheight/2.0, 0)); break; }; case SENS_RADAR_Z_AXIS: // +Z Axis { MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-90)); trans.rotate(rotquatje); - trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0)); + trans.translate(MT_Vector3 (0, -m_coneheight/2.0, 0)); break; }; case SENS_RADAR_NEG_X_AXIS: // -X Axis { MT_Quaternion rotquatje(MT_Vector3(0,0,1),MT_radians(-90)); trans.rotate(rotquatje); - trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0)); + trans.translate(MT_Vector3 (0, -m_coneheight/2.0, 0)); break; }; case SENS_RADAR_NEG_Y_AXIS: // -Y Axis { //MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-180)); //trans.rotate(rotquatje); - trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0)); + trans.translate(MT_Vector3 (0, -m_coneheight/2.0, 0)); break; }; case SENS_RADAR_NEG_Z_AXIS: // -Z Axis { MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(90)); trans.rotate(rotquatje); - trans.translate(MT_Vector3 (0, -m_coneheight/2.0 ,0)); + trans.translate(MT_Vector3 (0, -m_coneheight/2.0, 0)); break; }; default: @@ -154,7 +154,7 @@ void KX_RadarSensor::SynchronizeTransform() m_cone_origin[1] = temp[1]; m_cone_origin[2] = temp[2]; - temp = trans(MT_Point3(0, -m_coneheight/2.0 ,0)); + temp = trans(MT_Point3(0, -m_coneheight/2.0, 0)); m_cone_target[0] = temp[0]; m_cone_target[1] = temp[1]; m_cone_target[2] = temp[2]; diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp index cd6bb5a1cbc..39b7c44eda9 100644 --- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp +++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp @@ -258,7 +258,7 @@ void KX_SCA_AddObjectActuator::InstantAddObject() // Now it needs to be added to the current scene. SCA_IObject* replica = m_scene->AddReplicaObject(m_OriginalObject,GetParent(),m_timeProp ); KX_GameObject * game_obj = static_cast<KX_GameObject *>(replica); - game_obj->setLinearVelocity(m_linear_velocity ,m_localLinvFlag); + game_obj->setLinearVelocity(m_linear_velocity, m_localLinvFlag); game_obj->setAngularVelocity(m_angular_velocity,m_localAngvFlag); game_obj->ResolveCombinedVelocities(m_linear_velocity, m_angular_velocity, m_localLinvFlag, m_localAngvFlag); diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index 343cb549337..47cd4ff8da5 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -1811,8 +1811,8 @@ bool CcdPhysicsEnvironment::cullingTest(PHY_CullingCallback callback, void* user // occlusion culling, the direction of the view is taken from the first plan which MUST be the near plane btDbvt::collideOCL(m_cullingTree->m_sets[1].m_root,planes_n,planes_o,planes_n[0],nplanes,dispatcher); btDbvt::collideOCL(m_cullingTree->m_sets[0].m_root,planes_n,planes_o,planes_n[0],nplanes,dispatcher); - }else - { + } + else { btDbvt::collideKDOP(m_cullingTree->m_sets[1].m_root,planes_n,planes_o,nplanes,dispatcher); btDbvt::collideKDOP(m_cullingTree->m_sets[0].m_root,planes_n,planes_o,nplanes,dispatcher); } |