Don't use ->

This commit is contained in:
Patricia Aas 2021-07-06 17:09:42 +02:00
parent a7a1565c99
commit f7b53d9fca
2 changed files with 3 additions and 2 deletions

View file

@ -117,7 +117,7 @@ void Game::eatPellets() {
void Game::processEvents(InputState & inputState) { void Game::processEvents(InputState & inputState) {
auto event = canvas.pollEvent(); auto event = canvas.pollEvent();
if (event && event->type == sf::Event::Closed) { if (event && event.value().type == sf::Event::Closed) {
inputState.close = true; inputState.close = true;
return; return;
} }

View file

@ -156,8 +156,9 @@ void Ghost::updateDirection(const Board & board) {
return a.distance < b.distance; return a.distance < b.distance;
}); });
auto move = *optimal_move;
direction = move.direction;
last_grid_position = current_grid_position; last_grid_position = current_grid_position;
direction = optimal_move->direction;
} }
Position Ghost::target(const Board & board) const { Position Ghost::target(const Board & board) const {