diff options
Diffstat (limited to 'src/sim/cell.rs')
| -rw-r--r-- | src/sim/cell.rs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/sim/cell.rs b/src/sim/cell.rs index 2e26ddc..d3ca302 100644 --- a/src/sim/cell.rs +++ b/src/sim/cell.rs @@ -4,6 +4,20 @@ use crate::sim::materials::MaterialId; pub struct Cell { pub material: MaterialId, pub flags: u8, + pub data: u16, +} + +impl Cell { + const FLAG_PARITY: u8 = 0b0000_0001; + + #[inline] + pub fn parity(self) -> u8 { + self.flags & Self::FLAG_PARITY + } + #[inline] + pub fn flip_parity(&mut self) { + self.flags ^= Self::FLAG_PARITY; + } } impl Cell { @@ -11,9 +25,14 @@ impl Cell { Cell { material: MaterialId::Void, flags: 0, + data: 0, } } pub fn from_material(material: MaterialId) -> Cell { - Cell { material, flags: 0 } + Cell { + material, + flags: 0, + data: 0, + } } } |
