mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
cargo fmt, pass calendar down into building creation
This commit is contained in:
parent
42ba9212ea
commit
8a85d6e6e0
@ -362,10 +362,7 @@ impl Server {
|
||||
);
|
||||
|
||||
#[cfg(feature = "worldgen")]
|
||||
let map = world.get_map_data(
|
||||
index.as_index_ref(),
|
||||
state.thread_pool(),
|
||||
);
|
||||
let map = world.get_map_data(index.as_index_ref(), state.thread_pool());
|
||||
|
||||
#[cfg(not(feature = "worldgen"))]
|
||||
let (world, index) = World::generate(settings.world_seed);
|
||||
|
@ -120,11 +120,7 @@ impl World {
|
||||
// TODO
|
||||
}
|
||||
|
||||
pub fn get_map_data(
|
||||
&self,
|
||||
index: IndexRef,
|
||||
threadpool: &rayon::ThreadPool,
|
||||
) -> WorldMapMsg {
|
||||
pub fn get_map_data(&self, index: IndexRef, threadpool: &rayon::ThreadPool) -> WorldMapMsg {
|
||||
threadpool.install(|| {
|
||||
// we need these numbers to create unique ids for cave ends
|
||||
let num_sites = self.civs().sites().count() as u64;
|
||||
|
@ -395,7 +395,7 @@ pub struct WorldSim {
|
||||
impl WorldSim {
|
||||
pub fn generate(seed: u32, opts: WorldOpts, threadpool: &rayon::ThreadPool) -> Self {
|
||||
let calendar = opts.calendar; // separate lifetime of elements
|
||||
let world_file = opts.world_file;
|
||||
let world_file = opts.world_file;
|
||||
// Parse out the contents of various map formats into the values we need.
|
||||
let parsed_world_file = (|| {
|
||||
let map = match world_file {
|
||||
|
@ -8,7 +8,7 @@ pub use self::{
|
||||
};
|
||||
|
||||
use crate::IndexRef;
|
||||
use common::terrain::Block;
|
||||
use common::{calendar::Calendar, terrain::Block};
|
||||
use rand::prelude::*;
|
||||
use serde::Deserialize;
|
||||
use vek::*;
|
||||
@ -25,7 +25,7 @@ pub struct Building<A: Archetype> {
|
||||
}
|
||||
|
||||
impl<A: Archetype> Building<A> {
|
||||
pub fn generate(rng: &mut impl Rng, origin: Vec3<i32>) -> Self
|
||||
pub fn generate(rng: &mut impl Rng, origin: Vec3<i32>, calendar: Option<&Calendar>) -> Self
|
||||
where
|
||||
A: Sized,
|
||||
{
|
||||
|
@ -440,11 +440,13 @@ impl Settlement {
|
||||
StructureKind::Keep(Building::<Keep>::generate(
|
||||
ctx.rng,
|
||||
Vec3::new(house_pos.x, house_pos.y, alt),
|
||||
None,
|
||||
))
|
||||
} else {
|
||||
StructureKind::House(Building::<House>::generate(
|
||||
ctx.rng,
|
||||
Vec3::new(house_pos.x, house_pos.y, alt),
|
||||
ctx.sim.map(|sim| sim.calendar.as_ref()).flatten(),
|
||||
))
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user