summaryrefslogtreecommitdiffstats
path: root/src/object
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2013-05-27 22:26:44 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2013-05-27 22:29:42 +0200
commitb22d852b4c4aa89e0394397a703ecfa442b0a928 (patch)
treea1e29142aabf11393eb3e0604deb4b89a6124fe7 /src/object
parent12313fecf5a0ccad45f88575a24582b8363bd5a7 (diff)
downloadcolobot-b22d852b4c4aa89e0394397a703ecfa442b0a928.tar.gz
colobot-b22d852b4c4aa89e0394397a703ecfa442b0a928.tar.bz2
colobot-b22d852b4c4aa89e0394397a703ecfa442b0a928.zip
Fixed variable shadowing warnings
* fixed -Wshadow warnings * refactored some constructors
Diffstat (limited to 'src/object')
-rw-r--r--src/object/motion/motionhuman.cpp8
-rw-r--r--src/object/robotmain.cpp19
2 files changed, 13 insertions, 14 deletions
diff --git a/src/object/motion/motionhuman.cpp b/src/object/motion/motionhuman.cpp
index b1de44e..edee260 100644
--- a/src/object/motion/motionhuman.cpp
+++ b/src/object/motion/motionhuman.cpp
@@ -1617,18 +1617,18 @@ bool CMotionHuman::EventFrame(const Event &event)
legAction == MH_MARCHTAKE )
{
Sound sound[2];
- float speed, synchro, volume[2], freq[2], hard, level;
+ float synchro, volume[2], freq[2], hard;
- speed = m_physics->GetLinMotionX(MO_REASPEED);
+ float speedX = m_physics->GetLinMotionX(MO_REASPEED);
if ( m_object->GetFret() == 0 )
{
- if ( speed > 0.0f ) synchro = 0.21f; // synchro forward
+ if ( speedX > 0.0f ) synchro = 0.21f; // synchro forward
else synchro = 0.29f; // synchro backward
}
else
{
- if ( speed > 0.0f ) synchro = 0.15f; // synchro forward
+ if ( speedX > 0.0f ) synchro = 0.15f; // synchro forward
else synchro = 0.35f; // synchro backward
}
time = rTime[1]+synchro;
diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp
index 34f13f6..27492f3 100644
--- a/src/object/robotmain.cpp
+++ b/src/object/robotmain.cpp
@@ -4082,7 +4082,6 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
if (Cmd(line, "CacheAudio") && !resetObject && m_version >= 2)
{
- char filename[100];
OpString(line, "filename", filename);
m_sound->CacheMusic(filename);
continue;
@@ -4116,9 +4115,9 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
int trackid = OpInt(line, "track", 0);
if (trackid != 0)
{
- std::stringstream filename;
- filename << "music" << std::setfill('0') << std::setw(3) << trackid << ".ogg";
- m_audioTrack = filename.str();
+ std::stringstream filenameStr;
+ filenameStr << "music" << std::setfill('0') << std::setw(3) << trackid << ".ogg";
+ m_audioTrack = filenameStr.str();
}
}
else
@@ -4392,10 +4391,10 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
AddExt(name, ".png");
int dx = OpInt(line, "dx", 1);
int dy = OpInt(line, "dy", 1);
- char* op = SearchOp(line, "table");
+ char* opTable = SearchOp(line, "table");
int tt[100];
for (int i = 0; i < dx*dy; i++)
- tt[i] = GetInt(op, i, 0);
+ tt[i] = GetInt(opTable, i, 0);
if (strstr(name, "%user%") != 0)
CopyFileListToTemp(name, tt, dx*dy);
@@ -4484,12 +4483,12 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
continue;
}
- char* op = SearchOp(line, "id");
+ char* opId = SearchOp(line, "id");
int id[50];
int i = 0;
while (i < 50)
{
- id[i] = GetInt(op, i, 0);
+ id[i] = GetInt(opId, i, 0);
if (id[i++] == 0) break;
}
@@ -4589,9 +4588,9 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
}
Math::Vector pos = OpPos(line, "pos")*g_unit;
- float dir = OpFloat(line, "dir", 0.0f)*Math::PI;
+ float dirAngle = OpFloat(line, "dir", 0.0f)*Math::PI;
bool trainer = OpInt(line, "trainer", 0);
- CObject* obj = CreateObject(pos, dir,
+ CObject* obj = CreateObject(pos, dirAngle,
OpFloat(line, "z", 1.0f),
OpFloat(line, "h", 0.0f),
type,