Fix generate_chunk to also accept Calendar

This commit is contained in:
Inojelis 2022-02-21 02:48:12 +02:00
parent 473a807e46
commit 3e5a220980

View File

@ -1,3 +1,8 @@
use std::time::Duration;
use rand::{prelude::*, rngs::SmallRng};
use vek::*;
use common::{ use common::{
generation::{ChunkSupplement, EntityInfo}, generation::{ChunkSupplement, EntityInfo},
resources::TimeOfDay, resources::TimeOfDay,
@ -6,9 +11,7 @@ use common::{
}, },
vol::{ReadVol, RectVolSize, WriteVol}, vol::{ReadVol, RectVolSize, WriteVol},
}; };
use rand::{prelude::*, rngs::SmallRng}; use common::calendar::Calendar;
use std::time::Duration;
use vek::*;
const DEFAULT_WORLD_CHUNKS_LG: MapSizeLg = const DEFAULT_WORLD_CHUNKS_LG: MapSizeLg =
if let Ok(map_size_lg) = MapSizeLg::new(Vec2 { x: 1, y: 1 }) { if let Ok(map_size_lg) = MapSizeLg::new(Vec2 { x: 1, y: 1 }) {
@ -46,7 +49,7 @@ impl World {
_index: IndexRef, _index: IndexRef,
chunk_pos: Vec2<i32>, chunk_pos: Vec2<i32>,
_should_continue: impl FnMut() -> bool, _should_continue: impl FnMut() -> bool,
_time: Option<TimeOfDay>, _time: Option<(TimeOfDay, Calendar)>,
) -> Result<(TerrainChunk, ChunkSupplement), ()> { ) -> Result<(TerrainChunk, ChunkSupplement), ()> {
let (x, y) = chunk_pos.map(|e| e.to_le_bytes()).into_tuple(); let (x, y) = chunk_pos.map(|e| e.to_le_bytes()).into_tuple();
let mut rng = SmallRng::from_seed([ let mut rng = SmallRng::from_seed([