-
Notifications
You must be signed in to change notification settings - Fork 28
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
base: master
Are you sure you want to change the base?
Conversation
@@ -33,11 +33,14 @@ class Controller : public IEventHandler | |||
void receive(std::unique_ptr<Event> e) override; | |||
|
|||
private: | |||
bool paused = false; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); | ||
/* |
There was a problem hiding this comment.
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){ |
There was a problem hiding this comment.
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.
Sorry for late request, I've had some stupid problems with token