mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Better spawn town
This commit is contained in:
parent
ba80f7c872
commit
fff4021777
@ -34,6 +34,9 @@ pub struct Civs {
|
||||
sites: Store<Site>,
|
||||
}
|
||||
|
||||
// Change this to get rid of particularly horrid seeds
|
||||
const SEED_SKIP: u8 = 1;
|
||||
|
||||
pub struct GenCtx<'a, R: Rng> {
|
||||
sim: &'a mut WorldSim,
|
||||
rng: R,
|
||||
@ -41,9 +44,11 @@ pub struct GenCtx<'a, R: Rng> {
|
||||
|
||||
impl<'a, R: Rng> GenCtx<'a, R> {
|
||||
pub fn reseed(&mut self) -> GenCtx<'_, impl Rng> {
|
||||
let mut entropy = self.rng.gen::<[u8; 32]>();
|
||||
entropy[0] = entropy[0].wrapping_add(SEED_SKIP); // Skip bad seeds
|
||||
GenCtx {
|
||||
sim: self.sim,
|
||||
rng: ChaChaRng::from_seed(self.rng.gen()),
|
||||
rng: ChaChaRng::from_seed(entropy),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user