mirror of
https://github.com/lisk77/comet.git
synced 2025-12-12 17:18:50 +00:00
fix(ecs): some replacement issues
This commit is contained in:
parent
a01a52766d
commit
eced6ddf3f
8 changed files with 176 additions and 112 deletions
|
|
@ -28,6 +28,12 @@ impl SparseSet {
|
|||
}
|
||||
|
||||
if let Some(page_vec) = &mut self.sparse[page] {
|
||||
// If there is already a mapping, overwrite the existing dense value instead of pushing.
|
||||
if let Some(sparse_index) = page_vec[index % self.page_size] {
|
||||
let _ = self.dense.set::<T>(sparse_index, value);
|
||||
return;
|
||||
}
|
||||
|
||||
page_vec[index % self.page_size] = Some(self.dense.data.len());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue