mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:27:35 +00:00
Solitaire: Use a single State enum instead of a series of booleans
We had 4 different bools before, but the only valid states were either that only one of them was true, or than none of them are true. An enum is a better fit here, by enforcing that we can only be in one state at a time.
This commit is contained in:
parent
9f9b8e7273
commit
e8d83b1ae1
2 changed files with 38 additions and 26 deletions
|
@ -204,11 +204,16 @@ private:
|
|||
|
||||
bool m_mouse_down { false };
|
||||
|
||||
enum class State {
|
||||
WaitingForNewGame,
|
||||
NewGameAnimation,
|
||||
GameInProgress,
|
||||
StartGameOverAnimationNextFrame,
|
||||
GameOverAnimation,
|
||||
};
|
||||
State m_state { State::WaitingForNewGame };
|
||||
|
||||
Animation m_animation;
|
||||
bool m_start_game_over_animation_next_frame { false };
|
||||
bool m_game_over_animation { false };
|
||||
bool m_waiting_for_new_game { true };
|
||||
bool m_new_game_animation { false };
|
||||
uint8_t m_new_game_animation_pile { 0 };
|
||||
uint8_t m_new_game_animation_delay { 0 };
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue