rust/landgen/src/template_based.rs
changeset 14099 bf40b5f938b0
parent 14090 abb42ba345b6
child 14116 b2feb190e4bc
--- a/rust/landgen/src/template_based.rs	Fri Nov 02 13:30:04 2018 +0100
+++ b/rust/landgen/src/template_based.rs	Fri Nov 02 14:29:24 2018 +0100
@@ -23,19 +23,10 @@
         parameters: LandGenerationParameters<T>,
         random_numbers: &mut I,
     ) -> Land2D<T> {
-        let mut points =
-            OutlinePoints::from_outline_template(&self.outline_template, random_numbers);
-
-        let mut land = Land2D::new(points.size, parameters.basic);
+        let mut land = Land2D::new(self.outline_template.size, parameters.basic);
 
-        let top_left = Point::new(
-            (land.width() - land.play_width() / 2) as i32,
-            (land.height() - land.play_height()) as i32,
-        );
-
-        points.size = land.size();
-
-        points.iter_mut().for_each(|p| *p += top_left);
+        let mut points =
+            OutlinePoints::from_outline_template(&self.outline_template, land.play_box(), land.size(), random_numbers);
 
         // mirror
         if self.outline_template.can_mirror {
@@ -72,15 +63,3 @@
         land
     }
 }
-
-#[test()]
-fn points_test() {
-    let mut points = OutlinePoints {
-        islands: vec![vec![]],
-        fill_points: vec![Point::new(1, 1)],
-        size: Size::square(100),
-    };
-
-    points.iter_mut().for_each(|p| p.x = 2);
-    assert_eq!(points.fill_points[0].x, 2);
-}