mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
Maybe make FWS a bit safer.
This commit is contained in:
parent
5d7792a2e4
commit
279825fd7c
1 changed files with 4 additions and 4 deletions
|
@ -118,8 +118,8 @@ impl ParticleWorldState {
|
|||
mat_id
|
||||
}
|
||||
|
||||
fn get_cell_type(&self, cell: &ntypes::Cell) -> ntypes::CellType {
|
||||
unsafe { cell.material_ptr().as_ref().unwrap().cell_type }
|
||||
fn get_cell_type(&self, cell: &ntypes::Cell) -> Option<ntypes::CellType> {
|
||||
unsafe { Some(cell.material_ptr().as_ref()?.cell_type) }
|
||||
}
|
||||
|
||||
pub(crate) unsafe fn encode_area(
|
||||
|
@ -144,7 +144,7 @@ impl ParticleWorldState {
|
|||
};
|
||||
let cell = self.get_cell_raw(x, y);
|
||||
if let Some(cell) = cell {
|
||||
let cell_type = self.get_cell_type(cell);
|
||||
let cell_type = self.get_cell_type(cell).unwrap_or(ntypes::CellType::None);
|
||||
match cell_type {
|
||||
ntypes::CellType::None => {}
|
||||
// Nobody knows how box2d pixels work.
|
||||
|
@ -158,7 +158,7 @@ impl ParticleWorldState {
|
|||
raw_pixel.material = self.get_cell_material_id(cell);
|
||||
}
|
||||
// ???
|
||||
ntypes::CellType::Invalid => {}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
self.runner.put_pixel(raw_pixel);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue