error C2374: 'i' : redefinition; multiple initialization

make MSVC 6.0 build again.
This code breaks:
for (int i=0;....
for (int i=0;....
use
int i;
for (i=0;...
for (i=0;...
instead ;-)
This commit is contained in:
ejcoumans
2008-02-05 05:55:25 +00:00
parent dad6667756
commit 39ecc2ab7e
5 changed files with 19 additions and 13 deletions

View File

@@ -216,7 +216,8 @@ public:
glDisable (GL_LIGHTING); glDisable (GL_LIGHTING);
glColor3f (0.0, 1.0, 0.0); glColor3f (0.0, 1.0, 0.0);
glBegin (GL_LINES); glBegin (GL_LINES);
for (int i = 0; i < NUMRAYS_IN_BAR; i++) int i;
for (i = 0; i < NUMRAYS_IN_BAR; i++)
{ {
glVertex3f (source[i][0], source[i][1], source[i][2]); glVertex3f (source[i][0], source[i][1], source[i][2]);
glVertex3f (hit_com[i][0], hit_com[i][1], hit_com[i][2]); glVertex3f (hit_com[i][0], hit_com[i][1], hit_com[i][2]);
@@ -224,7 +225,7 @@ public:
glColor3f (1.0, 1.0, 1.0); glColor3f (1.0, 1.0, 1.0);
glBegin (GL_LINES); glBegin (GL_LINES);
btScalar normal_scale = 10.0; // easier to see if this is big btScalar normal_scale = 10.0; // easier to see if this is big
for (int i = 0; i < NUMRAYS_IN_BAR; i++) for (i = 0; i < NUMRAYS_IN_BAR; i++)
{ {
glVertex3f (hit_surface[i][0], hit_surface[i][1], hit_surface[i][2]); glVertex3f (hit_surface[i][0], hit_surface[i][1], hit_surface[i][2]);
glVertex3f (hit_surface[i][0] + normal_scale * normal[i][0], hit_surface[i][1] + normal_scale * normal[i][1], hit_surface[i][2] + normal_scale * normal[i][2]); glVertex3f (hit_surface[i][0] + normal_scale * normal[i][0], hit_surface[i][1] + normal_scale * normal[i][1], hit_surface[i][2] + normal_scale * normal[i][2]);
@@ -235,7 +236,7 @@ public:
btQuaternion qTo; btQuaternion qTo;
qFrom.setRotation (btVector3(1.0, 0.0, 0.0), 0.0); qFrom.setRotation (btVector3(1.0, 0.0, 0.0), 0.0);
qTo.setRotation (btVector3(1.0, 0.0, 0.0), 0.7); qTo.setRotation (btVector3(1.0, 0.0, 0.0), 0.7);
for (int i = 0; i < NUMRAYS_IN_BAR; i++) for ( i = 0; i < NUMRAYS_IN_BAR; i++)
{ {
btTransform from(qFrom, source[i]); btTransform from(qFrom, source[i]);
btTransform to(qTo, dest[i]); btTransform to(qTo, dest[i]);

View File

@@ -215,7 +215,9 @@ public:
glDisable (GL_LIGHTING); glDisable (GL_LIGHTING);
glColor3f (0.0, 1.0, 0.0); glColor3f (0.0, 1.0, 0.0);
glBegin (GL_LINES); glBegin (GL_LINES);
for (int i = 0; i < NUMRAYS_IN_BAR; i++) int i;
for (i = 0; i < NUMRAYS_IN_BAR; i++)
{ {
glVertex3f (source[i][0], source[i][1], source[i][2]); glVertex3f (source[i][0], source[i][1], source[i][2]);
glVertex3f (hit[i][0], hit[i][1], hit[i][2]); glVertex3f (hit[i][0], hit[i][1], hit[i][2]);
@@ -223,7 +225,7 @@ public:
glEnd (); glEnd ();
glColor3f (1.0, 1.0, 1.0); glColor3f (1.0, 1.0, 1.0);
glBegin (GL_LINES); glBegin (GL_LINES);
for (int i = 0; i < NUMRAYS_IN_BAR; i++) for (i = 0; i < NUMRAYS_IN_BAR; i++)
{ {
glVertex3f (hit[i][0], hit[i][1], hit[i][2]); glVertex3f (hit[i][0], hit[i][1], hit[i][2]);
glVertex3f (hit[i][0] + normal[i][0], hit[i][1] + normal[i][1], hit[i][2] + normal[i][2]); glVertex3f (hit[i][0] + normal[i][0], hit[i][1] + normal[i][1], hit[i][2] + normal[i][2]);
@@ -231,7 +233,7 @@ public:
glEnd (); glEnd ();
glColor3f (0.0, 1.0, 1.0); glColor3f (0.0, 1.0, 1.0);
glBegin (GL_POINTS); glBegin (GL_POINTS);
for (int i = 0; i < NUMRAYS_IN_BAR; i++) for ( i = 0; i < NUMRAYS_IN_BAR; i++)
{ {
glVertex3f (hit[i][0], hit[i][1], hit[i][2]); glVertex3f (hit[i][0], hit[i][1], hit[i][2]);
} }

View File

@@ -118,7 +118,8 @@ public:
float fLegLength = 0.45f; float fLegLength = 0.45f;
float fForeLegLength = 0.75f; float fForeLegLength = 0.75f;
m_shapes[0] = new btCapsuleShape(btScalar(fBodySize), btScalar(0.10)); m_shapes[0] = new btCapsuleShape(btScalar(fBodySize), btScalar(0.10));
for (int i=0; i<NUM_LEGS; i++) int i;
for ( i=0; i<NUM_LEGS; i++)
{ {
m_shapes[1 + 2*i] = new btCapsuleShape(btScalar(0.10), btScalar(fLegLength)); m_shapes[1 + 2*i] = new btCapsuleShape(btScalar(0.10), btScalar(fLegLength));
m_shapes[2 + 2*i] = new btCapsuleShape(btScalar(0.08), btScalar(fForeLegLength)); m_shapes[2 + 2*i] = new btCapsuleShape(btScalar(0.08), btScalar(fForeLegLength));
@@ -144,7 +145,7 @@ public:
m_bodies[0] = localCreateRigidBody(btScalar(1.), offset*transform, m_shapes[0]); m_bodies[0] = localCreateRigidBody(btScalar(1.), offset*transform, m_shapes[0]);
} }
// legs // legs
for (int i=0; i<NUM_LEGS; i++) for ( i=0; i<NUM_LEGS; i++)
{ {
float fAngle = 2 * M_PI * i / NUM_LEGS; float fAngle = 2 * M_PI * i / NUM_LEGS;
float fSin = sin(fAngle); float fSin = sin(fAngle);
@@ -167,7 +168,7 @@ public:
} }
// Setup some damping on the m_bodies // Setup some damping on the m_bodies
for (int i = 0; i < BODYPART_COUNT; ++i) for (i = 0; i < BODYPART_COUNT; ++i)
{ {
m_bodies[i]->setDamping(0.05, 0.85); m_bodies[i]->setDamping(0.05, 0.85);
m_bodies[i]->setDeactivationTime(0.8); m_bodies[i]->setDeactivationTime(0.8);
@@ -184,7 +185,7 @@ public:
btTransform localA, localB, localC; btTransform localA, localB, localC;
for (int i=0; i<NUM_LEGS; i++) for ( i=0; i<NUM_LEGS; i++)
{ {
float fAngle = 2 * M_PI * i / NUM_LEGS; float fAngle = 2 * M_PI * i / NUM_LEGS;
float fSin = sin(fAngle); float fSin = sin(fAngle);

View File

@@ -377,7 +377,7 @@ m_threadSupportCollision = new Win32ThreadSupport(Win32ThreadSupport::Win32Threa
float wallDistance = 3; float wallDistance = 3;
for (int i=0;i<numWalls;i++) for ( i=0;i<numWalls;i++)
{ {
float zPos = (i-numWalls/2) * wallDistance; float zPos = (i-numWalls/2) * wallDistance;
createStack(m_collisionShapes[shapeIndex[1]],halfExtents,wallHeight,zPos); createStack(m_collisionShapes[shapeIndex[1]],halfExtents,wallHeight,zPos);

View File

@@ -126,13 +126,15 @@ btShapeHull::buildHull (btScalar margin)
} }
m_vertices.resize (hr.mNumOutputVertices); m_vertices.resize (hr.mNumOutputVertices);
for (unsigned int i = 0; i < hr.mNumOutputVertices; i++)
for (i = 0; i < hr.mNumOutputVertices; i++)
{ {
m_vertices[i] = hr.mOutputVertices[i]; m_vertices[i] = hr.mOutputVertices[i];
} }
m_numIndices = hr.mNumIndices; m_numIndices = hr.mNumIndices;
m_indices = new unsigned int [m_numIndices]; m_indices = new unsigned int [m_numIndices];
for (unsigned int i = 0; i < m_numIndices; i++) for (i = 0; i < m_numIndices; i++)
{ {
m_indices[i] = hr.mIndices[i]; m_indices[i] = hr.mIndices[i];
} }