mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 17:07:35 +00:00
LibJS: Replace Cell live bit with a cell state
So far we only have two states: Live and Dead. In the future, we can add additional states to support incremental sweeping and/or multi- stage cell destruction.
This commit is contained in:
parent
91656d63c7
commit
789d20ebb7
4 changed files with 32 additions and 20 deletions
|
@ -26,8 +26,13 @@ public:
|
|||
bool is_marked() const { return m_mark; }
|
||||
void set_marked(bool b) { m_mark = b; }
|
||||
|
||||
bool is_live() const { return m_live; }
|
||||
void set_live(bool b) { m_live = b; }
|
||||
enum class State {
|
||||
Live,
|
||||
Dead,
|
||||
};
|
||||
|
||||
State state() const { return m_state; }
|
||||
void set_state(State state) { m_state = state; }
|
||||
|
||||
virtual const char* class_name() const = 0;
|
||||
|
||||
|
@ -54,8 +59,8 @@ protected:
|
|||
Cell() { }
|
||||
|
||||
private:
|
||||
bool m_mark { false };
|
||||
bool m_live { true };
|
||||
bool m_mark : 1 { false };
|
||||
State m_state : 7 { State::Live };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue