Skip to content

Commit 17e70ab

Browse files
committed
Collect all worldgen code into the worldgen module
1 parent 872bff9 commit 17e70ab

File tree

5 files changed

+8
-18
lines changed

5 files changed

+8
-18
lines changed

common/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ mod margins;
2626
pub mod math;
2727
pub mod node;
2828
pub mod peer_traverser;
29-
mod plane;
3029
pub mod proto;
3130
mod sim_config;
32-
pub mod terraingen;
3331
pub mod traversal;
3432
pub mod voxel_math;
3533
pub mod world;

common/src/peer_traverser.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -177,26 +177,21 @@ struct AssertingGraphRef<'a> {
177177
}
178178

179179
impl AsRef<Graph> for AssertingGraphRef<'_> {
180-
#[inline]
181180
fn as_ref(&self) -> &Graph {
182181
self.graph
183182
}
184183
}
185184

186-
impl GraphRef for AssertingGraphRef<'_> {
187-
#[inline]
185+
impl<'a> GraphRef for AssertingGraphRef<'a> {
188186
fn depth(&self, node: NodeId) -> u32 {
189187
self.graph.depth(node)
190188
}
191189

192-
#[inline]
193190
fn neighbor(&mut self, node: NodeId, side: Side) -> NodeId {
194191
self.graph.neighbor(node, side).unwrap()
195192
}
196193

197-
#[inline]
198-
#[allow(refining_impl_trait)]
199-
fn parents(&self, node: NodeId) -> impl ExactSizeIterator<Item = (Side, NodeId)> + use<> {
194+
fn parents(&self, node: NodeId) -> impl ExactSizeIterator<Item = (Side, NodeId)> + use<'a> {
200195
self.graph.parents(node)
201196
}
202197
}
@@ -206,26 +201,21 @@ struct ExpandingGraphRef<'a> {
206201
graph: &'a mut Graph,
207202
}
208203

209-
impl GraphRef for ExpandingGraphRef<'_> {
210-
#[inline]
204+
impl<'a> GraphRef for ExpandingGraphRef<'a> {
211205
fn depth(&self, node: NodeId) -> u32 {
212206
self.graph.depth(node)
213207
}
214208

215-
#[inline]
216209
fn neighbor(&mut self, node: NodeId, side: Side) -> NodeId {
217210
self.graph.ensure_neighbor(node, side)
218211
}
219212

220-
#[inline]
221-
#[allow(refining_impl_trait)]
222-
fn parents(&self, node: NodeId) -> impl ExactSizeIterator<Item = (Side, NodeId)> + use<> {
213+
fn parents(&self, node: NodeId) -> impl ExactSizeIterator<Item = (Side, NodeId)> + use<'a> {
223214
self.graph.parents(node)
224215
}
225216
}
226217

227218
impl AsRef<Graph> for ExpandingGraphRef<'_> {
228-
#[inline]
229219
fn as_ref(&self) -> &Graph {
230220
self.graph
231221
}

common/src/worldgen.rs renamed to common/src/worldgen/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
use horosphere::{HorosphereChunk, HorosphereNode};
2+
use plane::Plane;
23
use rand::{Rng, SeedableRng, distr::Uniform};
34
use rand_distr::Normal;
5+
use terraingen::VoronoiInfo;
46

57
use crate::{
68
dodeca::{Side, Vertex},
79
graph::{Graph, NodeId},
810
margins,
911
math::{self, MVector},
1012
node::{ChunkId, VoxelData},
11-
plane::Plane,
12-
terraingen::VoronoiInfo,
1313
world::Material,
1414
};
1515

1616
mod horosphere;
17+
mod plane;
18+
mod terraingen;
1719

1820
#[derive(Clone, Copy, PartialEq, Debug)]
1921
enum NodeStateKind {
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)