rust/lib-hedgewars-engine/src/world.rs
changeset 14713 19358c313ebb
parent 14710 19122a329774
child 14714 65c971417780
--- a/rust/lib-hedgewars-engine/src/world.rs	Fri Mar 22 20:38:50 2019 +0300
+++ b/rust/lib-hedgewars-engine/src/world.rs	Fri Mar 22 21:09:17 2019 +0300
@@ -43,6 +43,18 @@
     pub fn create_renderer(&mut self, width: u16, height: u16) {
         self.renderer = Some(MapRenderer::new(512, 512));
         self.camera = Camera::with_size(Size::new(width as usize, height as usize));
+
+        use mapgen::{theme::Theme, MapGenerator};
+        use std::path::Path;
+
+        if let Some(ref state) = self.game_state {
+            let theme =
+                Theme::load(Path::new("../../share/hedgewars/Data/Themes/Cheese/")).unwrap();
+            let texture = MapGenerator::new().make_texture32(&state.land, &theme);
+            if let Some(ref mut renderer) = self.renderer {
+                renderer.init(&texture);
+            }
+        }
     }
 
     pub fn set_seed(&mut self, seed: &[u8]) {
@@ -83,18 +95,6 @@
         let landgen = TemplatedLandGenerator::new(template);
         let land = landgen.generate_land(&params, &mut self.random_numbers_gen);
 
-        use mapgen::{
-            theme::{slice_u32_to_u8, Theme},
-            MapGenerator,
-        };
-
-        use std::path::Path;
-
-        let theme = Theme::load(Path::new("../../share/hedgewars/Data/Themes/Cheese/")).unwrap();
-        let texture = MapGenerator::new().make_texture32(&land, &theme);
-        if let Some(ref mut renderer) = self.renderer {
-            renderer.init(&texture);
-        }
         self.game_state = Some(GameState::new(land, physics));
     }