Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solved problem #3 #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Solved problem #3 #12

wants to merge 1 commit into from

Conversation

ze1nnn
Copy link

@ze1nnn ze1nnn commented Jul 14, 2022

Sorry for late request, I've had some stupid problems with token

@@ -33,11 +33,14 @@ class Controller : public IEventHandler
void receive(std::unique_ptr<Event> e) override;

private:
bool paused = false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would go with a name showing condition that the bool variable is checking, i.e. isPaused here.

@@ -150,6 +157,20 @@ void Controller::handleNewFood(const FoodResp& requestedFood)
m_foodPosition = std::make_pair(requestedFood.x, requestedFood.y);
}

void Controller::handlePauseState(const PauseInd&)
{
(paused == false) ? (paused = true) : (paused = false);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

paused = !paused; ;)

void Controller::handlePauseState(const PauseInd&)
{
(paused == false) ? (paused = true) : (paused = false);
/*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to commit the commented code - YAGNI rule :)

}

void Controller::handleDirectionChange(const DirectionInd& directionInd)
{
if(!paused){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To remove number of indentations you can just write:
if (paused) return;
Will be easier to track later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants