diff -r 5237b4c44d11 -r 19358c313ebb rust/lib-hedgewars-engine/src/world.rs --- 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(¶ms, &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)); }