1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:57: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:
Sam Atkins 2023-01-28 17:00:30 +00:00 committed by Linus Groh
parent 9f9b8e7273
commit e8d83b1ae1
2 changed files with 38 additions and 26 deletions

View file

@ -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 };