fix mapgen
authoralfadur
Wed, 07 Nov 2018 18:30:33 +0300
changeset 14156 74ca70cb753d
parent 14155 8f82d87d223f
child 14157 ba4adf8498d3
fix mapgen
rust/mapgen/src/lib.rs
rust/mapgen/src/theme.rs
--- a/rust/mapgen/src/lib.rs	Wed Nov 07 18:27:24 2018 +0300
+++ b/rust/mapgen/src/lib.rs	Wed Nov 07 18:30:33 2018 +0300
@@ -14,7 +14,7 @@
 };
 use rand::{thread_rng, Rng};
 use land2d::Land2D;
-use theme::Theme;
+use self::theme::Theme;
 
 #[derive(Deserialize)]
 struct PointDesc {
--- a/rust/mapgen/src/theme.rs	Wed Nov 07 18:27:24 2018 +0300
+++ b/rust/mapgen/src/theme.rs	Wed Nov 07 18:30:33 2018 +0300
@@ -1,5 +1,5 @@
 use std::{
-    slice,
+    slice::from_raw_parts_mut,
     io,
     io::BufReader,
     fs::{File, read_dir},
@@ -69,9 +69,9 @@
                 let mut buffer: Vec<u32> = Vec::with_capacity(size.area());
                 let mut slice_u32 = buffer.as_mut_slice();
                 let mut slice_u8 = unsafe {
-                    slice::from_raw_parts_mut::<u8>(
-                        slice.as_mut_ptr() as *mut u8,
-                        slice.len() / 4
+                    from_raw_parts_mut::<u8>(
+                        slice_u32.as_mut_ptr() as *mut u8,
+                        slice_u32.len() / 4
                     )
                 };
                 reader.next_frame(slice_u8);