Skip to content

Commit

Permalink
Small improvement in Game::movePlayerTank method.
Browse files Browse the repository at this point in the history
  • Loading branch information
przemek83 committed Oct 9, 2024
1 parent cd4da40 commit d34361d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ void Game::movePlayerTank(const std::set<InputAction>& actions)
{
Tank& tank{getPlayerTank()};

Direction direction{Direction::UP};
setPower(tank);
const auto now{std::chrono::system_clock::now()};
if ((actions.find(InputAction::FIRE) != actions.end()) && tank.canFire(now))
Expand All @@ -103,8 +102,7 @@ void Game::movePlayerTank(const std::set<InputAction>& actions)
map_.tagAreaAsChanged(tank.getLocation(),
{tank.getX() + tileSize, tank.getY() + tileSize});

bool shouldMove{false};
std::tie(shouldMove, direction) = inputActionsToDirection(actions);
const auto [shouldMove, direction]{inputActionsToDirection(actions)};
if (shouldMove)
movement(tank, direction);
}
Expand Down

0 comments on commit d34361d

Please sign in to comment.