Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Games
Kubrick
Commits
19bd746e
Commit
19bd746e
authored
Oct 20, 2022
by
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
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/cube.cpp
View file @
19bd746e
...
...
@@ -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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment