Minor formatting and warning fixes.
This commit is contained in:
parent
d0bd69aee1
commit
aa45121bec
2 changed files with 4 additions and 2 deletions
|
@ -184,7 +184,7 @@ void Ghost::updateDirection(const GameState & gameState) {
|
|||
return a.distance_to_target < b.distance_to_target;
|
||||
});
|
||||
|
||||
auto move = *optimal_move;
|
||||
const auto& move = *optimal_move;
|
||||
direction = move.direction;
|
||||
last_grid_position = current_grid_position;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ GridPosition PacMan::positionInGrid() const {
|
|||
void PacMan::die() {
|
||||
if (dead)
|
||||
return;
|
||||
|
||||
dead = true;
|
||||
}
|
||||
|
||||
|
@ -33,8 +34,10 @@ void PacMan::update(std::chrono::milliseconds time_delta, Direction input_direct
|
|||
updateAnimationPosition(time_delta, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (input_direction != Direction::NONE)
|
||||
desired_direction = input_direction;
|
||||
|
||||
const auto old = pos;
|
||||
updateMazePosition(time_delta);
|
||||
const bool paused = pos == old;
|
||||
|
@ -50,7 +53,6 @@ void PacMan::updateAnimationPosition(std::chrono::milliseconds time_delta, bool
|
|||
}
|
||||
|
||||
void PacMan::updateMazePosition(std::chrono::milliseconds time_delta) {
|
||||
|
||||
if (isPortal(positionInGrid(), direction)) {
|
||||
pos = gridPositionToPosition(teleport(positionInGrid()));
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue