From b22d852b4c4aa89e0394397a703ecfa442b0a928 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Mon, 27 May 2013 22:26:44 +0200 Subject: Fixed variable shadowing warnings * fixed -Wshadow warnings * refactored some constructors --- src/graphics/engine/engine.h | 47 ++++++++++++++++++++++---------------- src/graphics/engine/modelmanager.h | 6 +++-- src/graphics/engine/particle.cpp | 6 ++--- src/graphics/engine/pyro.cpp | 12 ++++++---- src/graphics/engine/text.cpp | 2 +- 5 files changed, 42 insertions(+), 31 deletions(-) (limited to 'src/graphics/engine') diff --git a/src/graphics/engine/engine.h b/src/graphics/engine/engine.h index 8763a4e..27aa5dc 100644 --- a/src/graphics/engine/engine.h +++ b/src/graphics/engine/engine.h @@ -194,10 +194,15 @@ struct EngineBaseObjDataTier unsigned int staticBufferId; bool updateStaticBuffer; - inline EngineBaseObjDataTier(EngineTriangleType type = ENG_TRIANGLE_TYPE_TRIANGLES, - const Material& material = Material(), - int state = ENG_RSTATE_NORMAL) - : type(type), material(material), state(state), staticBufferId(0), updateStaticBuffer(false) {} + inline EngineBaseObjDataTier(EngineTriangleType _type = ENG_TRIANGLE_TYPE_TRIANGLES, + const Material& _material = Material(), + int _state = ENG_RSTATE_NORMAL) + : type(_type) + , material(_material) + , state(_state) + , staticBufferId(0) + , updateStaticBuffer(false) + {} }; /** @@ -209,8 +214,9 @@ struct EngineBaseObjLODTier LODLevel lodLevel; std::vector next; - inline EngineBaseObjLODTier(LODLevel lodLevel = LOD_Constant) - : lodLevel(lodLevel) {} + inline EngineBaseObjLODTier(LODLevel _lodLevel = LOD_Constant) + : lodLevel(_lodLevel) + {} }; /** @@ -225,8 +231,10 @@ struct EngineBaseObjTexTier Texture tex2; std::vector next; - inline EngineBaseObjTexTier(const std::string& tex1Name = "", const std::string& tex2Name = "") - : tex1Name(tex1Name), tex2Name(tex2Name) {} + inline EngineBaseObjTexTier(const std::string& _tex1Name = "", const std::string& _tex2Name = "") + : tex1Name(_tex1Name) + , tex2Name(_tex2Name) + {} }; /** @@ -556,18 +564,17 @@ struct EngineMouse //! Hot point Math::Point hotPoint; - inline EngineMouse(int icon1 = -1, int icon2 = -1, int iconShadow = -1, - EngineRenderState mode1 = ENG_RSTATE_NORMAL, - EngineRenderState mode2 = ENG_RSTATE_NORMAL, - Math::Point hotPoint = Math::Point()) - { - this->icon1 = icon1; - this->icon2 = icon2; - this->iconShadow = iconShadow; - this->mode1 = mode1; - this->mode2 = mode2; - this->hotPoint = hotPoint; - } + inline EngineMouse(int _icon1 = -1, int _icon2 = -1, int _iconShadow = -1, + EngineRenderState _mode1 = ENG_RSTATE_NORMAL, + EngineRenderState _mode2 = ENG_RSTATE_NORMAL, + Math::Point _hotPoint = Math::Point()) + : icon1(_icon1) + , icon2(_icon2) + , iconShadow(_iconShadow) + , mode1(_mode1) + , mode2(_mode2) + , hotPoint(_hotPoint) + {} }; diff --git a/src/graphics/engine/modelmanager.h b/src/graphics/engine/modelmanager.h index 26ee130..9d50b97 100644 --- a/src/graphics/engine/modelmanager.h +++ b/src/graphics/engine/modelmanager.h @@ -79,8 +79,10 @@ private: std::string fileName; bool mirrored; - inline FileInfo(const std::string& fileName, bool mirrored) - : fileName(fileName), mirrored(mirrored) {} + inline FileInfo(const std::string& _fileName, bool _mirrored) + : fileName(_fileName) + , mirrored(_mirrored) + {} inline bool operator<(const FileInfo& other) const { diff --git a/src/graphics/engine/particle.cpp b/src/graphics/engine/particle.cpp index 10b945e..abee2e2 100644 --- a/src/graphics/engine/particle.cpp +++ b/src/graphics/engine/particle.cpp @@ -3553,9 +3553,9 @@ void CParticle::DrawParticle(int sheet) { m_engine->SetTexture("text.png"); m_engine->SetState(ENG_RSTATE_TTEXTURE_WHITE); - Math::Matrix mat; - mat.LoadIdentity(); - m_device->SetTransform(TRANSFORM_WORLD, mat); + Math::Matrix matrix; + matrix.LoadIdentity(); + m_device->SetTransform(TRANSFORM_WORLD, matrix); for (int i = 0; i < m_wheelTraceTotal; i++) DrawParticleWheel(i); diff --git a/src/graphics/engine/pyro.cpp b/src/graphics/engine/pyro.cpp index 975a211..0a85beb 100644 --- a/src/graphics/engine/pyro.cpp +++ b/src/graphics/engine/pyro.cpp @@ -89,13 +89,15 @@ bool CPyro::Create(PyroType type, CObject* obj, float force) DisplayError(type, obj); // displays eventual messages - int i = 0; - // Copies all spheres of the object. - for (; i < 50; i++) { - if ( !obj->GetCrashSphere(i, m_crashSpherePos[i], m_crashSphereRadius[i]) ) break; + int i = 0; + // Copies all spheres of the object. + for (; i < 50; i++) + { + if ( !obj->GetCrashSphere(i, m_crashSpherePos[i], m_crashSphereRadius[i]) ) break; + } + m_crashSphereUsed = i; } - m_crashSphereUsed = i; // Calculates the size of the effect. if ( oType == OBJECT_ANT || diff --git a/src/graphics/engine/text.cpp b/src/graphics/engine/text.cpp index 9bc8bd0..610bfcf 100644 --- a/src/graphics/engine/text.cpp +++ b/src/graphics/engine/text.cpp @@ -613,7 +613,7 @@ void CText::DrawString(const std::string &text, std::vector::itera float cw = GetCharWidth(ch, font, size, offset); if (offset + cw > width) // exceeds the maximum width? { - UTF8Char ch = TranslateSpecialChar(CHAR_SKIP_RIGHT); + ch = TranslateSpecialChar(CHAR_SKIP_RIGHT); cw = GetCharWidth(ch, font, size, offset); pos.x = start + width - cw; color = Color(1.0f, 0.0f, 0.0f); -- cgit v1.2.3-1-g7c22