named members m_* to quite -Wshadow
authorPatrik Gornicz <Gornicz.P@gmail.com>
Tue, 1 Sep 2009 01:10:58 +0000 (21:10 -0400)
committerPatrik Gornicz <Gornicz.P@gmail.com>
Tue, 1 Sep 2009 01:10:58 +0000 (21:10 -0400)
15 files changed:
src/Effects/Gravity.cpp
src/Effects/GravityWell.cpp
src/Effects/Screen.cpp
src/Entities/Ball.cpp
src/Entities/Ball.h
src/Entities/Line.cpp
src/Entities/Line.h
src/Entities/Particle.cpp
src/Entities/Particle.h
src/Entities/PhysicsEntity.cpp
src/Entities/PhysicsEntity.h
src/Entities/Polygon.cpp
src/Entities/Polygon.h
src/collisionManager.cpp
src/entityCreator.cpp

index 5c65451..aa07539 100644 (file)
@@ -38,5 +38,5 @@ Gravity::~Gravity()
 
 Vector2 Gravity::forceDelta(const PhysicsEntity* e, float) const
 {
-    return Vector2(0, e->mass * forceGravity);
+    return Vector2(0, e->m_mass * forceGravity);
 }
index e7d0d44..a573632 100644 (file)
@@ -37,7 +37,7 @@ GravityWell::~GravityWell()
 Vector2 GravityWell::forceDelta(const PhysicsEntity* e, float) const
 {
     const Vector2& pos = e->positionRaw();
-    float mass = e->mass;
+    float mass = e->m_mass;
 
     Vector2 delta = position - pos;
     float sqrDist = delta.sqrLength();
index bfcc581..d75df37 100644 (file)
@@ -68,7 +68,7 @@ Vector2 Screen::velocityDelta(const PhysicsEntity* e, float /*time_step*/) const
 
     Vector2 acc(0,0);
 
-    float CoR = e->CoR;
+    float CoR = e->m_CoR;
     float radius = 0;
     const Ball* b = dynamic_cast<const Ball*>(e);
     if( b != NULL )
index 11e3e09..750b2e5 100644 (file)
@@ -27,7 +27,7 @@ using namespace bear;
 /// ***** Constructors/Destructors *****
 
 Ball::Ball(const Vector2& pos, float radius, const float* color)
-    : PhysicsEntity(pos), radius(radius), color(color)
+    : PhysicsEntity(pos), m_radius(radius), m_color(color)
 {
 
 }
@@ -40,10 +40,10 @@ Ball::~Ball()
 
 void Ball::draw() const
 {
-    graphics::drawCircle(radius, position, color);
+    graphics::drawCircle(m_radius, position, m_color);
 }
 
 float Ball::getRadius() const
 {
-    return radius;
+    return m_radius;
 }
index c3a1178..fd525b0 100644 (file)
@@ -37,8 +37,8 @@ class Ball: public PhysicsEntity
     float getRadius() const;
 
   //protected:
-    float radius;
-    const float* color;
+    float m_radius;
+    const float* m_color;
 };
 
 #endif // BALL_H
index 826d6fe..2874380 100644 (file)
@@ -24,12 +24,12 @@ using namespace bear;
 /// ***** Constructors/Destructors *****
 
 Line::Line(const Vector2& org, const Vector2& dest, bool canDie)
-    : Particle(org, canDie), dest(dest)
+    : Particle(org, canDie), m_dest(dest)
 {
 
 }
 Line::Line(const Vector2& org, const Vector2& dest, float life_time)
-    : Particle(org, life_time), dest(dest)
+    : Particle(org, life_time), m_dest(dest)
 {
 
 }
index 31a69d3..d013234 100644 (file)
@@ -29,14 +29,14 @@ using namespace bear;
 class Line: public Particle
 {
     public:
-        Line(const Vector2&, const Vector2&, bool=true);
-        Line(const Vector2&, const Vector2&, float);
+        Line(const Vector2& org, const Vector2& dest, bool canDie=true);
+        Line(const Vector2& org, const Vector2& dest, float life_time);
         virtual ~Line();
 
         virtual void draw();
 
      protected:
-        Vector2 dest;
+        Vector2 m_dest;
 
         // triangle stuffs
         // color
index c7626d4..d84ce75 100644 (file)
@@ -24,12 +24,12 @@ using namespace bear;
 /// ***** Constructors/Destructors *****
 
 Particle::Particle(const Vector2& pos, bool canDie)
-    : Entity(pos), canDie(canDie)
+    : Entity(pos), m_canDie(canDie)
 {
 
 }
 Particle::Particle(const Vector2& pos, float lifeTime)
-    : Entity(pos), lifeTime(lifeTime)
+    : Entity(pos), m_lifeTime(lifeTime)
 {
 
 }
@@ -42,13 +42,13 @@ Particle::~Particle()
 
 void Particle::update(float time_step)
 {
-    if(isDead)
+    if(m_isDead)
         return;
 
-    if (canDie)
+    if (m_canDie)
     {
-        lifeTime -= time_step;
-        isDead = lifeTime <= 0;
+        m_lifeTime -= time_step;
+        m_isDead = m_lifeTime <= 0;
     }
     position += velocity * time_step;
 }
index 34c8f64..cad470f 100644 (file)
@@ -44,10 +44,10 @@ class Particle: public Entity
         virtual void update(float);
 
     protected:
-        float lifeTime;
+        float m_lifeTime;
 
-        bool isDead;
-        bool canDie;
+        bool m_isDead;
+        bool m_canDie;
 };
 
 #endif // PARTICLE_H
index d8615da..b43874b 100644 (file)
@@ -27,7 +27,7 @@ using namespace bear;
 /// ***** Constructors/Destructors *****
 
 PhysicsEntity::PhysicsEntity(const Vector2& pos)
-    : Entity(pos), force(0,0), mass(1), CoR(0.8)
+    : Entity(pos), m_force(0,0), m_mass(1), m_CoR(0.8)
 {
 
 }
@@ -43,31 +43,31 @@ void PhysicsEntity::update(float time_step)
     position = positionAt(time_step);
     velocity = velocityAt(time_step);
 
-    force *= 0;
+    m_force *= 0;
 }
 
 Vector2 PhysicsEntity::positionAt(float time_step) const
 {
     Vector2 newPosition = position;
     Vector2 newVelocity = velocity;
-    Vector2 newForce = force;
+    Vector2 newForce = m_force;
 
     newPosition += effect::positionDelta(this, time_step);
     newVelocity += effect::velocityDelta(this, time_step);
     newForce += effect::forceDelta(this, time_step);
 
-    return newForce/mass / 2 * time_step * time_step + newVelocity * time_step + newPosition;
+    return newForce/m_mass / 2 * time_step * time_step + newVelocity * time_step + newPosition;
 }
 
 Vector2 PhysicsEntity::velocityAt(float time_step) const
 {
-    Vector2 newForce = force;
+    Vector2 newForce = m_force;
     Vector2 newVelocity = velocity;
 
     newForce += effect::forceDelta(this, time_step);
     newVelocity += effect::velocityDelta(this, time_step);
 
-    return newForce/mass / 2 * time_step + newVelocity;
+    return newForce/m_mass / 2 * time_step + newVelocity;
 }
 
 void PhysicsEntity::applyForce(const Vector2& force)
@@ -76,7 +76,7 @@ void PhysicsEntity::applyForce(const Vector2& force)
 }
 void PhysicsEntity::applyForce(const Vector2& force, const Vector2& /*at*/)
 {
-    this->force += force;
+    this->m_force += force;
 }
 
 void PhysicsEntity::applyImpulse(const Vector2& impulse)
index 6c1d455..d229691 100644 (file)
@@ -48,12 +48,12 @@ class PhysicsEntity: public Entity
     virtual void applyNudge(const Vector2& vecPush);
 
   //protected:
-    Vector2 force;
+    Vector2 m_force;
 
-    float mass;
+    float m_mass;
 
     // Coefficient of Restitution
-    float CoR;
+    float m_CoR;
 };
 
 #endif // PHYSICS_H
index 4b3826e..9f1aa43 100644 (file)
@@ -27,7 +27,7 @@ using namespace bear;
 /// ***** Constructors/Destructors *****
 
 Polygon::Polygon(const vector<Vector2>& points, const float* color)
-    : PhysicsEntity(Vector2(0,0)), points(points), color(color)
+    : PhysicsEntity(Vector2(0,0)), m_points(points), m_color(color)
 {
     DASSERT(0 < points.size());
 
@@ -43,24 +43,24 @@ Polygon::~Polygon()
 
 void Polygon::draw() const
 {
-    graphics::drawPolygon(points, color);
+    graphics::drawPolygon(m_points, m_color);
 }
 
 /// ***** Private Class Methods *****
 void Polygon::createBindingBox()
 {
-    DASSERT(0 < points.size());
+    DASSERT(0 < m_points.size());
 
-    maxP = points.at(0);
-    minP = points.at(0);
+    m_maxP = m_points.at(0);
+    m_minP = m_points.at(0);
 
-    for(unsigned int i=1; i<points.size(); i++)
+    for(unsigned int i=1; i<m_points.size(); i++)
     {
-             if(points[i].m_fX < minP.m_fX) minP.m_fX = points[i].m_fX;
-        else if(points[i].m_fX > maxP.m_fX) maxP.m_fX = points[i].m_fX;
+             if(m_points[i].m_fX < m_minP.m_fX) m_minP.m_fX = m_points[i].m_fX;
+        else if(m_points[i].m_fX > m_maxP.m_fX) m_maxP.m_fX = m_points[i].m_fX;
 
-             if(points[i].m_fY < minP.m_fY) minP.m_fY = points[i].m_fY;
-        else if(points[i].m_fY > maxP.m_fY) maxP.m_fY = points[i].m_fY;
+             if(m_points[i].m_fY < m_minP.m_fY) m_minP.m_fY = m_points[i].m_fY;
+        else if(m_points[i].m_fY > m_maxP.m_fY) m_maxP.m_fY = m_points[i].m_fY;
     }
 }
 
index 6624c95..7941f88 100644 (file)
@@ -38,12 +38,13 @@ class Polygon: public PhysicsEntity
         virtual void draw() const;
 
     //protected:
-        Vector2 maxP; // stores the max bounding box point
-        Vector2 minP; // stores the min bounding box point
+        Vector2 m_maxP; // stores the max bounding box point
+        Vector2 m_minP; // stores the min bounding box point
 
-        vector<Vector2> points;
+        vector<Vector2> m_points;
 
-        const float* color;
+        const float* m_color;
+        
     private:
         void createBindingBox();
         void centerPosition();
index 74158fd..c9af58d 100644 (file)
@@ -108,7 +108,7 @@ void placeEntity(PhysicsEntity* ppe)
         {
             const float& xb     = pBall->positionRaw().m_fX;
             const float& yb     = pBall->positionRaw().m_fY;
-            const float& rad    = pBall->radius;
+            const float& rad    = pBall->m_radius;
 
             vecMin.m_fX = xb - rad;
             vecMin.m_fY = yb - rad;
@@ -124,8 +124,8 @@ void placeEntity(PhysicsEntity* ppe)
 
         if( pPoly != NULL )
         {
-            vecMin = pPoly->minP;
-            vecMax = pPoly->maxP;
+            vecMin = pPoly->m_minP;
+            vecMax = pPoly->m_maxP;
 
             goto start;
         }
@@ -235,10 +235,10 @@ void applyCollision(Ball* pb1, Ball* pb2)
     const Vector2& vecNormal = cInfo.m_vecNormal;
     const Vector2& vecPoint  = cInfo.m_vecPoint;
 
-    float m1 = pb1->mass;
-    float m2 = pb2->mass;
+    float m1 = pb1->m_mass;
+    float m2 = pb2->m_mass;
 
-    float e = (pb1->CoR + pb2->CoR) / 2;
+    float e = (pb1->m_CoR + pb2->m_CoR) / 2;
 
     Vector2 v1 = pb1->velocityRaw();
     Vector2 v2 = pb2->velocityRaw();
@@ -267,7 +267,7 @@ void applyCollision(Polygon* pPoly, Ball* pBall)
     // a few values to simplify the equations
     const Vector2& vecNorm = cInfo.m_vecNormal;
 
-    float fCoR = pBall->CoR;
+    float fCoR = pBall->m_CoR;
     Vector2 vecVelo = pBall->velocityRaw();
 
     // impulse divided by mass
@@ -280,15 +280,15 @@ void applyCollision(Polygon* pPoly, Ball* pBall)
     // CoR penetration fix, adds the polygon-ball jitters
 
     // from center to point
-    Vector2 vecCollP = vecNorm / vecNorm.length() * pBall->radius;
+    Vector2 vecCollP = vecNorm / vecNorm.length() * pBall->m_radius;
     pBall->applyNudge(cInfo.m_vecPoint + vecCollP - pBall->positionRaw());
 }
 
 bool getInfo(const Ball* pb1, const Ball* pb2, CollisionInfo* pcInfo)
 {
     // a few values to simplify the equations
-    float r1 = pb1->radius;
-    float r2 = pb2->radius;
+    float r1 = pb1->m_radius;
+    float r2 = pb2->m_radius;
 
     Vector2 p1 = pb1->positionRaw();
     Vector2 p2 = pb2->positionRaw();
@@ -321,14 +321,14 @@ bool getInfo(const Ball* pb1, const Ball* pb2, CollisionInfo* pcInfo)
 bool getInfo(const Polygon* pPoly, const Ball* pBall, CollisionInfo* pcInfo)
 {
     // a few values to simplify the equations
-    float   fRad    = pBall->radius;
+    float   fRad    = pBall->m_radius;
     Vector2 vecPos  = pBall->positionRaw();
     Vector2 vecVelo = pBall->velocityRaw();
 
-    float fMaxX = pPoly->maxP.m_fX;
-    float fMinX = pPoly->minP.m_fX;
-    float fMaxY = pPoly->maxP.m_fY;
-    float fMinY = pPoly->minP.m_fY;
+    float fMaxX = pPoly->m_maxP.m_fX;
+    float fMinX = pPoly->m_minP.m_fX;
+    float fMaxY = pPoly->m_maxP.m_fY;
+    float fMinY = pPoly->m_minP.m_fY;
 
     // quick binding box check
     if (vecPos.m_fX - fRad > fMaxX || vecPos.m_fX + fRad < fMinX ||
@@ -340,7 +340,7 @@ bool getInfo(const Polygon* pPoly, const Ball* pBall, CollisionInfo* pcInfo)
     int iTot = 0;
 
     {
-        const vector<Vector2>& pts = pPoly->points;
+        const vector<Vector2>& pts = pPoly->m_points;
         unsigned int num = pts.size();
 
         for (unsigned int i = 0; i < num; i++)
index f44eda0..3f749e7 100644 (file)
@@ -67,28 +67,28 @@ void creator::init()
     s_startPolys.init();
 
     pBall = addBall(Vector2(50, 50), 20, cWhite, s_startBalls);
-    pBall->mass = fStartMass;
+    pBall->m_mass = fStartMass;
 
     pBall = addBall(Vector2(150, 50), 20, cGrey, s_startBalls);
-    pBall->mass = fStartMass;
+    pBall->m_mass = fStartMass;
 
     pBall = addBall(Vector2(50, 100), 20, cRed, s_startBalls);
-    pBall->mass = fStartMass;
+    pBall->m_mass = fStartMass;
 
     pBall = addBall(Vector2(100, 100), 20, cGreen, s_startBalls);
-    pBall->mass = fStartMass;
+    pBall->m_mass = fStartMass;
 
     pBall = addBall(Vector2(150, 100), 20, cBlue, s_startBalls);
-    pBall->mass = fStartMass;
+    pBall->m_mass = fStartMass;
 
     pBall = addBall(Vector2(50, 150), 20, cYellow, s_startBalls);
-    pBall->mass = fStartMass;
+    pBall->m_mass = fStartMass;
 
     pBall = addBall(Vector2(100, 150), 20, cMagenta, s_startBalls);
-    pBall->mass = fStartMass;
+    pBall->m_mass = fStartMass;
 
     pBall = addBall(Vector2(150, 150), 20, cCyan, s_startBalls);
-    pBall->mass = fStartMass;
+    pBall->m_mass = fStartMass;
 
 
     for( int i = 0; i < 50; i++)