Skip to content

Commit 8d18843

Browse files
committed
Fix world encode
1 parent 7f0d7fb commit 8d18843

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

ewext/src/modules/world_sync.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,18 @@ impl WorldData for ParticleWorldState {
9999
else {
100100
return Err(eyre!("chunk not loaded"));
101101
};
102+
let mut chunk_iter = chunk.iter_mut();
102103
let (shift_x, shift_y) = self.get_shift::<CHUNK_SIZE>(cx, cy);
103-
for ((j, i), p) in (shift_x..shift_x + CHUNK_SIZE as isize)
104-
.flat_map(|i| (shift_y..shift_y + CHUNK_SIZE as isize).map(move |j| (i, j)))
105-
.zip(chunk.iter_mut())
106-
{
107-
*p = pixel_array.get_pixel(i, j);
104+
for j in shift_y..shift_y + CHUNK_SIZE as isize {
105+
for i in shift_x..shift_x + CHUNK_SIZE as isize {
106+
*chunk_iter.next().unwrap() = pixel_array.get_pixel(i, j);
107+
}
108108
}
109+
109110
Ok(())
110111
}
111112
unsafe fn decode_world(&self, chunk: NoitaWorldUpdate) -> eyre::Result<()> {
113+
return Ok(()); // TODO
112114
let chunk_coord = chunk.coord;
113115
let (cx, cy) = (chunk_coord.0 as isize, chunk_coord.1 as isize);
114116
let Some(pixel_array) = unsafe { self.world_ptr.as_mut() }

0 commit comments

Comments
 (0)