Skip to content

Commit 6341e91

Browse files
committed
Fixed config seed
1 parent c47c564 commit 6341e91

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

feather/server/src/main.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
use std::{cell::RefCell, rc::Rc, sync::Arc};
1+
use std::{
2+
cell::RefCell,
3+
collections::hash_map::DefaultHasher,
4+
hash::{Hash, Hasher},
5+
rc::Rc,
6+
sync::Arc,
7+
};
28

39
use anyhow::Context;
410
use base::anvil::level::SuperflatGeneratorOptions;
@@ -64,7 +70,11 @@ fn init_world_source(game: &mut Game, config: &Config) {
6470
// world otherwise. This is a placeholder:
6571
// we don't have proper world generation yet.
6672

67-
let seed = 42; // FIXME: load from the level file
73+
let seed = config.world.seed.parse().unwrap_or_else(|_| {
74+
let mut hasher = DefaultHasher::new();
75+
config.world.seed.hash(&mut hasher);
76+
hasher.finish()
77+
});
6878

6979
let generator: Arc<dyn WorldGenerator> = match &config.world.generator[..] {
7080
"flat" => Arc::new(SuperflatWorldGenerator::new(

0 commit comments

Comments
 (0)