diff options
Diffstat (limited to 'src/sim/cell_manager/chunk.rs')
| -rw-r--r-- | src/sim/cell_manager/chunk.rs | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/src/sim/cell_manager/chunk.rs b/src/sim/cell_manager/chunk.rs index 3bf1e9f..463242d 100644 --- a/src/sim/cell_manager/chunk.rs +++ b/src/sim/cell_manager/chunk.rs @@ -1,16 +1,13 @@ -use fxhash::FxHashMap; use glam::IVec2; use crate::{ config::{CELLS_IN_CHUNK, CHUNK_SIZE}, content::materials::MaterialForm, - sim::{cell::Cell, entity::EntityId, lib::marching_squares::Marchable}, + sim::{cell::Cell, lib::marching_squares::Marchable}, }; pub struct Chunk { pub cells: Box<[Cell; CELLS_IN_CHUNK]>, - pub cell_data: FxHashMap<usize, u16>, - pub cell_entity: FxHashMap<usize, EntityId>, pub sleeping: bool, pub needs_texture_update: bool, } @@ -25,35 +22,9 @@ impl Chunk { self.cells[x as usize + y as usize * CHUNK_SIZE as usize] = cell; } - #[inline] - pub fn get_data_at_local_position(&self, x: u8, y: u8) -> Option<u16> { - self.cell_data - .get(&(x as usize + y as usize * CHUNK_SIZE as usize)) - .copied() - } - #[inline] - pub fn set_data_at_local_position(&mut self, x: u8, y: u8, data: u16) { - self.cell_data - .insert(x as usize + y as usize * CHUNK_SIZE as usize, data); - } - - #[inline] - pub fn get_entity_at_local_position(&self, x: u8, y: u8) -> Option<EntityId> { - self.cell_entity - .get(&(x as usize + y as usize * CHUNK_SIZE as usize)) - .copied() - } - #[inline] - pub fn set_entity_at_local_position(&mut self, x: u8, y: u8, entity_id: EntityId) { - self.cell_entity - .insert(x as usize + y as usize * CHUNK_SIZE as usize, entity_id); - } - pub fn void() -> Self { Chunk { cells: Box::new([Cell::void(); CELLS_IN_CHUNK]), - cell_data: FxHashMap::default(), - cell_entity: FxHashMap::default(), sleeping: true, needs_texture_update: true, } |
