Commit 19bd746e authored by Marius Pa's avatar Marius Pa
Browse files

cube reduce scope of variable d

Fix cppcheck issue "src/cube.cpp:115: The scope of the variable 'd'
can be reduced.".
parent e6d8a682
Pipeline #252158 passed with stage
in 2 minutes and 23 seconds
......@@ -112,20 +112,19 @@ bool Cube::findSticker (double position [], float myCubieSize,
bool result = false;
double location [nAxes];
double distance = sqrt ((double) 2.0);
double d;
// Calculate the position in the cube's internal co-ordinate system.
LOOP (i, nAxes) {
location [i] = (position [i] / myCubieSize) * 2.0;
// IDW faceCentre [i] = 0; // Return zeroes if no sticker is found.
location [i] = (position [i] / myCubieSize) * 2.0;
// IDW faceCentre [i] = 0; // Return zeroes if no sticker is found.
}
for (Cubie * cubie : std::as_const(cubies)) {
d = cubie->findCloserSticker (distance, location, faceCentre);
if (d < distance) {
distance = d;
result = true;
}
double d = cubie->findCloserSticker (distance, location, faceCentre);
if (d < distance) {
distance = d;
result = true;
}
}
return (result);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment