Be more explicit about captures
This commit is contained in:
parent
b3798ef2df
commit
af1c650727
1 changed files with 2 additions and 2 deletions
|
@ -59,7 +59,7 @@ void PacMan::updateMazePosition(std::chrono::milliseconds time_delta) {
|
||||||
const double position_delta = 0.004 * time_delta.count();
|
const double position_delta = 0.004 * time_delta.count();
|
||||||
const auto pacman_size = 1;
|
const auto pacman_size = 1;
|
||||||
|
|
||||||
auto moveToPosition = [&](Position point, Direction move_direction) {
|
auto moveToPosition = [position_delta](Position point, Direction move_direction) {
|
||||||
switch (move_direction) {
|
switch (move_direction) {
|
||||||
case Direction::LEFT:
|
case Direction::LEFT:
|
||||||
return GridPosition{ std::size_t(point.x - position_delta), std::size_t(point.y) };
|
return GridPosition{ std::size_t(point.x - position_delta), std::size_t(point.y) };
|
||||||
|
@ -75,7 +75,7 @@ void PacMan::updateMazePosition(std::chrono::milliseconds time_delta) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
auto canGo = [&](Direction move_direction) {
|
auto canGo = [&moveToPosition, this](Direction move_direction) {
|
||||||
return isWalkableForPacMan(moveToPosition(pos, move_direction));
|
return isWalkableForPacMan(moveToPosition(pos, move_direction));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue