From f7b53d9fca62d053026e672b840ba190794be15d Mon Sep 17 00:00:00 2001 From: Patricia Aas Date: Tue, 6 Jul 2021 17:09:42 +0200 Subject: [PATCH] Don't use -> --- lib/Game.cpp | 2 +- lib/Ghost.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Game.cpp b/lib/Game.cpp index 2ca5767..538d558 100644 --- a/lib/Game.cpp +++ b/lib/Game.cpp @@ -117,7 +117,7 @@ void Game::eatPellets() { void Game::processEvents(InputState & inputState) { auto event = canvas.pollEvent(); - if (event && event->type == sf::Event::Closed) { + if (event && event.value().type == sf::Event::Closed) { inputState.close = true; return; } diff --git a/lib/Ghost.cpp b/lib/Ghost.cpp index 166de87..eeb8940 100644 --- a/lib/Ghost.cpp +++ b/lib/Ghost.cpp @@ -156,8 +156,9 @@ void Ghost::updateDirection(const Board & board) { return a.distance < b.distance; }); + auto move = *optimal_move; + direction = move.direction; last_grid_position = current_grid_position; - direction = optimal_move->direction; } Position Ghost::target(const Board & board) const {